Class: Tair::PutRequest

Inherits:
Request show all
Defined in:
lib/tair/operation/put.rb

Defined Under Namespace

Classes: Body

Constant Summary collapse

PACKET_CODE =
1
TAIR_TYPE_STRING =
2

Constants inherited from Request

Request::MAX_INT32, Request::TAIR_PACKET_FLAG

Instance Attribute Summary

Attributes inherited from Request

#namespace

Instance Method Summary collapse

Methods inherited from Request

#encode, #header, #inspect, #packet_code, #req_id

Constructor Details

#initialize(kv) ⇒ PutRequest

Returns a new instance of PutRequest.



31
32
33
# File 'lib/tair/operation/put.rb', line 31

def initialize(kv)
  @key, @value  = *(kv.to_a.flatten)
end

Instance Method Details

#bodyObject



36
37
38
39
40
41
42
# File 'lib/tair/operation/put.rb', line 36

def body
  Body.new.tap do |body|
    body.key = @key
    body.value = @value
    body.namespace = namespace || 0
  end
end