Class: Couchbase::Options::Base

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

Overview

Base class for most of the options

Direct Known Subclasses

Management::Options::Analytics::ConnectLink, Management::Options::Analytics::CreateDataset, Management::Options::Analytics::CreateDataverse, Management::Options::Analytics::CreateIndex, Management::Options::Analytics::CreateLink, Management::Options::Analytics::DisconnectLink, Management::Options::Analytics::DropDataset, Management::Options::Analytics::DropDataverse, Management::Options::Analytics::DropIndex, Management::Options::Analytics::DropLink, Management::Options::Analytics::GetAllDatasets, Management::Options::Analytics::GetAllIndexes, Management::Options::Analytics::GetLinks, Management::Options::Analytics::GetPendingMutations, Management::Options::Analytics::ReplaceLink, Management::Options::Bucket::CreateBucket, Management::Options::Bucket::DropBucket, Management::Options::Bucket::FlushBucket, Management::Options::Bucket::GetAllBuckets, Management::Options::Bucket::GetBucket, Management::Options::Bucket::UpdateBucket, Management::Options::Collection::CreateCollection, Management::Options::Collection::CreateScope, Management::Options::Collection::DropCollection, Management::Options::Collection::DropScope, Management::Options::Collection::GetAllScopes, Management::Options::Collection::UpdateCollection, Management::Options::Query::BuildDeferredIndexes, Management::Options::Query::CreateIndex, Management::Options::Query::CreatePrimaryIndex, Management::Options::Query::DropIndex, Management::Options::Query::DropPrimaryIndex, Management::Options::Query::GetAllIndexes, Management::Options::Query::WatchIndexes, Analytics, Append, Decrement, Exists, Get, GetAllReplicas, GetAndLock, GetAndTouch, GetAnyReplica, GetMulti, Increment, Insert, LookupIn, LookupInAllReplicas, LookupInAnyReplica, MutateIn, Prepend, Query, Remove, RemoveMulti, Replace, Scan, Search, Touch, Unlock, Upsert, UpsertMulti, View

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(timeout: nil, retry_strategy: nil, client_context: nil, parent_span: nil) {|| ... } ⇒ Base

Returns a new instance of Base.

Parameters:

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

    the time in milliseconds allowed for the operation to complete

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



37
38
39
40
41
42
43
44
45
46
# File 'lib/couchbase/options.rb', line 37

def initialize(timeout: nil,
               retry_strategy: nil,
               client_context: nil,
               parent_span: nil)
  @timeout = timeout
  @retry_strategy = retry_strategy
  @client_context = client_context
  @parent_span = parent_span
  yield self if block_given?
end

Instance Attribute Details

#client_contextHash?

Returns:

  • (Hash, nil)


28
29
30
# File 'lib/couchbase/options.rb', line 28

def client_context
  @client_context
end

#parent_spanSpan?

Returns:

  • (Span, nil)


29
30
31
# File 'lib/couchbase/options.rb', line 29

def parent_span
  @parent_span
end

#retry_strategyProc?

Returns:

  • (Proc, nil)


27
28
29
# File 'lib/couchbase/options.rb', line 27

def retry_strategy
  @retry_strategy
end

#timeoutInteger, ...

Returns:

  • (Integer, #in_milliseconds, nil)


26
27
28
# File 'lib/couchbase/options.rb', line 26

def timeout
  @timeout
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.



49
50
51
52
53
# File 'lib/couchbase/options.rb', line 49

def to_backend
  {
    timeout: Utils::Time.extract_duration(@timeout),
  }
end