Class: Couchbase::Management::AnalyticsIndexManager

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

Defined Under Namespace

Classes: ConnectLinkOptions, CreateDatasetOptions, CreateDataverseOptions, CreateIndexOptions, DisconnectLinkOptions, DropDatasetOptions, DropDataverseOptions, DropIndexOptions, GetAllDatasetsOptions, GetAllIndexesOptions, GetPendingMutationsOptions

Instance Method Summary collapse

Constructor Details

#initialize(backend) ⇒ AnalyticsIndexManager

Returns a new instance of AnalyticsIndexManager.

Parameters:

  • backend (Couchbase::Backend)
[View source]

23
24
25
# File 'lib/couchbase/management/analytics_index_manager.rb', line 23

def initialize(backend)
  @backend = backend
end

Instance Method Details

This method returns an undefined value.

Connects a link

Parameters:

Raises:

[View source]

185
186
187
188
189
190
191
192
# File 'lib/couchbase/management/analytics_index_manager.rb', line 185

def connect_link(options = ConnectLinkOptions.new)
  @backend.analytics_link_connect(
      options.link_name,
      options.force,
      options.dataverse_name,
      options.timeout
  )
end

#create_dataset(dataset_name, bucket_name, options = CreateDatasetOptions.new) ⇒ void

This method returns an undefined value.

Creates a new dataset

Parameters:

  • dataset_name (String)

    name of dataset

  • bucket_name (String)

    name of the bucket

  • options (CreateDatasetOptions) (defaults to: CreateDatasetOptions.new)

Raises:

[View source]

72
73
74
75
76
77
78
79
80
81
# File 'lib/couchbase/management/analytics_index_manager.rb', line 72

def create_dataset(dataset_name, bucket_name, options = CreateDatasetOptions.new)
  @backend.analytics_dataset_create(
      dataset_name,
      bucket_name,
      options.condition,
      options.dataverse_name,
      options.ignore_if_exists,
      options.timeout
  )
end

#create_dataverse(dataverse_name, options = CreateDataverseOptions.new) ⇒ void

This method returns an undefined value.

Creates a new dataverse

Parameters:

Raises:

[View source]

36
37
38
39
40
41
42
# File 'lib/couchbase/management/analytics_index_manager.rb', line 36

def create_dataverse(dataverse_name, options = CreateDataverseOptions.new)
  @backend.analytics_dataverse_create(
      dataverse_name,
      options.ignore_if_exists,
      options.timeout
  )
end

#create_index(index_name, dataset_name, fields, options = CreateIndexOptions.new) ⇒ void

This method returns an undefined value.

Creates a new index

Parameters:

  • index_name (String)

    name of the index

  • dataset_name (String)

    name of the dataset

  • fields (Hash<String => String>)

    mapping of the field name to field type

  • options (CreateIndexOptions) (defaults to: CreateIndexOptions.new)

Raises:

[View source]

129
130
131
132
133
134
135
136
137
138
# File 'lib/couchbase/management/analytics_index_manager.rb', line 129

def create_index(index_name, dataset_name, fields, options = CreateIndexOptions.new)
  @backend.analytics_index_create(
      index_name,
      dataset_name,
      fields.entries,
      options.dataverse_name,
      options.ignore_if_exists,
      options.timeout
  )
end

This method returns an undefined value.

Disconnects a link,

Parameters:

Raises:

[View source]

202
203
204
205
206
207
208
# File 'lib/couchbase/management/analytics_index_manager.rb', line 202

def disconnect_link(options = DisconnectLinkOptions.new)
  @backend.analytics_link_disconnect(
      options.link_name,
      options.dataverse_name,
      options.timeout
  )
end

#drop_dataset(dataset_name, options = DropDatasetOptions.new) ⇒ void

This method returns an undefined value.

Drops a dataset

Parameters:

  • dataset_name (String)

    name of the dataset

  • options (DropDatasetOptions) (defaults to: DropDatasetOptions.new)

Raises:

[View source]

92
93
94
95
96
97
98
99
# File 'lib/couchbase/management/analytics_index_manager.rb', line 92

def drop_dataset(dataset_name, options = DropDatasetOptions.new)
  @backend.analytics_dataset_drop(
      dataset_name,
      options.dataverse_name,
      options.ignore_if_does_not_exist,
      options.timeout
  )
end

#drop_dataverse(dataverse_name, options = DropDataverseOptions.new) ⇒ void

This method returns an undefined value.

Drops a dataverse

Parameters:

  • dataverse_name (String)

    name of the dataverse

  • options (DropDataverseOptions) (defaults to: DropDataverseOptions.new)

Raises:

[View source]

53
54
55
56
57
58
59
# File 'lib/couchbase/management/analytics_index_manager.rb', line 53

def drop_dataverse(dataverse_name, options = DropDataverseOptions.new)
  @backend.analytics_dataverse_drop(
      dataverse_name,
      options.ignore_if_does_not_exist,
      options.timeout
  )
end

#drop_index(index_name, dataset_name, options = DropIndexOptions.new) ⇒ void

This method returns an undefined value.

Drops an index

Parameters:

  • index_name (String)

    name of the index

  • dataset_name (String)

    name of the dataset

  • options (DropIndexOptions) (defaults to: DropIndexOptions.new)

Raises:

[View source]

150
151
152
153
154
155
156
157
158
# File 'lib/couchbase/management/analytics_index_manager.rb', line 150

def drop_index(index_name, dataset_name, options = DropIndexOptions.new)
  @backend.analytics_index_drop(
      index_name,
      dataset_name,
      options.dataverse_name,
      options.ignore_if_does_not_exist,
      options.timeout
  )
end

#get_all_datasets(options = GetAllDatasetsOptions.new) ⇒ Array<AnalyticsDataset>

Gets all datasets

Parameters:

Returns:

[View source]

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

def get_all_datasets(options = GetAllDatasetsOptions.new)
  resp = @backend.analytics_dataset_get_all(options.timeout)
  resp.map do |entry|
    AnalyticsDataset.new do |dataset|
      dataset.name = entry[:name]
      dataset.dataverse_name = entry[:dataverse_name]
      dataset.link_name = entry[:link_name]
      dataset.bucket_name = entry[:bucket_name]
    end
  end
end

#get_all_indexes(options = GetAllIndexesOptions.new) ⇒ Array<AnalyticsIndex>

Gets all indexes

Parameters:

Returns:

[View source]

165
166
167
168
169
170
171
172
173
174
175
# File 'lib/couchbase/management/analytics_index_manager.rb', line 165

def get_all_indexes(options = GetAllIndexesOptions.new)
  resp = @backend.analytics_index_get_all(options.timeout)
  resp.map do |entry|
    AnalyticsIndex.new do |dataset|
      dataset.name = entry[:name]
      dataset.dataverse_name = entry[:dataverse_name]
      dataset.dataset_name = entry[:dataset_name]
      dataset.is_primary = entry[:is_primary]
    end
  end
end

#get_pending_mutations(options = GetPendingMutationsOptions.new) ⇒ Hash<String => Integer>

Note:

If a link is disconnected then it will return no results. If all links are disconnected, then

Gets the pending mutations for all datasets.

an empty object is returned.

Parameters:

Returns:

  • (Hash<String => Integer>)

    dictionary, where keys are dataset coordinates encoded as “dataverse.dataset” and values are number of mutations for given dataset.

[View source]

219
220
221
222
223
# File 'lib/couchbase/management/analytics_index_manager.rb', line 219

def get_pending_mutations(options = GetPendingMutationsOptions.new)
  @backend.analytics_get_pending_mutations(
      options.timeout
  )
end