Class: Couchbase::Options::MutateIn

Inherits:
Base
  • Object
show all
Defined in:
lib/couchbase/options.rb,
/code/couchbase-ruby-client/lib/couchbase/options.rb

Overview

Options for Collection#mutate_in

Instance Attribute Summary collapse

Attributes inherited from Base

#client_context, #parent_span, #retry_strategy, #timeout

Instance Method Summary collapse

Constructor Details

#initialize(expiry: nil, preserve_expiry: false, store_semantics: :replace, cas: nil, access_deleted: false, create_as_deleted: false, durability_level: :none, replicate_to: :none, persist_to: :none, transcoder: JsonTranscoder.new, timeout: nil, retry_strategy: nil, client_context: nil, parent_span: nil) {|| ... } ⇒ MutateIn

Creates an instance of options for Collection#mutate_in

Parameters:

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

    expiration time to associate with the document

  • 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.

  • store_semantics (Symbol) (defaults to: :replace)

    describes how the outer document store semantics on subdoc should act

    :replace

    replace the document, fail if it does not exist. This is the default

    :upsert

    replace the document or create if it does not exist

    :insert

    create the document, fail if it exists

  • cas (Integer, nil) (defaults to: nil)

    a CAS value that will be taken into account on the server side for optimistic concurrency

  • access_deleted (Boolean) (defaults to: false)

    for internal use only: allows access to deleted documents that are in “tombstone” form

  • create_as_deleted (Boolean) (defaults to: false)

    for internal use only: allows creating documents in “tombstone” form

  • 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.

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

    number of nodes to replicate

    :none

    do not apply any replication requirements.

    :one

    wait for replication to at least one node.

    :two

    wait for replication to at least two nodes.

    :three

    wait for replication to at least three nodes.

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

    number of nodes to persist

    :none

    do not apply any persistence requirements.

    :active

    wait for persistence to active node

    :one

    wait for persistence to at least one node.

    :two

    wait for persistence to at least two nodes.

    :three

    wait for persistence to at least three nodes.

    :four

    wait for persistence to four nodes (active and replicas).

  • transcoder (JsonTranscoder, #encode(Object)) (defaults to: JsonTranscoder.new)

    used for encoding

  • 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:



929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
# File 'lib/couchbase/options.rb', line 929

def initialize(expiry: nil,
               preserve_expiry: false,
               store_semantics: :replace,
               cas: nil,
               access_deleted: false,
               create_as_deleted: false,
               durability_level: :none,
               replicate_to: :none,
               persist_to: :none,
               transcoder: JsonTranscoder.new,
               timeout: nil,
               retry_strategy: nil,
               client_context: nil,
               parent_span: nil)
  super(timeout: timeout, retry_strategy: retry_strategy, client_context: client_context, parent_span: parent_span)
  @expiry = expiry
  @preserve_expiry = preserve_expiry
  @store_semantics = store_semantics
  @cas = cas
  @access_deleted = access_deleted
  @create_as_deleted = create_as_deleted
  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
  @transcoder = transcoder
  yield self if block_given?
end

Instance Attribute Details

#casInteger?

Returns:

  • (Integer, nil)


879
880
881
# File 'lib/couchbase/options.rb', line 879

def cas
  @cas
end

#durability_levelSymbol

Returns:

  • (Symbol)


880
881
882
# File 'lib/couchbase/options.rb', line 880

def durability_level
  @durability_level
end

#expiryInteger, ...

Returns:

  • (Integer, #in_seconds, nil)


877
878
879
# File 'lib/couchbase/options.rb', line 877

def expiry
  @expiry
end

#preserve_expiryBoolean

Returns:

  • (Boolean)


882
883
884
# File 'lib/couchbase/options.rb', line 882

def preserve_expiry
  @preserve_expiry
end

#store_semanticsSymbol

Returns:

  • (Symbol)


878
879
880
# File 'lib/couchbase/options.rb', line 878

def store_semantics
  @store_semantics
end

#transcoderJsonTranscoder, #encode(Object)

Returns:



881
882
883
# File 'lib/couchbase/options.rb', line 881

def transcoder
  @transcoder
end