Class: Couchbase::Management::Options::Query::CreateIndex

Inherits:
Options::Base
  • Object
show all
Defined in:
lib/couchbase/management/query_index_manager.rb

Overview

Instance Attribute Summary collapse

Attributes inherited from Options::Base

#client_context, #parent_span, #retry_strategy, #timeout

Instance Method Summary collapse

Constructor Details

#initialize(ignore_if_exists: false, num_replicas: nil, deferred: false, condition: nil, scope_name: nil, collection_name: nil, timeout: nil, retry_strategy: nil, client_context: nil, parent_span: nil) {|self| ... } ⇒ CreateIndex

Creates an instance of options for QueryIndexManager#create_index

Parameters:

  • ignore_if_exists (Boolean) (defaults to: false)

    do not raise error if the index already exist

  • num_replicas (Integer) (defaults to: nil)

    the number of replicas that this index should have

  • deferred (Boolean) (defaults to: false)

    whether the index should be created as a deferred index.

  • condition (String, nil) (defaults to: nil)

    to apply to the index

  • scope_name (String, nil) (defaults to: nil)

    the name of the scope

  • collection_name (String, nil) (defaults to: nil)

    the name of the collection

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



85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
# File 'lib/couchbase/management/query_index_manager.rb', line 85

def initialize(ignore_if_exists: false,
               num_replicas: nil,
               deferred: false,
               condition: nil,
               scope_name: nil,
               collection_name: 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)
  @ignore_if_exists = ignore_if_exists
  @num_replicas = num_replicas
  @deferred = deferred
  @condition = condition
  @scope_name = scope_name
  @collection_name = collection_name
  yield self if block_given?
end

Instance Attribute Details

#collection_nameString?

Returns:

  • (String, nil)


68
69
70
# File 'lib/couchbase/management/query_index_manager.rb', line 68

def collection_name
  @collection_name
end

#conditionString?

Returns:

  • (String, nil)


66
67
68
# File 'lib/couchbase/management/query_index_manager.rb', line 66

def condition
  @condition
end

#deferredBoolean

Returns:

  • (Boolean)


65
66
67
# File 'lib/couchbase/management/query_index_manager.rb', line 65

def deferred
  @deferred
end

#ignore_if_existsBoolean

Returns:

  • (Boolean)


63
64
65
# File 'lib/couchbase/management/query_index_manager.rb', line 63

def ignore_if_exists
  @ignore_if_exists
end

#num_replicasInteger?

Returns:

  • (Integer, nil)


64
65
66
# File 'lib/couchbase/management/query_index_manager.rb', line 64

def num_replicas
  @num_replicas
end

#scope_nameString?

Returns:

  • (String, nil)


67
68
69
# File 'lib/couchbase/management/query_index_manager.rb', line 67

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



106
107
108
109
110
111
112
113
114
115
116
# File 'lib/couchbase/management/query_index_manager.rb', line 106

def to_backend
  {
    timeout: Utils::Time.extract_duration(@timeout),
    ignore_if_exists: @ignore_if_exists,
    condition: @condition,
    deferred: @deferred,
    num_replicas: @num_replicas,
    scope_name: @scope_name,
    collection_name: @collection_name,
  }
end