Class: Couchbase::Options::Decrement

Inherits:
Base
  • Object
show all
Defined in:
lib/couchbase/options.rb

Overview

Instance Attribute Summary collapse

Attributes inherited from Base

#client_context, #parent_span, #retry_strategy, #timeout

Instance Method Summary collapse

Constructor Details

#initialize(delta: 1, initial: nil, expiry: nil, preserve_expiry: false, durability_level: :none, timeout: nil, retry_strategy: nil, client_context: nil, parent_span: nil) {|self| ... } ⇒ Decrement

Creates an instance of options for BinaryCollection#decrement

Parameters:

  • delta (Integer) (defaults to: 1)

    the delta for the operation

  • initial (Integer) (defaults to: nil)

    if present, holds the initial value

  • expiry (Integer, #in_seconds, Time, nil) (defaults to: nil)

    if set, holds the expiration for the operation

  • preserve_expiry (Boolean) (defaults to: false)

    if true and the document exists, the server will preserve current expiration for the document, otherwise will use #expiry from the operation.

  • durability_level (Symbol) (defaults to: :none)

    level of durability

    :none

    no enhanced durability required for the mutation

    :majority

    the mutation must be replicated to a majority of the Data Service nodes (that is, held in the memory allocated to the bucket)

    :majority_and_persist_to_active

    The mutation must be replicated to a majority of the Data Service nodes. Additionally, it must be persisted (that is, written and synchronised to disk) on the node hosting the active partition (vBucket) for the data.

    :persist_to_majority

    The mutation must be persisted to a majority of the Data Service nodes. Accordingly, it will be written to disk on those nodes.

  • timeout (Integer, #in_milliseconds, nil) (defaults to: nil)
  • retry_strategy (Proc, nil) (defaults to: nil)

    the custom retry strategy, if set

  • client_context (Hash, nil) (defaults to: nil)

    the client context data, if set

  • parent_span (Span, nil) (defaults to: nil)

    if set holds the parent span, that should be used for this request

Yield Parameters:

Raises:

  • (ArgumentError)


993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
# File 'lib/couchbase/options.rb', line 993

def initialize(delta: 1,
               initial: nil,
               expiry: nil,
               preserve_expiry: false,
               durability_level: :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 = Utils::Time.extract_expiry_time(expiry)
  @preserve_expiry = preserve_expiry
  @durability_level = durability_level
  yield self if block_given?
end

Instance Attribute Details

#deltaInteger

Returns:

  • (Integer)


960
961
962
# File 'lib/couchbase/options.rb', line 960

def delta
  @delta
end

#durability_levelSymbol

Returns:

  • (Symbol)


963
964
965
# File 'lib/couchbase/options.rb', line 963

def durability_level
  @durability_level
end

#expiryInteger, #in_seconds

Returns:

  • (Integer, #in_seconds)


962
963
964
# File 'lib/couchbase/options.rb', line 962

def expiry
  @expiry
end

#initialInteger

Returns:

  • (Integer)


961
962
963
# File 'lib/couchbase/options.rb', line 961

def initial
  @initial
end

#preserve_expiryBoolean

Returns:

  • (Boolean)


964
965
966
# File 'lib/couchbase/options.rb', line 964

def preserve_expiry
  @preserve_expiry
end