Description
Allow to specify strategy of selecting replica nodes. Now three strategies available:
- `:first` - synonym to `true`, previous behaviour and currently
default. It means that the library will sequentially iterate
over all replicas and will return as soon as find successful
response, or report error from the latest.
c.get("foo", :replica => true)
c.get("foo", :replica => :first)
#=> "bar"
c.get("foo", :replica => :first, :extended => true)
#=> ["bar", 0, 11218368683493556224]
- `:all` - query all replicas in parallel. In this case the method
will return array of the values on the all replica nodes without
particular order. Also if the key isn't on the node, it will be
skipped in the result array.
c.get("foo", :replica => :all)
#=> ["bar", "bar", "bar"]
c.get("foo", :replica => :all, :extended => true)
#=> [["bar", 0, 11218368683493556224],
- ["bar", 0, 11218368683493556224],
- ["bar", 0, 11218368683493556224]]
- `Fixnum` - you can also select specific replica node by its
index in the cluster configuration. It should be in interval
`0...c.num_replicas`
0...c.num_replicas
#=> 0...3
c.get("foo", :replica => 1)
#=> "bar"
c.get("foo", :replica => 42)
#=> ArgumentError: replica index should be in interval 0...3
Attachments
Issue Links
- depends on
-
CCBC-183 Implement approach to specify behaviour for lcb_get_replica()
- Closed