Class: Couchbase::Options::MutateIn

Inherits:
Base
  • Object
show all
Defined in:
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, store_semantics: :replace, cas: nil, access_deleted: false, create_as_deleted: false, durability_level: :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

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

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



710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
# File 'lib/couchbase/options.rb', line 710

def initialize(expiry: nil,
               store_semantics: :replace,
               cas: nil,
               access_deleted: false,
               create_as_deleted: false,
               durability_level: :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 = Utils::Time.extract_expiry_time(expiry)
  @store_semantics = store_semantics
  @cas = cas
  @access_deleted = access_deleted
  @create_as_deleted = create_as_deleted
  @durability_level = durability_level
  @transcoder = transcoder
  yield self if block_given?
end

Instance Attribute Details

#access_deletedBoolean

Returns:

  • (Boolean)


674
675
676
# File 'lib/couchbase/options.rb', line 674

def access_deleted
  @access_deleted
end

#casInteger?

Returns:

  • (Integer, nil)


673
674
675
# File 'lib/couchbase/options.rb', line 673

def cas
  @cas
end

#create_as_deletedBoolean

Returns:

  • (Boolean)


675
676
677
# File 'lib/couchbase/options.rb', line 675

def create_as_deleted
  @create_as_deleted
end

#durability_levelSymbol

Returns:

  • (Symbol)


676
677
678
# File 'lib/couchbase/options.rb', line 676

def durability_level
  @durability_level
end

#expiryInteger, ...

Returns:

  • (Integer, #in_seconds, nil)


671
672
673
# File 'lib/couchbase/options.rb', line 671

def expiry
  @expiry
end

#store_semanticsSymbol

Returns:

  • (Symbol)


672
673
674
# File 'lib/couchbase/options.rb', line 672

def store_semantics
  @store_semantics
end

#transcoderJsonTranscoder, #encode(Object)

Returns:



677
678
679
# File 'lib/couchbase/options.rb', line 677

def transcoder
  @transcoder
end