Class: Blodsband::Riak::Bucket
- Inherits:
-
Object
- Object
- Blodsband::Riak::Bucket
- Defined in:
- lib/blodsband/riak/bucket.rb
Overview
Encapsulates functionality of Riak buckets.
Instance Attribute Summary collapse
-
#defaults ⇒ Object
readonly
- Hash<Symbol, Object>
-
The default options for this Bucket.
-
#name ⇒ Object
readonly
- String
-
The name of the Riak bucket this Bucket refers to.
Instance Method Summary collapse
-
#[](key) ⇒ Blodsband::Riak::Response
Fetch a value from Riak.
-
#[]=(key, value) ⇒ Blodsband::Riak::Response
Put a value in Riak.
-
#aadd_index_rel(key, names, rel) ⇒ Blodsband::Riak::Future<Blodsband::Riak::Response>
Add an index stored relation to Riak.
Right now this has proven meaningful up to relation sizes of about 10000 due to Riak Search limitations when it comes to how it counts and fetches documents. After that a clear linear scaling is observable.
-
#acas(key, value, expected_vclock, options = {}) ⇒ Blodsband::Future<Object>
Compare the value of a key to an expected vclock (or nil) and uniquely set a new value if the current value matches the expectations.
-
#acount_index_rels(key, names) ⇒ Blodsband::Future<Integer>
Count the number of relations of a given type.
-
#add_index_rel(key, names, rel) ⇒ Blodsband::Riak::Response
Add an index stored relation to Riak.
-
#adelete(key, options = {}) ⇒ Blodsband::Future<Blodsband::Riak::Response>
Delete a key in Riak.
-
#adelete_index_rel(key, names, rel) ⇒ Blodsband::Future<Blodsband::Riak::Response>
Remove an index stored relation from Riak.
-
#aget(key, options = {}) ⇒ Blodsband::Future<Blodsband::Riak::Response>
Fetch a value from Riak.
-
#aget_many(keys) ⇒ Blodsband::Future<Array<Blodsband::Riak::Response>>
Efficiently fetch values for many keys in Riak.
-
#ahas_index_rel?(key, names, rel) ⇒ Blodsband::Future<true,false>
Check whether a given relation exists.
-
#ahas_many?(keys) ⇒ Blodsband::Future<Set<String>>
Efficiently check what keys correspond to existing values in Riak.
-
#aindex_rels(key, names) ⇒ Blodsband::Riak::Future<Array<Blodsband::Riak::Response>>
Retrieve a set of relations stored in the Riak index.
-
#aput(key, value, options = {}) ⇒ Blodsband::Future<Blodsband::Riak::Response>
Put a value in Riak.
-
#aput_if_missing(key, value, options = {}) ⇒ Blodsband::Future<Object>
Put a value in the bucket if the key is missing.
-
#arecip_index_rels(key, names) ⇒ Blodsband::Riak::Future<Array<Blodsband::Riak::Response>>
Retrieve a set of relations having the same relation to us as we to them.
-
#cas(key, value, expected_vclock, options = {}) ⇒ Object
Compare the value of a key to an expected vclock (or nil) and uniquely set a new value if the current value matches the expectations.
-
#count_index_rels(key, names) ⇒ Integer
Count the number of relations of a given type.
- #counter(key) ⇒ Blodsband::Riak::Counter
-
#delete(key, options = {}) ⇒ Blodsband::Riak::Response
Delete a key in Riak.
-
#delete_index_rel(key, names, rel) ⇒ Blodsband::Riak::Response
Remove an index stored relation from Riak.
-
#get(key, options = {}) ⇒ Blodsband::Riak::Response
Fetch a value from Riak.
-
#get_many(keys) ⇒ Array<Blodsband::Riak::Response>
Efficiently fetch values for many keys in Riak.
-
#has_index_rel?(key, names, rel) ⇒ true, false
Check whether a given relation exists.
-
#has_many?(keys) ⇒ Set<String>
Efficiently check what keys correspond to existing values in Riak.
-
#index_rels(key, names) ⇒ Array<Blodsband::Riak::Response>
Retrieve a set of relations stored in the Riak index.
-
#indexed ⇒ Blodsband::Riak::Bucket
Sets the Bucket property
:search
totrue
. -
#initialize(url, name, options = {}) ⇒ Bucket
constructor
Create a Bucket.
- #list(key) ⇒ Blodsband::Riak::List
-
#lock(key) ⇒ Blodsband::Riak::Lock
Get a concurrent Tree in this Bucket.
- #map(key) ⇒ Blodsband::Riak::Map
-
#props ⇒ Hash<Symbol, Object>
The properties of this Riak bucket.
-
#props=(p) ⇒ Object
Sets the properties of this Riak bucket.
-
#put(key, value, options = {}) ⇒ Blodsband::Riak::Response
Put a value in Riak.
-
#put_if_missing(key, value, options = {}) ⇒ Object
Put a value in the bucket if the key is missing.
-
#recip_index_rels(key, names) ⇒ Array<Blodsband::Riak::Response>
Retrieve a set of relations having the same relation to us as we to them.
- #sset(key) ⇒ Blodsband::Riak::Sset
-
#unique ⇒ Blodsband::Riak::Bucket
Sets the Bucket property
:allow_mult
totrue
and the default option:unique
totrue
.
Constructor Details
#initialize(url, name, options = {}) ⇒ Bucket
Create a Blodsband::Riak::Bucket.
29 30 31 32 33 34 |
# File 'lib/blodsband/riak/bucket.rb', line 29 def initialize(url, name, = {}) @url = url @name = name @defaults = .merge(:client_id => rand(1 << 256).to_s(36)) raise "Unknown options to #{self.class}#initialize: #{}" unless .empty? end |
Instance Attribute Details
#defaults ⇒ Object (readonly)
- Hash<Symbol, Object>
-
The default options for this Blodsband::Riak::Bucket
18 19 20 |
# File 'lib/blodsband/riak/bucket.rb', line 18 def defaults @defaults end |
#name ⇒ Object (readonly)
- String
-
The name of the Riak bucket this Blodsband::Riak::Bucket refers to.
14 15 16 |
# File 'lib/blodsband/riak/bucket.rb', line 14 def name @name end |
Instance Method Details
#[](key) ⇒ Blodsband::Riak::Response
Fetch a value from Riak.
205 206 207 |
# File 'lib/blodsband/riak/bucket.rb', line 205 def [](key) self.get(key) end |
#[]=(key, value) ⇒ Blodsband::Riak::Response
Put a value in Riak.
116 117 118 |
# File 'lib/blodsband/riak/bucket.rb', line 116 def []=(key, value) self.put(key, value) end |
#aadd_index_rel(key, names, rel) ⇒ Blodsband::Riak::Future<Blodsband::Riak::Response>
The rel
parameter can have a Hash as a third element containing extra attributes for the relationship. These attributes will be stored in the relationship document and can be used to filter queries on this relationship type. This is also usable from the #put method and will have the same effect there.
Add an index stored relation to Riak.
Right now this has proven meaningful up to relation sizes of about 10000 due to Riak Search limitations when it comes to how it counts and fetches documents. After that a clear linear scaling is observable.
600 601 602 |
# File 'lib/blodsband/riak/bucket.rb', line 600 def aadd_index_rel(key, names, rel) Bucket.new(@url, names.sort.join("-")).aput(index_rel_key(key, names, rel), index_rel_document(names, key, rel)) end |
#acas(key, value, expected_vclock, options = {}) ⇒ Blodsband::Future<Object>
Compare the value of a key to an expected vclock (or nil) and uniquely set a new value if the current value matches the expectations.
491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 |
# File 'lib/blodsband/riak/bucket.rb', line 491 def acas(key, value, expected_vclock, = {}) # # While result is :nothing we will continue working. # result = :nothing # # Remember the fiber that started it all # parent = Fiber.current # # Create a fiber that does our dirty work for us # Fiber.new do post_check_sleep = .delete(:post_check_sleep) post_write_sleep = .delete(:post_write_sleep) client_id = @defaults[:client_id] || rand(1 << 256).to_s(36) cas_id = rand(1 << 256).to_s(36) current = get(key) sleep(post_check_sleep) if post_check_sleep # # While we lack a result # while result == :nothing do if (expected_vclock.nil? && current.nil?) || (current.respond_to?(:vclock) && current.vclock == expected_vclock) # # The current value is what we expected, write our value and repeat with the response # current = put(key, value, :riak_params => {:w => :all, :returnbody => true}, :client_id => client_id, :vclock => current.respond_to?(:vclock) ? current.vclock : nil, :meta => { "cas-state" => "prospect", "cas-voter" => cas_id, "cas-id" => cas_id }) sleep(post_write_sleep) if post_write_sleep else # # The current value was not what we expected, check what is the winner. # winner = find_winner(key, current, .merge(:client_id => client_id, :cas_voter => cas_id)) if winner.nil? # # No winner, we tried to overwrite an existing value that didn't exist. # result = nil elsif winner.["cas-id"] == cas_id # # We are winners! # result = winner else # # We lost :/ # result = nil end end end # # Resume the parent if necessary. # parent.resume if parent.alive? && parent != Fiber.current end.resume return(Future.new do rval = nil Fiber.yield while result == :nothing result end) end |
#acount_index_rels(key, names) ⇒ Blodsband::Future<Integer>
The rel
parameter can have a Hash as a third element containing extra attributes for the relationship. These attributes will be stored in the relationship document and can be used to filter queries on this relationship type. This is also usable from the #put method and will have the same effect there.
Count the number of relations of a given type.
634 635 636 637 638 639 |
# File 'lib/blodsband/riak/bucket.rb', line 634 def acount_index_rels(key, names) future = Search.new(@url).asearch(create_search_expression(key, names), :index => names.sort.join("-"), :page => 1, :per_page => 1) return(Future.new do future.get[:total] end) end |
#add_index_rel(key, names, rel) ⇒ Blodsband::Riak::Response
The rel
parameter can have a Hash as a third element containing extra attributes for the relationship. These attributes will be stored in the relationship document and can be used to filter queries on this relationship type. This is also usable from the #put method and will have the same effect there.
Add an index stored relation to Riak.
Right now this has proven meaningful up to relation sizes of about 10000 due to Riak Search limitations when it comes to how it counts and fetches documents. After that a clear linear scaling is observable.
621 622 623 |
# File 'lib/blodsband/riak/bucket.rb', line 621 def add_index_rel(key, names, rel) aadd_index_rel(key, names, rel).get end |
#adelete(key, options = {}) ⇒ Blodsband::Future<Blodsband::Riak::Response>
Delete a key in Riak.
83 84 85 86 87 88 89 90 91 92 93 |
# File 'lib/blodsband/riak/bucket.rb', line 83 def adelete(key, = {}) riak_params = .delete(:riak_params) m = Multi.new url = uri(key) url += "?#{riak_params.collect do |k,v| "#{CGI.escape(k.to_s)}=#{CGI.escape(v.to_s)}" end.join("&")}" if riak_params m.add(:resp, EM::HttpRequest.new(url).adelete) return(Future.new do m.really_perform Response.parse(m) end) end |
#adelete_index_rel(key, names, rel) ⇒ Blodsband::Future<Blodsband::Riak::Response>
Remove an index stored relation from Riak.
574 575 576 |
# File 'lib/blodsband/riak/bucket.rb', line 574 def adelete_index_rel(key, names, rel) Bucket.new(@url, names.sort.join("-")).adelete(index_rel_key(key, names, rel)) end |
#aget(key, options = {}) ⇒ Blodsband::Future<Blodsband::Riak::Response>
Fetch a value from Riak.
321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 |
# File 'lib/blodsband/riak/bucket.rb', line 321 def aget(key, = {}) links = .delete(:links) index_rels = .delete(:index_rels) riak_params = .delete(:riak_params) unique = .include?(:unique) ? .delete(:unique) : @defaults[:unique] ary = .delete(:ary) || @defaults[:ary] raise "Unknown options to #{self.class}#get(#{key}, ...): #{.inspect}" unless .empty? u = uri(key) m = Multi.new if links links.each do |linkchain| m.add(linkchain, EM::HttpRequest.new("#{u}#{create_link_walker(linkchain)}").aget) end end mrs = [] if index_rels index_rels.each do |names| mrs << aindex_rels(key, names) end end u += "?#{riak_params.collect do |k,v| "#{CGI.escape(k.to_s)}=#{CGI.escape(v.to_s)}" end.join("&")}" if riak_params m.add(:resp, EM::HttpRequest.new(u).aget(:head => {"Accept" => "multipart/mixed, application/json"})) return(Future.new do m.really_perform resp = Response.parse(m, :links => links, :bucket => @name, :key => key) resp = find_winner(key, resp) if unique && resp && resp.status == 300 resp = arify(resp) if ary rval = resp if mrs.size > 0 unless resp.is_a?(Hash) rval = [resp] end class << resp attr_reader :index_rels end mrs.each_with_index do |mr, index| resp.instance_eval do @index_rels ||= {} @index_rels[index_rels[index]] = mr.get.collect do |hash| [hash["bucket"], hash["key"]] end end if resp.is_a?(Hash) resp[index_rels[index][1].to_s] = mr.get.collect do |hash| extended_index_rel(hash) end else rval << mr.get.collect do |hash| extended_index_rel(hash) end end end end rval end) end |
#aget_many(keys) ⇒ Blodsband::Future<Array<Blodsband::Riak::Response>>
Efficiently fetch values for many keys in Riak.
281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 |
# File 'lib/blodsband/riak/bucket.rb', line 281 def aget_many(keys) Mr.new(@url). inputs(keys.collect do |key| [@name, key] end). map({ :keep => false, :language => "javascript", :source => <<EOF function(v,k,a) { if (v.values != null) { return [v]; } else { return []; } } EOF }). reduce({ :keep => true, :language => "javascript", :source => <<EOF function(v) { rval = []; for (var i = 0; i < v.length; i++) { if (v[i].values != null) { rval.push(JSON.parse(v[i].values[0].data)); } } return rval; } EOF }).arun end |
#ahas_index_rel?(key, names, rel) ⇒ Blodsband::Future<true,false>
Check whether a given relation exists.
662 663 664 665 666 667 |
# File 'lib/blodsband/riak/bucket.rb', line 662 def ahas_index_rel?(key, names, rel) future = Bucket.new(@url, names.sort.join("-")).aget(index_rel_key(key, names, rel)) return(Future.new do !future.get.nil? end) end |
#ahas_many?(keys) ⇒ Blodsband::Future<Set<String>>
Efficiently check what keys correspond to existing values in Riak.
227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 |
# File 'lib/blodsband/riak/bucket.rb', line 227 def ahas_many?(keys) future = Mr.new(@url). inputs(keys.collect do |key| [@name, key] end). map({ :keep => false, :language => "javascript", :source => <<EOF function(v,k,a) { if (v.values != null) { return [v]; } else { return []; } } EOF }). reduce({ :keep => true, :language => "javascript", :source => <<EOF function(v) { rval = []; for (var i = 0; i < v.length; i++) { if (v[i].values != null) { rval.push(v[i].key); } } return rval; } EOF }).arun return(Future.new do Set.new(future.get) end) end |
#aindex_rels(key, names) ⇒ Blodsband::Riak::Future<Array<Blodsband::Riak::Response>>
The names
parameter can have a Hash as third element containing a filter definition :field => :required_value
that will be used to filter the relations returned. This is also usable from the #get method and will have the same effect there.
Retrieve a set of relations stored in the Riak index.
691 692 693 |
# File 'lib/blodsband/riak/bucket.rb', line 691 def aindex_rels(key, names) index_rel_mr(key, names).arun end |
#aput(key, value, options = {}) ⇒ Blodsband::Future<Blodsband::Riak::Response>
Put a value in Riak.
127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 |
# File 'lib/blodsband/riak/bucket.rb', line 127 def aput(key, value, = {}) links = value.links if value.respond_to?(:links) links = (links || {}).merge(.delete(:links)) if .include?(:links) index_rels = value.index_rels if value.respond_to?(:index_rels) index_rels = (index_rels || {}).merge(.delete(:index_rels)) if .include?(:index_rels) riak_params = .delete(:riak_params) vclock = value.vclock if value.respond_to?(:vclock) vclock = .delete(:vclock) if .include?(:vclock) client_id = .delete(:client_id) || @defaults[:client_id] = value. if value.respond_to?(:meta) = ( || {}).merge(.delete(:meta)) if .include?(:meta) ||= {} raise "Unknown options to #{self.class}#put(#{key}, #{value}, ...): #{.inspect}" unless .empty? head = { "Content-Type" => "application/json", "Accept" => "multipart/mixed, application/json" } .each do |k, v| head["X-Riak-Meta-#{k}"] = v.to_s end head["X-Riak-ClientId"] = client_id if client_id head["Link"] = create_link_header(links) if links head["X-Riak-Vclock"] = vclock if vclock index_rel_futures = [] if index_rels index_rels.each do |names, relations| relations.each do |rel| index_rel_futures << aadd_index_rel(key, names, rel) end end end url = uri(key) url += "?#{riak_params.collect do |k,v| "#{CGI.escape(k.to_s)}=#{CGI.escape(v.to_s)}" end.join("&")}" if riak_params m = Multi.new m.add(:resp, EM::HttpRequest.new(url).apost(:body => Yajl::Encoder.encode(value), :head => head)) return(Future.new do m.really_perform index_rel_futures.each do |f| f.get end Response.parse(m, :bucket => @name, :key => key) end) end |
#aput_if_missing(key, value, options = {}) ⇒ Blodsband::Future<Object>
Put a value in the bucket if the key is missing.
464 465 466 |
# File 'lib/blodsband/riak/bucket.rb', line 464 def aput_if_missing(key, value, = {}) acas(key, value, nil, ) end |
#arecip_index_rels(key, names) ⇒ Blodsband::Riak::Future<Array<Blodsband::Riak::Response>>
The names
parameter can have a Hash as third element containing a filter definition :field => :required_value
that will be used to filter the relations returned. This is also usable from the #get method and will have the same effect there.
Retrieve a set of relations having the same relation to us as we to them.
704 705 706 |
# File 'lib/blodsband/riak/bucket.rb', line 704 def arecip_index_rels(key, names) recip_index_rel_mr(key, names).arun end |
#cas(key, value, expected_vclock, options = {}) ⇒ Object
Compare the value of a key to an expected vclock (or nil) and uniquely set a new value if the current value matches the expectations.
480 481 482 |
# File 'lib/blodsband/riak/bucket.rb', line 480 def cas(key, value, expected_vclock, = {}) acas(key, value, expected_vclock, ).get end |
#count_index_rels(key, names) ⇒ Integer
The rel
parameter can have a Hash as a third element containing extra attributes for the relationship. These attributes will be stored in the relationship document and can be used to filter queries on this relationship type. This is also usable from the #put method and will have the same effect there.
Count the number of relations of a given type.
651 652 653 |
# File 'lib/blodsband/riak/bucket.rb', line 651 def count_index_rels(key, names) acount_index_rels(key, names).get end |
#counter(key) ⇒ Blodsband::Riak::Counter
Get a concurrent Counter in this Blodsband::Riak::Bucket.
439 440 441 |
# File 'lib/blodsband/riak/bucket.rb', line 439 def counter(key) return Counter.new(self, key) end |
#delete(key, options = {}) ⇒ Blodsband::Riak::Response
Delete a key in Riak.
104 105 106 |
# File 'lib/blodsband/riak/bucket.rb', line 104 def delete(key, = {}) adelete(key, ).get end |
#delete_index_rel(key, names, rel) ⇒ Blodsband::Riak::Response
Remove an index stored relation from Riak.
587 588 589 |
# File 'lib/blodsband/riak/bucket.rb', line 587 def delete_index_rel(key, names, rel) adelete_index_rel(key, names, rel).get end |
#get(key, options = {}) ⇒ Blodsband::Riak::Response
Fetch a value from Riak.
384 385 386 |
# File 'lib/blodsband/riak/bucket.rb', line 384 def get(key, = {}) aget(key, ).get end |
#get_many(keys) ⇒ Array<Blodsband::Riak::Response>
Efficiently fetch values for many keys in Riak.
270 271 272 |
# File 'lib/blodsband/riak/bucket.rb', line 270 def get_many(keys) aget_many(keys).get end |
#has_index_rel?(key, names, rel) ⇒ true, false
Check whether a given relation exists.
678 679 680 |
# File 'lib/blodsband/riak/bucket.rb', line 678 def has_index_rel?(key, names, rel) ahas_index_rel?(key, names, rel).get end |
#has_many?(keys) ⇒ Set<String>
Efficiently check what keys correspond to existing values in Riak.
216 217 218 |
# File 'lib/blodsband/riak/bucket.rb', line 216 def has_many?(keys) ahas_many?(keys).get end |
#index_rels(key, names) ⇒ Array<Blodsband::Riak::Response>
The names
parameter can have a Hash as third element containing a filter definition :field => :required_value
that will be used to filter the relations returned. This is also usable from the #get method and will have the same effect there.
Retrieve a set of relations stored in the Riak index.
734 735 736 |
# File 'lib/blodsband/riak/bucket.rb', line 734 def index_rels(key, names) aindex_rels(key, names).get end |
#indexed ⇒ Blodsband::Riak::Bucket
Sets the Blodsband::Riak::Bucket property :search
to true
.
53 54 55 56 |
# File 'lib/blodsband/riak/bucket.rb', line 53 def indexed self.props = {:search => true} self end |
#list(key) ⇒ Blodsband::Riak::List
Get a concurrent List in this Blodsband::Riak::Bucket.
406 407 408 |
# File 'lib/blodsband/riak/bucket.rb', line 406 def list(key) return List.new(self, key) end |
#lock(key) ⇒ Blodsband::Riak::Lock
Get a concurrent Tree in this Blodsband::Riak::Bucket.
395 396 397 |
# File 'lib/blodsband/riak/bucket.rb', line 395 def lock(key) return Lock.new(self, key) end |
#map(key) ⇒ Blodsband::Riak::Map
Get a concurrent Map in this Blodsband::Riak::Bucket.
417 418 419 |
# File 'lib/blodsband/riak/bucket.rb', line 417 def map(key) return Map.new(self, key) end |
#props ⇒ Hash<Symbol, Object>
Returns the properties of this Riak bucket.
61 62 63 |
# File 'lib/blodsband/riak/bucket.rb', line 61 def props Yajl::Parser.parse(EM::HttpRequest.new(uri).get.response)['props'] end |
#props=(p) ⇒ Object
Sets the properties of this Riak bucket. Will merge in the given properties with the existing ones, so a complete property Hash is not necessary.
71 72 73 74 |
# File 'lib/blodsband/riak/bucket.rb', line 71 def props=(p) EM::HttpRequest.new(uri).put(:head => {"Content-Type" => "application/json"}, :body => Yajl::Encoder.encode(:props => p)) end |
#put(key, value, options = {}) ⇒ Blodsband::Riak::Response
Put a value in Riak.
194 195 196 |
# File 'lib/blodsband/riak/bucket.rb', line 194 def put(key, value, = {}) aput(key, value, ).get end |
#put_if_missing(key, value, options = {}) ⇒ Object
Put a value in the bucket if the key is missing.
453 454 455 |
# File 'lib/blodsband/riak/bucket.rb', line 453 def put_if_missing(key, value, = {}) aput_if_missing(key, value, ).get end |
#recip_index_rels(key, names) ⇒ Array<Blodsband::Riak::Response>
The names
parameter can have a Hash as third element containing a filter definition :field => :required_value
that will be used to filter the relations returned. This is also usable from the #get method and will have the same effect there.
Retrieve a set of relations having the same relation to us as we to them.
718 719 720 |
# File 'lib/blodsband/riak/bucket.rb', line 718 def recip_index_rels(key, names) arecip_index_rels(key, names).get end |
#sset(key) ⇒ Blodsband::Riak::Sset
Get a concurrent Sset in this Blodsband::Riak::Bucket.
428 429 430 |
# File 'lib/blodsband/riak/bucket.rb', line 428 def sset(key) return Sset.new(self, key) end |
#unique ⇒ Blodsband::Riak::Bucket
Sets the Blodsband::Riak::Bucket property :allow_mult
to true
and the default option :unique
to true
.
42 43 44 45 46 |
# File 'lib/blodsband/riak/bucket.rb', line 42 def unique @defaults[:unique] = true self.props = {:allow_mult => true} self end |