struct
CryBase::CouchBase::Services::KV::Request
- CryBase::CouchBase::Services::KV::Request
- Struct
- Value
- Object
Overview
One outbound packet for the KV service, as a pure value type.
RequestBuffer.make serializes it; RequestWriter#write sends it.
req = KV::Request.new(KV::Opcode::Get, key: "hello")
req.opcode # => KV::Opcode::Get
req.key # => "hello"
req.opaque # => 0_u32
req.to_buffer # => Bytes
The fields:
- opcode — the command code (
Opcode::Get,::Set, etc.) - key — the document/operation key (UTF-8 string)
- extras — opcode-specific bytes that precede the body
- value — the document/operation body
- cas — compare-and-swap token, or
0for "any" - opaque — caller-controlled echo field; the server returns it verbatim in the response
- vbucket — key partition id used by document operations
Defined in:
crybase/couchbase/services/kv/request.cr:23crybase/couchbase/services/kv/request.cr:32
Constructors
Instance Method Summary
- #cas : UInt64
- #clone
- #copy_with(opcode _opcode = @opcode, key _key = @key, extras _extras = @extras, value _value = @value, cas _cas = @cas, opaque _opaque = @opaque, vbucket _vbucket = @vbucket)
- #extras : Bytes
- #key : String
- #opaque : UInt32
- #opcode : Opcode
-
#to_buffer : Bytes
Serializes this request into one binary KV packet.
- #value : Bytes
- #vbucket : UInt16
Constructor Detail
def self.new(opcode : Opcode, key : String = "", extras : Bytes = Bytes.empty, value : Bytes = Bytes.empty, cas : UInt64 = 0_u64, opaque : UInt32 = 0_u32, vbucket : UInt16 = 0_u16)
#
Instance Method Detail
def copy_with(opcode _opcode = @opcode, key _key = @key, extras _extras = @extras, value _value = @value, cas _cas = @cas, opaque _opaque = @opaque, vbucket _vbucket = @vbucket)
#