Class: Couchbase::Options::Scan

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

Overview

Options for Collection#scan

Constant Summary collapse

DEFAULT =
Scan.new.freeze

Instance Attribute Summary collapse

Attributes inherited from Base

#client_context, #parent_span, #retry_strategy, #timeout

Instance Method Summary collapse

Constructor Details

#initialize(ids_only: false, transcoder: JsonTranscoder.new, mutation_state: nil, batch_byte_limit: nil, batch_item_limit: nil, concurrency: nil, timeout: nil, retry_strategy: nil, client_context: nil, parent_span: nil) {|self| ... } ⇒ Scan

Creates an instance of options for Collection#scan

Parameters:

  • ids_only (Boolean) (defaults to: false)

    if set to true, the content of the documents is not included in the results

  • transcoder (JsonTranscoder, #decode(String)) (defaults to: JsonTranscoder.new)

    used for decoding

  • mutation_state (MutationState, nil) (defaults to: nil)

    sets the mutation tokens this scan should be consistent with

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

    allows to limit the maximum amount of bytes that are sent from the server to the client on each partition batch, defaults to 15,000

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

    allows to limit the maximum amount of items that are sent from the server to the client on each partition batch, defaults to 50

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

    specifies the maximum number of partitions that can be scanned concurrently, defaults to 1

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



1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
# File 'lib/couchbase/options.rb', line 1133

def initialize(ids_only: false,
               transcoder: JsonTranscoder.new,
               mutation_state: nil,
               batch_byte_limit: nil,
               batch_item_limit: nil,
               concurrency: nil,
               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)
  @ids_only = ids_only
  @transcoder = transcoder
  @mutation_state = mutation_state
  @batch_byte_limit = batch_byte_limit
  @batch_item_limit = batch_item_limit
  @concurrency = concurrency
  yield self if block_given?
end

Instance Attribute Details

#batch_byte_limitInteger?

Returns:

  • (Integer, nil)


1111
1112
1113
# File 'lib/couchbase/options.rb', line 1111

def batch_byte_limit
  @batch_byte_limit
end

#batch_item_limitInteger?

Returns:

  • (Integer, nil)


1112
1113
1114
# File 'lib/couchbase/options.rb', line 1112

def batch_item_limit
  @batch_item_limit
end

#concurrencyInteger?

Returns:

  • (Integer, nil)


1113
1114
1115
# File 'lib/couchbase/options.rb', line 1113

def concurrency
  @concurrency
end

#ids_onlyBoolean

Returns:

  • (Boolean)


1108
1109
1110
# File 'lib/couchbase/options.rb', line 1108

def ids_only
  @ids_only
end

#mutation_stateMutationState?

Returns:



1110
1111
1112
# File 'lib/couchbase/options.rb', line 1110

def mutation_state
  @mutation_state
end

#transcoderJsonTranscoder, #decode(String)

Returns:



1109
1110
1111
# File 'lib/couchbase/options.rb', line 1109

def transcoder
  @transcoder
end

Instance Method Details

#consistent_with(mutation_state) ⇒ Object

Note:

overrides consistency level set by #scan_consistency=

Sets the mutation tokens this query should be consistent with

Parameters:

  • mutation_state (MutationState)

    the mutation state containing the mutation tokens



1158
1159
1160
# File 'lib/couchbase/options.rb', line 1158

def consistent_with(mutation_state)
  @mutation_state = mutation_state
end