couchbase 3.9.0-aarch64-linux-musl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (149) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE.txt +202 -0
  3. data/README.md +154 -0
  4. data/ext/extconf.rb +0 -0
  5. data/lib/active_support/cache/couchbase_store.rb +407 -0
  6. data/lib/couchbase/3.2/libcouchbase.so +0 -0
  7. data/lib/couchbase/3.3/libcouchbase.so +0 -0
  8. data/lib/couchbase/3.4/libcouchbase.so +0 -0
  9. data/lib/couchbase/4.0/libcouchbase.so +0 -0
  10. data/lib/couchbase/analytics_options.rb +109 -0
  11. data/lib/couchbase/authenticator.rb +80 -0
  12. data/lib/couchbase/binary_collection.rb +145 -0
  13. data/lib/couchbase/binary_collection_options.rb +26 -0
  14. data/lib/couchbase/bucket.rb +173 -0
  15. data/lib/couchbase/cluster.rb +555 -0
  16. data/lib/couchbase/cluster_registry.rb +49 -0
  17. data/lib/couchbase/collection.rb +770 -0
  18. data/lib/couchbase/collection_options.rb +401 -0
  19. data/lib/couchbase/config_profiles.rb +57 -0
  20. data/lib/couchbase/configuration.rb +58 -0
  21. data/lib/couchbase/datastructures/couchbase_list.rb +192 -0
  22. data/lib/couchbase/datastructures/couchbase_map.rb +231 -0
  23. data/lib/couchbase/datastructures/couchbase_queue.rb +161 -0
  24. data/lib/couchbase/datastructures/couchbase_set.rb +145 -0
  25. data/lib/couchbase/datastructures.rb +26 -0
  26. data/lib/couchbase/deprecations.rb +61 -0
  27. data/lib/couchbase/diagnostics.rb +183 -0
  28. data/lib/couchbase/errors.rb +438 -0
  29. data/lib/couchbase/fork_hooks.rb +41 -0
  30. data/lib/couchbase/get_replica_strategy.rb +89 -0
  31. data/lib/couchbase/json_transcoder.rb +41 -0
  32. data/lib/couchbase/key_value_scan.rb +119 -0
  33. data/lib/couchbase/libcouchbase.rb +6 -0
  34. data/lib/couchbase/logger.rb +87 -0
  35. data/lib/couchbase/management/analytics_index_manager.rb +1160 -0
  36. data/lib/couchbase/management/bucket_manager.rb +479 -0
  37. data/lib/couchbase/management/collection_manager.rb +515 -0
  38. data/lib/couchbase/management/collection_query_index_manager.rb +247 -0
  39. data/lib/couchbase/management/query_index_manager.rb +671 -0
  40. data/lib/couchbase/management/scope_search_index_manager.rb +267 -0
  41. data/lib/couchbase/management/search_index_manager.rb +649 -0
  42. data/lib/couchbase/management/user_manager.rb +639 -0
  43. data/lib/couchbase/management/view_index_manager.rb +332 -0
  44. data/lib/couchbase/management.rb +31 -0
  45. data/lib/couchbase/metrics/logging_meter.rb +108 -0
  46. data/lib/couchbase/metrics/logging_value_recorder.rb +50 -0
  47. data/lib/couchbase/metrics/meter.rb +27 -0
  48. data/lib/couchbase/metrics/noop_meter.rb +30 -0
  49. data/lib/couchbase/metrics/noop_value_recorder.rb +27 -0
  50. data/lib/couchbase/metrics/value_recorder.rb +25 -0
  51. data/lib/couchbase/mutation_state.rb +65 -0
  52. data/lib/couchbase/options.rb +3097 -0
  53. data/lib/couchbase/protostellar/binary_collection.rb +55 -0
  54. data/lib/couchbase/protostellar/bucket.rb +59 -0
  55. data/lib/couchbase/protostellar/client.rb +97 -0
  56. data/lib/couchbase/protostellar/cluster.rb +182 -0
  57. data/lib/couchbase/protostellar/collection.rb +156 -0
  58. data/lib/couchbase/protostellar/connect_options.rb +63 -0
  59. data/lib/couchbase/protostellar/error_handling.rb +204 -0
  60. data/lib/couchbase/protostellar/generated/admin/analytics/v1/analytics_pb.rb +54 -0
  61. data/lib/couchbase/protostellar/generated/admin/analytics/v1/analytics_services_pb.rb +51 -0
  62. data/lib/couchbase/protostellar/generated/admin/bucket/v1/bucket_pb.rb +42 -0
  63. data/lib/couchbase/protostellar/generated/admin/bucket/v1/bucket_services_pb.rb +51 -0
  64. data/lib/couchbase/protostellar/generated/admin/collection/v1/collection_pb.rb +38 -0
  65. data/lib/couchbase/protostellar/generated/admin/collection/v1/collection_services_pb.rb +52 -0
  66. data/lib/couchbase/protostellar/generated/admin/query/v1/query_pb.rb +42 -0
  67. data/lib/couchbase/protostellar/generated/admin/query/v1/query_services_pb.rb +55 -0
  68. data/lib/couchbase/protostellar/generated/admin/search/v1/search_pb.rb +51 -0
  69. data/lib/couchbase/protostellar/generated/admin/search/v1/search_services_pb.rb +67 -0
  70. data/lib/couchbase/protostellar/generated/analytics/v1/analytics_pb.rb +31 -0
  71. data/lib/couchbase/protostellar/generated/analytics/v1/analytics_services_pb.rb +40 -0
  72. data/lib/couchbase/protostellar/generated/internal/hooks/v1/hooks_pb.rb +51 -0
  73. data/lib/couchbase/protostellar/generated/internal/hooks/v1/hooks_services_pb.rb +54 -0
  74. data/lib/couchbase/protostellar/generated/internal/xdcr/v1/xdcr_pb.rb +46 -0
  75. data/lib/couchbase/protostellar/generated/internal/xdcr/v1/xdcr_services_pb.rb +56 -0
  76. data/lib/couchbase/protostellar/generated/kv/v1/kv_pb.rb +74 -0
  77. data/lib/couchbase/protostellar/generated/kv/v1/kv_services_pb.rb +93 -0
  78. data/lib/couchbase/protostellar/generated/query/v1/query_pb.rb +35 -0
  79. data/lib/couchbase/protostellar/generated/query/v1/query_services_pb.rb +40 -0
  80. data/lib/couchbase/protostellar/generated/routing/v2/routing_pb.rb +26 -0
  81. data/lib/couchbase/protostellar/generated/routing/v2/routing_services_pb.rb +43 -0
  82. data/lib/couchbase/protostellar/generated/search/v1/search_pb.rb +78 -0
  83. data/lib/couchbase/protostellar/generated/search/v1/search_services_pb.rb +41 -0
  84. data/lib/couchbase/protostellar/generated/transactions/v1/transactions_pb.rb +36 -0
  85. data/lib/couchbase/protostellar/generated/transactions/v1/transactions_services_pb.rb +66 -0
  86. data/lib/couchbase/protostellar/generated/view/v1/view_pb.rb +30 -0
  87. data/lib/couchbase/protostellar/generated/view/v1/view_services_pb.rb +39 -0
  88. data/lib/couchbase/protostellar/generated.rb +9 -0
  89. data/lib/couchbase/protostellar/management/bucket_manager.rb +67 -0
  90. data/lib/couchbase/protostellar/management/collection_manager.rb +94 -0
  91. data/lib/couchbase/protostellar/management/collection_query_index_manager.rb +124 -0
  92. data/lib/couchbase/protostellar/management/query_index_manager.rb +112 -0
  93. data/lib/couchbase/protostellar/management.rb +24 -0
  94. data/lib/couchbase/protostellar/request.rb +79 -0
  95. data/lib/couchbase/protostellar/request_behaviour.rb +42 -0
  96. data/lib/couchbase/protostellar/request_generator/admin/bucket.rb +124 -0
  97. data/lib/couchbase/protostellar/request_generator/admin/collection.rb +96 -0
  98. data/lib/couchbase/protostellar/request_generator/admin/query.rb +132 -0
  99. data/lib/couchbase/protostellar/request_generator/admin.rb +24 -0
  100. data/lib/couchbase/protostellar/request_generator/kv.rb +488 -0
  101. data/lib/couchbase/protostellar/request_generator/query.rb +133 -0
  102. data/lib/couchbase/protostellar/request_generator/search.rb +403 -0
  103. data/lib/couchbase/protostellar/request_generator.rb +26 -0
  104. data/lib/couchbase/protostellar/response_converter/admin/bucket.rb +55 -0
  105. data/lib/couchbase/protostellar/response_converter/admin/collection.rb +42 -0
  106. data/lib/couchbase/protostellar/response_converter/admin/query.rb +59 -0
  107. data/lib/couchbase/protostellar/response_converter/admin.rb +24 -0
  108. data/lib/couchbase/protostellar/response_converter/kv.rb +151 -0
  109. data/lib/couchbase/protostellar/response_converter/query.rb +84 -0
  110. data/lib/couchbase/protostellar/response_converter/search.rb +136 -0
  111. data/lib/couchbase/protostellar/response_converter.rb +26 -0
  112. data/lib/couchbase/protostellar/retry/action.rb +38 -0
  113. data/lib/couchbase/protostellar/retry/orchestrator.rb +61 -0
  114. data/lib/couchbase/protostellar/retry/reason.rb +67 -0
  115. data/lib/couchbase/protostellar/retry/strategies/best_effort.rb +49 -0
  116. data/lib/couchbase/protostellar/retry/strategies/fail_fast.rb +33 -0
  117. data/lib/couchbase/protostellar/retry/strategies.rb +27 -0
  118. data/lib/couchbase/protostellar/retry.rb +28 -0
  119. data/lib/couchbase/protostellar/scope.rb +61 -0
  120. data/lib/couchbase/protostellar/timeout_defaults.rb +30 -0
  121. data/lib/couchbase/protostellar/timeouts.rb +83 -0
  122. data/lib/couchbase/protostellar.rb +29 -0
  123. data/lib/couchbase/query_options.rb +122 -0
  124. data/lib/couchbase/railtie.rb +47 -0
  125. data/lib/couchbase/raw_binary_transcoder.rb +39 -0
  126. data/lib/couchbase/raw_json_transcoder.rb +40 -0
  127. data/lib/couchbase/raw_string_transcoder.rb +42 -0
  128. data/lib/couchbase/scope.rb +272 -0
  129. data/lib/couchbase/search_options.rb +1744 -0
  130. data/lib/couchbase/subdoc.rb +293 -0
  131. data/lib/couchbase/tracing/noop_span.rb +29 -0
  132. data/lib/couchbase/tracing/noop_tracer.rb +29 -0
  133. data/lib/couchbase/tracing/request_span.rb +34 -0
  134. data/lib/couchbase/tracing/request_tracer.rb +28 -0
  135. data/lib/couchbase/tracing/threshold_logging_span.rb +112 -0
  136. data/lib/couchbase/tracing/threshold_logging_tracer.rb +231 -0
  137. data/lib/couchbase/transcoder_flags.rb +64 -0
  138. data/lib/couchbase/utils/generic_logger_adapter.rb +40 -0
  139. data/lib/couchbase/utils/hdr_histogram.rb +55 -0
  140. data/lib/couchbase/utils/observability.rb +263 -0
  141. data/lib/couchbase/utils/observability_constants.rb +200 -0
  142. data/lib/couchbase/utils/stdlib_logger_adapter.rb +65 -0
  143. data/lib/couchbase/utils/time.rb +71 -0
  144. data/lib/couchbase/utils.rb +23 -0
  145. data/lib/couchbase/version.rb +25 -0
  146. data/lib/couchbase/view_options.rb +67 -0
  147. data/lib/couchbase.rb +32 -0
  148. data/lib/rails/generators/couchbase/config/config_generator.rb +29 -0
  149. metadata +228 -0
@@ -0,0 +1,267 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2024. Couchbase, Inc.
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ require_relative "search_index_manager"
18
+
19
+ module Couchbase
20
+ module Management
21
+ class ScopeSearchIndexManager
22
+ alias inspect to_s
23
+
24
+ # @param [Couchbase::Backend] backend
25
+ # @param [String] bucket_name
26
+ # @param [String] scope_name
27
+ # @param [Couchbase::Observability::Wrapper] observability wrapper
28
+ def initialize(backend, bucket_name, scope_name, observability)
29
+ @backend = backend
30
+ @bucket_name = bucket_name
31
+ @scope_name = scope_name
32
+ @observability = observability
33
+ end
34
+
35
+ # Fetches an index from the server if it exists
36
+ #
37
+ # @param [String] index_name name of the index
38
+ # @param [Options::Search::GetIndex] options
39
+ #
40
+ # @return [SearchIndex]
41
+ #
42
+ # @raise [ArgumentError]
43
+ # @raise [Error::IndexNotFound]
44
+ def get_index(index_name, options = Options::Search::GetIndex::DEFAULT)
45
+ @observability.record_operation(Observability::OP_SM_GET_INDEX, options.parent_span, self, :search) do |obs_handler|
46
+ res = @backend.search_index_get(@bucket_name, @scope_name, index_name, options.timeout, obs_handler)
47
+ SearchIndexManager.extract_search_index(res)
48
+ end
49
+ end
50
+
51
+ # Fetches all indexes from the server
52
+ #
53
+ # @param [Options::Search::GetAllIndexes] options
54
+ #
55
+ # @return [Array<SearchIndex>]
56
+ def get_all_indexes(options = Options::Search::GetAllIndexes::DEFAULT)
57
+ @observability.record_operation(Observability::OP_SM_GET_ALL_INDEXES, options.parent_span, self, :search) do |obs_handler|
58
+ res = @backend.search_index_get_all(@bucket_name, @scope_name, options.timeout, obs_handler)
59
+ res[:indexes].map { |idx| SearchIndexManager.extract_search_index(idx) }
60
+ end
61
+ end
62
+
63
+ # Creates or updates the index
64
+ #
65
+ # @param [SearchIndex] index_definition the index definition
66
+ # @param [Options::Search::UpsertIndex] options
67
+ #
68
+ # @return void
69
+ #
70
+ # @raise [ArgumentError] if name, type or source_type is empty
71
+ def upsert_index(index_definition, options = Options::Search::UpsertIndex::DEFAULT)
72
+ @observability.record_operation(Observability::OP_SM_UPSERT_INDEX, options.parent_span, self, :search) do |obs_handler|
73
+ @backend.search_index_upsert(@bucket_name, @scope_name, index_definition.to_backend, options.timeout, obs_handler)
74
+ end
75
+ end
76
+
77
+ # Drops the index
78
+ #
79
+ # @param [String] index_name name of the index
80
+ # @param [Options::Search::DropIndex] options
81
+ #
82
+ # @return void
83
+ #
84
+ # @raise [ArgumentError]
85
+ # @raise [Error::IndexNotFound]
86
+ def drop_index(index_name, options = Options::Search::DropIndex::DEFAULT)
87
+ @observability.record_operation(Observability::OP_SM_DROP_INDEX, options.parent_span, self, :search) do |obs_handler|
88
+ @backend.search_index_drop(@bucket_name, @scope_name, index_name, options.timeout, obs_handler)
89
+ end
90
+ end
91
+
92
+ # Retrieves the number of documents that have been indexed for an index
93
+ #
94
+ # @param [String] index_name name of the index
95
+ # @param [Options::Search::GetIndexedDocumentsCount] options
96
+ #
97
+ # @return [Integer]
98
+ #
99
+ # @raise [ArgumentError]
100
+ # @raise [Error::IndexNotFound]
101
+ def get_indexed_documents_count(index_name, options = Options::Search::GetIndexedDocumentsCount::DEFAULT)
102
+ @observability.record_operation(Observability::OP_SM_GET_INDEXED_DOCUMENTS_COUNT, options.parent_span, self,
103
+ :search) do |obs_handler|
104
+ res = @backend.search_index_get_documents_count(@bucket_name, @scope_name, index_name, options.timeout, obs_handler)
105
+ res[:count]
106
+ end
107
+ end
108
+
109
+ # Pauses updates and maintenance for the index
110
+ #
111
+ # @param [String] index_name name of the index
112
+ # @param [Options::Search::PauseIngest] options
113
+ #
114
+ # @return void
115
+ #
116
+ # @raise [ArgumentError]
117
+ # @raise [Error::IndexNotFound]
118
+ def pause_ingest(index_name, options = Options::Search::PauseIngest::DEFAULT)
119
+ @observability.record_operation(Observability::OP_SM_PAUSE_INGEST, options.parent_span, self, :search) do |obs_handler|
120
+ @backend.search_index_pause_ingest(@bucket_name, @scope_name, index_name, options.timeout, obs_handler)
121
+ end
122
+ end
123
+
124
+ # Resumes updates and maintenance for an index
125
+ #
126
+ # @param [String] index_name name of the index
127
+ # @param [Options::Search::ResumeIngest] options
128
+ #
129
+ # @return void
130
+ #
131
+ # @raise [ArgumentError]
132
+ # @raise [Error::IndexNotFound]
133
+ def resume_ingest(index_name, options = Options::Search::ResumeIngest::DEFAULT)
134
+ @observability.record_operation(Observability::OP_SM_RESUME_INGEST, options.parent_span, self, :search) do |obs_handler|
135
+ @backend.search_index_resume_ingest(@bucket_name, @scope_name, index_name, options.timeout, obs_handler)
136
+ end
137
+ end
138
+
139
+ # Allows querying against the index
140
+ #
141
+ # @param [String] index_name name of the index
142
+ # @param [Options::Search::AllowQuerying] options
143
+ #
144
+ # @return void
145
+ #
146
+ # @raise [ArgumentError]
147
+ # @raise [Error::IndexNotFound]
148
+ def allow_querying(index_name, options = Options::Search::AllowQuerying::DEFAULT)
149
+ @observability.record_operation(Observability::OP_SM_ALLOW_QUERYING, options.parent_span, self, :search) do |obs_handler|
150
+ @backend.search_index_allow_querying(@bucket_name, @scope_name, index_name, options.timeout, obs_handler)
151
+ end
152
+ end
153
+
154
+ # Disallows querying against the index
155
+ #
156
+ # @param [String] index_name name of the index
157
+ # @param [Options::Search::DisallowQuerying] options
158
+ #
159
+ # @return void
160
+ #
161
+ # @raise [ArgumentError]
162
+ # @raise [Error::IndexNotFound]
163
+ def disallow_querying(index_name, options = Options::Search::DisallowQuerying::DEFAULT)
164
+ @observability.record_operation(Observability::OP_SM_DISALLOW_QUERYING, options.parent_span, self, :search) do |obs_handler|
165
+ @backend.search_index_disallow_querying(@bucket_name, @scope_name, index_name, options.timeout, obs_handler)
166
+ end
167
+ end
168
+
169
+ # Freeze the assignment of index partitions to nodes
170
+ #
171
+ # @param [String] index_name name of the index
172
+ # @param [Options::Search::FreezePlan] options
173
+ #
174
+ # @return void
175
+ #
176
+ # @raise [ArgumentError]
177
+ # @raise [Error::IndexNotFound]
178
+ def freeze_plan(index_name, options = Options::Search::FreezePlan::DEFAULT)
179
+ @observability.record_operation(Observability::OP_SM_FREEZE_PLAN, options.parent_span, self, :search) do |obs_handler|
180
+ @backend.search_index_freeze_plan(@bucket_name, @scope_name, index_name, options.timeout, obs_handler)
181
+ end
182
+ end
183
+
184
+ # Unfreeze the assignment of index partitions to nodes
185
+ #
186
+ # @param [String] index_name name of the index
187
+ # @param [Options::Search::UnfreezePlan] options
188
+ #
189
+ # @return void
190
+ #
191
+ # @raise [ArgumentError]
192
+ # @raise [Error::IndexNotFound]
193
+ def unfreeze_plan(index_name, options = Options::Search::UnfreezePlan::DEFAULT)
194
+ @observability.record_operation(Observability::OP_SM_UNFREEZE_PLAN, options.parent_span, self, :search) do |obs_handler|
195
+ @backend.search_index_unfreeze_plan(@bucket_name, @scope_name, index_name, options.timeout, obs_handler)
196
+ end
197
+ end
198
+
199
+ # Allows to see how a document is analyzed against a specific index
200
+ #
201
+ # @param [String] index_name name of the index
202
+ # @param [Hash] document the document to be analyzed
203
+ # @param [Options::Search::AnalyzeDocument] options
204
+ #
205
+ # @return [Array<Hash>]
206
+ #
207
+ # @raise [ArgumentError]
208
+ # @raise [Error::IndexNotFound]
209
+ def analyze_document(index_name, document, options = Options::Search::AnalyzeDocument::DEFAULT)
210
+ @observability.record_operation(Observability::OP_SM_ANALYZE_DOCUMENT, options.parent_span, self, :search) do |obs_handler|
211
+ res = @backend.search_index_analyze_document(
212
+ @bucket_name, @scope_name, index_name, JSON.generate(document), options.timeout, obs_handler
213
+ )
214
+ JSON.parse(res[:analysis])
215
+ end
216
+ end
217
+
218
+ # @api private
219
+ # @deprecated use {Options::Search::GetIndex} instead
220
+ GetIndexOptions = Options::Search::GetIndex
221
+
222
+ # @api private
223
+ # @deprecated use {Options::Search::GetAllIndexes} instead
224
+ GetAllIndexesOptions = Options::Search::GetAllIndexes
225
+
226
+ # @api private
227
+ # @deprecated use {Options::Search::UpsertIndex} instead
228
+ UpsertIndexOptions = Options::Search::UpsertIndex
229
+
230
+ # @api private
231
+ # @deprecated use {Options::Search::DropIndex} instead
232
+ DropIndexOptions = Options::Search::DropIndex
233
+
234
+ # @api private
235
+ # @deprecated use {Options::Search::GetIndexedDocumentsCount} instead
236
+ GetIndexedDocumentsCountOptions = Options::Search::GetIndexedDocumentsCount
237
+
238
+ # @api private
239
+ # @deprecated use {Options::Search::PauseIngest} instead
240
+ PauseIngestOptions = Options::Search::PauseIngest
241
+
242
+ # @api private
243
+ # @deprecated use {Options::Search::ResumeIngest} instead
244
+ ResumeIngestOptions = Options::Search::ResumeIngest
245
+
246
+ # @api private
247
+ # @deprecated use {Options::Search::AllowQuerying} instead
248
+ AllowQueryingOptions = Options::Search::AllowQuerying
249
+
250
+ # @api private
251
+ # @deprecated use {Options::Search::DisallowQuerying} instead
252
+ DisallowQueryingOptions = Options::Search::DisallowQuerying
253
+
254
+ # @api private
255
+ # @deprecated use {Options::Search::FreezePlan} instead
256
+ FreezePlanOptions = Options::Search::FreezePlan
257
+
258
+ # @api private
259
+ # @deprecated use {Options::Search::UnfreezePlan} instead
260
+ UnfreezePlanOptions = Options::Search::UnfreezePlan
261
+
262
+ # @api private
263
+ # @deprecated use {Options::Search::AnalyzeDocument} instead
264
+ AnalyzeDocumentOptions = Options::Search::AnalyzeDocument
265
+ end
266
+ end
267
+ end