Class: Couchbase::Options::MutateIn

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

Overview

Options for Collection#mutate_in

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.

MutateIn.new.freeze

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

Yield Parameters:



927
928
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
# File 'lib/couchbase/options.rb', line 927

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

#access_deletedBoolean

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.



977
978
979
# File 'lib/couchbase/options.rb', line 977

def access_deleted
  @access_deleted
end

#casInteger?



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

def cas
  @cas
end

#create_as_deletedBoolean

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.



981
982
983
# File 'lib/couchbase/options.rb', line 981

def create_as_deleted
  @create_as_deleted
end

#durability_levelSymbol



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

def durability_level
  @durability_level
end

#expiryInteger, ...



875
876
877
# File 'lib/couchbase/options.rb', line 875

def expiry
  @expiry
end

#preserve_expiryBoolean



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

def preserve_expiry
  @preserve_expiry
end

#store_semanticsSymbol



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

def store_semantics
  @store_semantics
end

#transcoderJsonTranscoder, #encode(Object)



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

def transcoder
  @transcoder
end

Instance Method Details

#to_backendObject

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.



960
961
962
963
964
965
966
967
968
969
970
971
972
973
# File 'lib/couchbase/options.rb', line 960

def to_backend
  {
    timeout: Utils::Time.extract_duration(@timeout),
    expiry: Utils::Time.extract_expiry_time(@expiry),
    preserve_expiry: @preserve_expiry,
    durability_level: @durability_level,
    persist_to: @persist_to,
    replicate_to: @replicate_to,
    cas: @cas,
    store_semantics: @store_semantics,
    access_deleted: @access_deleted,
    create_as_deleted: @create_as_deleted,
  }
end