Class: Couchbase::Options::Replace
- Defined in:
- lib/couchbase/options.rb
Overview
Options for Collection#replace
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.
Replace.new.freeze
Instance Attribute Summary collapse
- #cas ⇒ Integer?
- #durability_level ⇒ Symbol
- #expiry ⇒ Integer, ...
- #preserve_expiry ⇒ Boolean
- #transcoder ⇒ JsonTranscoder, #encode(Object)
Attributes inherited from Base
#client_context, #parent_span, #retry_strategy, #timeout
Instance Method Summary collapse
-
#initialize(expiry: nil, preserve_expiry: false, transcoder: JsonTranscoder.new, cas: nil, durability_level: :none, replicate_to: :none, persist_to: :none, timeout: nil, retry_strategy: nil, client_context: nil, parent_span: nil) {|| ... } ⇒ Replace
constructor
Creates an instance of options for Collection#replace.
- #to_backend ⇒ Object
Constructor Details
#initialize(expiry: nil, preserve_expiry: false, transcoder: JsonTranscoder.new, cas: nil, durability_level: :none, replicate_to: :none, persist_to: :none, timeout: nil, retry_strategy: nil, client_context: nil, parent_span: nil) {|| ... } ⇒ Replace
Creates an instance of options for Collection#replace
833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 |
# File 'lib/couchbase/options.rb', line 833 def initialize(expiry: nil, preserve_expiry: false, transcoder: JsonTranscoder.new, cas: nil, durability_level: :none, replicate_to: :none, persist_to: :none, 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 @transcoder = transcoder @cas = cas 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
#cas ⇒ Integer?
790 791 792 |
# File 'lib/couchbase/options.rb', line 790 def cas @cas end |
#durability_level ⇒ Symbol
791 792 793 |
# File 'lib/couchbase/options.rb', line 791 def durability_level @durability_level end |
#expiry ⇒ Integer, ...
788 789 790 |
# File 'lib/couchbase/options.rb', line 788 def expiry @expiry end |
#preserve_expiry ⇒ Boolean
792 793 794 |
# File 'lib/couchbase/options.rb', line 792 def preserve_expiry @preserve_expiry end |
#transcoder ⇒ JsonTranscoder, #encode(Object)
789 790 791 |
# File 'lib/couchbase/options.rb', line 789 def transcoder @transcoder end |
Instance Method Details
#to_backend ⇒ Object
859 860 861 862 863 864 865 866 867 868 869 |
# File 'lib/couchbase/options.rb', line 859 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, } end |