Class: Riak::Client::BeefcakeProtobuffsBackend::BucketPropertiesOperator

Inherits:
Object
  • Object
show all
Defined in:
lib/riak/client/beefcake/bucket_properties_operator.rb

Constant Summary collapse

QUORUMS =
Riak::Client::ProtobuffsBackend::QUORUMS

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(backend) ⇒ BucketPropertiesOperator

Returns a new instance of BucketPropertiesOperator.



12
13
14
# File 'lib/riak/client/beefcake/bucket_properties_operator.rb', line 12

def initialize(backend)
  @backend = backend
end

Instance Attribute Details

#backendObject (readonly)

Returns the value of attribute backend.



8
9
10
# File 'lib/riak/client/beefcake/bucket_properties_operator.rb', line 8

def backend
  @backend
end

Instance Method Details

#get(bucket, options = {}) ⇒ Object



16
17
18
19
20
21
22
23
24
25
# File 'lib/riak/client/beefcake/bucket_properties_operator.rb', line 16

def get(bucket, options = {})
  response = backend.protocol do |p|
    p.write :GetBucketReq, get_request(bucket, options)
    p.expect :GetBucketResp, RpbGetBucketResp
  end

  properties = response.props.to_hash.stringify_keys

  return rubyfy(properties)
end

#put(bucket, props = {}, options = {}) ⇒ Object



27
28
29
30
31
32
33
34
35
36
# File 'lib/riak/client/beefcake/bucket_properties_operator.rb', line 27

def put(bucket, props = {}, options = {})
  properties = riakify props

  request = put_request bucket, properties, options

  backend.protocol do |p|
    p.write :SetBucketReq, request
    p.expect :SetBucketResp
  end
end