Class: Couchbase::Options::Increment
- Defined in:
- lib/couchbase/options.rb
Overview
Options for BinaryCollection#increment
Constant Summary collapse
- DEFAULT =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
Increment.new.freeze
Instance Attribute Summary collapse
Attributes inherited from Base
#client_context, #parent_span, #retry_strategy, #timeout
Instance Method Summary collapse
-
#initialize(delta: 1, initial: nil, expiry: nil, durability_level: :none, replicate_to: :none, persist_to: :none, timeout: nil, retry_strategy: nil, client_context: nil, parent_span: nil) {|self| ... } ⇒ Increment
constructor
Creates an instance of options for BinaryCollection#increment.
- #to_backend ⇒ Object private
Constructor Details
#initialize(delta: 1, initial: nil, expiry: nil, durability_level: :none, replicate_to: :none, persist_to: :none, timeout: nil, retry_strategy: nil, client_context: nil, parent_span: nil) {|self| ... } ⇒ Increment
Creates an instance of options for BinaryCollection#increment
1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 |
# File 'lib/couchbase/options.rb', line 1377 def initialize(delta: 1, initial: nil, expiry: nil, durability_level: :none, replicate_to: :none, persist_to: :none, timeout: nil, retry_strategy: nil, client_context: nil, parent_span: nil) raise ArgumentError, "the delta cannot be less than 0" if delta.negative? super(timeout: timeout, retry_strategy: retry_strategy, client_context: client_context, parent_span: parent_span) @delta = delta @initial = initial @expiry = expiry if durability_level != :none && (replicate_to != :none || persist_to != :none) raise ArgumentError, "durability_level conflicts with replicate_to and persist_to options" end @persist_to = persist_to @replicate_to = replicate_to @durability_level = durability_level yield self if block_given? end |
Instance Attribute Details
#delta ⇒ Integer
1335 1336 1337 |
# File 'lib/couchbase/options.rb', line 1335 def delta @delta end |
#durability_level ⇒ Symbol
1338 1339 1340 |
# File 'lib/couchbase/options.rb', line 1338 def durability_level @durability_level end |
#expiry ⇒ Integer, #in_seconds
1337 1338 1339 |
# File 'lib/couchbase/options.rb', line 1337 def expiry @expiry end |
#initial ⇒ Integer
1336 1337 1338 |
# File 'lib/couchbase/options.rb', line 1336 def initial @initial end |
Instance Method Details
#to_backend ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 |
# File 'lib/couchbase/options.rb', line 1411 def to_backend { timeout: Utils::Time.extract_duration(@timeout), delta: @delta, initial_value: @initial, expiry: Utils::Time.extract_expiry_time(@expiry), durability_level: @durability_level, persist_to: @persist_to, replicate_to: @replicate_to, } end |