couchbase 3.9.0-aarch64-mingw-ucrt
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.
- checksums.yaml +7 -0
- data/LICENSE.txt +202 -0
- data/README.md +154 -0
- data/ext/extconf.rb +0 -0
- data/lib/active_support/cache/couchbase_store.rb +407 -0
- data/lib/couchbase/3.4/libcouchbase.so +0 -0
- data/lib/couchbase/4.0/libcouchbase.so +0 -0
- data/lib/couchbase/analytics_options.rb +109 -0
- data/lib/couchbase/authenticator.rb +80 -0
- data/lib/couchbase/binary_collection.rb +145 -0
- data/lib/couchbase/binary_collection_options.rb +26 -0
- data/lib/couchbase/bucket.rb +173 -0
- data/lib/couchbase/cluster.rb +555 -0
- data/lib/couchbase/cluster_registry.rb +49 -0
- data/lib/couchbase/collection.rb +770 -0
- data/lib/couchbase/collection_options.rb +401 -0
- data/lib/couchbase/config_profiles.rb +57 -0
- data/lib/couchbase/configuration.rb +58 -0
- data/lib/couchbase/datastructures/couchbase_list.rb +192 -0
- data/lib/couchbase/datastructures/couchbase_map.rb +231 -0
- data/lib/couchbase/datastructures/couchbase_queue.rb +161 -0
- data/lib/couchbase/datastructures/couchbase_set.rb +145 -0
- data/lib/couchbase/datastructures.rb +26 -0
- data/lib/couchbase/deprecations.rb +61 -0
- data/lib/couchbase/diagnostics.rb +183 -0
- data/lib/couchbase/errors.rb +438 -0
- data/lib/couchbase/fork_hooks.rb +41 -0
- data/lib/couchbase/get_replica_strategy.rb +89 -0
- data/lib/couchbase/json_transcoder.rb +41 -0
- data/lib/couchbase/key_value_scan.rb +119 -0
- data/lib/couchbase/libcouchbase.rb +6 -0
- data/lib/couchbase/logger.rb +87 -0
- data/lib/couchbase/management/analytics_index_manager.rb +1160 -0
- data/lib/couchbase/management/bucket_manager.rb +479 -0
- data/lib/couchbase/management/collection_manager.rb +515 -0
- data/lib/couchbase/management/collection_query_index_manager.rb +247 -0
- data/lib/couchbase/management/query_index_manager.rb +671 -0
- data/lib/couchbase/management/scope_search_index_manager.rb +267 -0
- data/lib/couchbase/management/search_index_manager.rb +649 -0
- data/lib/couchbase/management/user_manager.rb +639 -0
- data/lib/couchbase/management/view_index_manager.rb +332 -0
- data/lib/couchbase/management.rb +31 -0
- data/lib/couchbase/metrics/logging_meter.rb +108 -0
- data/lib/couchbase/metrics/logging_value_recorder.rb +50 -0
- data/lib/couchbase/metrics/meter.rb +27 -0
- data/lib/couchbase/metrics/noop_meter.rb +30 -0
- data/lib/couchbase/metrics/noop_value_recorder.rb +27 -0
- data/lib/couchbase/metrics/value_recorder.rb +25 -0
- data/lib/couchbase/mutation_state.rb +65 -0
- data/lib/couchbase/options.rb +3097 -0
- data/lib/couchbase/protostellar/binary_collection.rb +55 -0
- data/lib/couchbase/protostellar/bucket.rb +59 -0
- data/lib/couchbase/protostellar/client.rb +97 -0
- data/lib/couchbase/protostellar/cluster.rb +182 -0
- data/lib/couchbase/protostellar/collection.rb +156 -0
- data/lib/couchbase/protostellar/connect_options.rb +63 -0
- data/lib/couchbase/protostellar/error_handling.rb +204 -0
- data/lib/couchbase/protostellar/generated/admin/analytics/v1/analytics_pb.rb +54 -0
- data/lib/couchbase/protostellar/generated/admin/analytics/v1/analytics_services_pb.rb +51 -0
- data/lib/couchbase/protostellar/generated/admin/bucket/v1/bucket_pb.rb +42 -0
- data/lib/couchbase/protostellar/generated/admin/bucket/v1/bucket_services_pb.rb +51 -0
- data/lib/couchbase/protostellar/generated/admin/collection/v1/collection_pb.rb +38 -0
- data/lib/couchbase/protostellar/generated/admin/collection/v1/collection_services_pb.rb +52 -0
- data/lib/couchbase/protostellar/generated/admin/query/v1/query_pb.rb +42 -0
- data/lib/couchbase/protostellar/generated/admin/query/v1/query_services_pb.rb +55 -0
- data/lib/couchbase/protostellar/generated/admin/search/v1/search_pb.rb +51 -0
- data/lib/couchbase/protostellar/generated/admin/search/v1/search_services_pb.rb +67 -0
- data/lib/couchbase/protostellar/generated/analytics/v1/analytics_pb.rb +31 -0
- data/lib/couchbase/protostellar/generated/analytics/v1/analytics_services_pb.rb +40 -0
- data/lib/couchbase/protostellar/generated/internal/hooks/v1/hooks_pb.rb +51 -0
- data/lib/couchbase/protostellar/generated/internal/hooks/v1/hooks_services_pb.rb +54 -0
- data/lib/couchbase/protostellar/generated/internal/xdcr/v1/xdcr_pb.rb +46 -0
- data/lib/couchbase/protostellar/generated/internal/xdcr/v1/xdcr_services_pb.rb +56 -0
- data/lib/couchbase/protostellar/generated/kv/v1/kv_pb.rb +74 -0
- data/lib/couchbase/protostellar/generated/kv/v1/kv_services_pb.rb +93 -0
- data/lib/couchbase/protostellar/generated/query/v1/query_pb.rb +35 -0
- data/lib/couchbase/protostellar/generated/query/v1/query_services_pb.rb +40 -0
- data/lib/couchbase/protostellar/generated/routing/v2/routing_pb.rb +26 -0
- data/lib/couchbase/protostellar/generated/routing/v2/routing_services_pb.rb +43 -0
- data/lib/couchbase/protostellar/generated/search/v1/search_pb.rb +78 -0
- data/lib/couchbase/protostellar/generated/search/v1/search_services_pb.rb +41 -0
- data/lib/couchbase/protostellar/generated/transactions/v1/transactions_pb.rb +36 -0
- data/lib/couchbase/protostellar/generated/transactions/v1/transactions_services_pb.rb +66 -0
- data/lib/couchbase/protostellar/generated/view/v1/view_pb.rb +30 -0
- data/lib/couchbase/protostellar/generated/view/v1/view_services_pb.rb +39 -0
- data/lib/couchbase/protostellar/generated.rb +9 -0
- data/lib/couchbase/protostellar/management/bucket_manager.rb +67 -0
- data/lib/couchbase/protostellar/management/collection_manager.rb +94 -0
- data/lib/couchbase/protostellar/management/collection_query_index_manager.rb +124 -0
- data/lib/couchbase/protostellar/management/query_index_manager.rb +112 -0
- data/lib/couchbase/protostellar/management.rb +24 -0
- data/lib/couchbase/protostellar/request.rb +79 -0
- data/lib/couchbase/protostellar/request_behaviour.rb +42 -0
- data/lib/couchbase/protostellar/request_generator/admin/bucket.rb +124 -0
- data/lib/couchbase/protostellar/request_generator/admin/collection.rb +96 -0
- data/lib/couchbase/protostellar/request_generator/admin/query.rb +132 -0
- data/lib/couchbase/protostellar/request_generator/admin.rb +24 -0
- data/lib/couchbase/protostellar/request_generator/kv.rb +488 -0
- data/lib/couchbase/protostellar/request_generator/query.rb +133 -0
- data/lib/couchbase/protostellar/request_generator/search.rb +403 -0
- data/lib/couchbase/protostellar/request_generator.rb +26 -0
- data/lib/couchbase/protostellar/response_converter/admin/bucket.rb +55 -0
- data/lib/couchbase/protostellar/response_converter/admin/collection.rb +42 -0
- data/lib/couchbase/protostellar/response_converter/admin/query.rb +59 -0
- data/lib/couchbase/protostellar/response_converter/admin.rb +24 -0
- data/lib/couchbase/protostellar/response_converter/kv.rb +151 -0
- data/lib/couchbase/protostellar/response_converter/query.rb +84 -0
- data/lib/couchbase/protostellar/response_converter/search.rb +136 -0
- data/lib/couchbase/protostellar/response_converter.rb +26 -0
- data/lib/couchbase/protostellar/retry/action.rb +38 -0
- data/lib/couchbase/protostellar/retry/orchestrator.rb +61 -0
- data/lib/couchbase/protostellar/retry/reason.rb +67 -0
- data/lib/couchbase/protostellar/retry/strategies/best_effort.rb +49 -0
- data/lib/couchbase/protostellar/retry/strategies/fail_fast.rb +33 -0
- data/lib/couchbase/protostellar/retry/strategies.rb +27 -0
- data/lib/couchbase/protostellar/retry.rb +28 -0
- data/lib/couchbase/protostellar/scope.rb +61 -0
- data/lib/couchbase/protostellar/timeout_defaults.rb +30 -0
- data/lib/couchbase/protostellar/timeouts.rb +83 -0
- data/lib/couchbase/protostellar.rb +29 -0
- data/lib/couchbase/query_options.rb +122 -0
- data/lib/couchbase/railtie.rb +47 -0
- data/lib/couchbase/raw_binary_transcoder.rb +39 -0
- data/lib/couchbase/raw_json_transcoder.rb +40 -0
- data/lib/couchbase/raw_string_transcoder.rb +42 -0
- data/lib/couchbase/scope.rb +272 -0
- data/lib/couchbase/search_options.rb +1744 -0
- data/lib/couchbase/subdoc.rb +293 -0
- data/lib/couchbase/tracing/noop_span.rb +29 -0
- data/lib/couchbase/tracing/noop_tracer.rb +29 -0
- data/lib/couchbase/tracing/request_span.rb +34 -0
- data/lib/couchbase/tracing/request_tracer.rb +28 -0
- data/lib/couchbase/tracing/threshold_logging_span.rb +112 -0
- data/lib/couchbase/tracing/threshold_logging_tracer.rb +231 -0
- data/lib/couchbase/transcoder_flags.rb +64 -0
- data/lib/couchbase/utils/generic_logger_adapter.rb +40 -0
- data/lib/couchbase/utils/hdr_histogram.rb +55 -0
- data/lib/couchbase/utils/observability.rb +263 -0
- data/lib/couchbase/utils/observability_constants.rb +200 -0
- data/lib/couchbase/utils/stdlib_logger_adapter.rb +65 -0
- data/lib/couchbase/utils/time.rb +71 -0
- data/lib/couchbase/utils.rb +23 -0
- data/lib/couchbase/version.rb +25 -0
- data/lib/couchbase/view_options.rb +67 -0
- data/lib/couchbase.rb +32 -0
- data/lib/rails/generators/couchbase/config/config_generator.rb +29 -0
- metadata +209 -0
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Copyright 2025-Present 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
|
+
module Couchbase
|
|
18
|
+
module Observability # rubocop:disable Metrics/ModuleLength
|
|
19
|
+
OP_GET = "get"
|
|
20
|
+
OP_GET_MULTI = "get_multi"
|
|
21
|
+
OP_GET_AND_LOCK = "get_and_lock"
|
|
22
|
+
OP_GET_AND_TOUCH = "get_and_touch"
|
|
23
|
+
OP_GET_ALL_REPLICAS = "get_all_replicas"
|
|
24
|
+
OP_GET_ANY_REPLICA = "get_any_replica"
|
|
25
|
+
OP_GET_REPLICA = "get_replica"
|
|
26
|
+
OP_EXISTS = "exists"
|
|
27
|
+
OP_REPLACE = "replace"
|
|
28
|
+
OP_UPSERT = "upsert"
|
|
29
|
+
OP_UPSERT_MULTI = "upsert_multi"
|
|
30
|
+
OP_REMOVE = "remove"
|
|
31
|
+
OP_REMOVE_MULTI = "remove_multi"
|
|
32
|
+
OP_INSERT = "insert"
|
|
33
|
+
OP_TOUCH = "touch"
|
|
34
|
+
OP_UNLOCK = "unlock"
|
|
35
|
+
OP_LOOKUP_IN = "lookup_in"
|
|
36
|
+
OP_LOOKUP_IN_ALL_REPLICAS = "lookup_in_all_replicas"
|
|
37
|
+
OP_LOOKUP_IN_ANY_REPLICA = "lookup_in_any_replica"
|
|
38
|
+
OP_LOOKUP_IN_REPLICA = "lookup_in_replica"
|
|
39
|
+
OP_MUTATE_IN = "mutate_in"
|
|
40
|
+
OP_SCAN = "scan"
|
|
41
|
+
OP_INCREMENT = "increment"
|
|
42
|
+
OP_DECREMENT = "decrement"
|
|
43
|
+
OP_APPEND = "append"
|
|
44
|
+
OP_PREPEND = "prepend"
|
|
45
|
+
|
|
46
|
+
OP_QUERY = "query"
|
|
47
|
+
OP_SEARCH_QUERY = "search"
|
|
48
|
+
OP_ANALYTICS_QUERY = "analytics"
|
|
49
|
+
OP_VIEW_QUERY = "views"
|
|
50
|
+
|
|
51
|
+
OP_PING = "ping"
|
|
52
|
+
OP_DIAGNOSTICS = "diagnostics"
|
|
53
|
+
|
|
54
|
+
OP_BM_CREATE_BUCKET = "manager_buckets_create_bucket"
|
|
55
|
+
OP_BM_DROP_BUCKET = "manager_buckets_drop_bucket"
|
|
56
|
+
OP_BM_FLUSH_BUCKET = "manager_buckets_flush_bucket"
|
|
57
|
+
OP_BM_GET_ALL_BUCKETS = "manager_buckets_get_all_buckets"
|
|
58
|
+
OP_BM_GET_BUCKET = "manager_buckets_get_bucket"
|
|
59
|
+
OP_BM_UPDATE_BUCKET = "manager_buckets_update_bucket"
|
|
60
|
+
|
|
61
|
+
OP_CM_CREATE_COLLECTION = "manager_collections_create_collection"
|
|
62
|
+
OP_CM_UPDATE_COLLECTION = "manager_collections_update_collection"
|
|
63
|
+
OP_CM_DROP_COLLECTION = "manager_collections_drop_collection"
|
|
64
|
+
OP_CM_CREATE_SCOPE = "manager_collections_create_scope"
|
|
65
|
+
OP_CM_DROP_SCOPE = "manager_collections_drop_scope"
|
|
66
|
+
OP_CM_GET_ALL_SCOPES = "manager_collections_get_all_scopes"
|
|
67
|
+
OP_CM_GET_SCOPE = "manager_collections_get_scope"
|
|
68
|
+
|
|
69
|
+
OP_QM_BUILD_DEFERRED_INDEXES = "manager_query_build_deferred_indexes"
|
|
70
|
+
OP_QM_CREATE_INDEX = "manager_query_create_index"
|
|
71
|
+
OP_QM_CREATE_PRIMARY_INDEX = "manager_query_create_primary_index"
|
|
72
|
+
OP_QM_DROP_INDEX = "manager_query_drop_index"
|
|
73
|
+
OP_QM_DROP_PRIMARY_INDEX = "manager_query_drop_primary_index"
|
|
74
|
+
OP_QM_GET_ALL_INDEXES = "manager_query_get_all_indexes"
|
|
75
|
+
OP_QM_WATCH_INDEXES = "manager_query_watch_indexes"
|
|
76
|
+
|
|
77
|
+
OP_AM_CREATE_DATAVERSE = "manager_analytics_create_dataverse"
|
|
78
|
+
OP_AM_DROP_DATAVERSE = "manager_analytics_drop_dataverse"
|
|
79
|
+
OP_AM_CREATE_DATASET = "manager_analytics_create_dataset"
|
|
80
|
+
OP_AM_DROP_DATASET = "manager_analytics_drop_dataset"
|
|
81
|
+
OP_AM_GET_ALL_DATASETS = "manager_analytics_get_all_datasets"
|
|
82
|
+
OP_AM_CREATE_INDEX = "manager_analytics_create_index"
|
|
83
|
+
OP_AM_DROP_INDEX = "manager_analytics_drop_index"
|
|
84
|
+
OP_AM_GET_ALL_INDEXES = "manager_analytics_get_all_indexes"
|
|
85
|
+
OP_AM_CONNECT_LINK = "manager_analytics_connect_link"
|
|
86
|
+
OP_AM_DISCONNECT_LINK = "manager_analytics_disconnect_link"
|
|
87
|
+
OP_AM_GET_PENDING_MUTATIONS = "manager_analytics_get_pending_mutations"
|
|
88
|
+
OP_AM_CREATE_LINK = "manager_analytics_create_link"
|
|
89
|
+
OP_AM_REPLACE_LINK = "manager_analytics_replace_link"
|
|
90
|
+
OP_AM_DROP_LINK = "manager_analytics_drop_link"
|
|
91
|
+
OP_AM_GET_LINKS = "manager_analytics_get_links"
|
|
92
|
+
|
|
93
|
+
OP_SM_GET_INDEX = "manager_search_get_index"
|
|
94
|
+
OP_SM_GET_ALL_INDEXES = "manager_search_get_all_indexes"
|
|
95
|
+
OP_SM_UPSERT_INDEX = "manager_search_upsert_index"
|
|
96
|
+
OP_SM_DROP_INDEX = "manager_search_drop_index"
|
|
97
|
+
OP_SM_GET_INDEXED_DOCUMENTS_COUNT = "manager_search_get_indexed_documents_count"
|
|
98
|
+
OP_SM_GET_INDEX_STATS = "manager_search_get_index_stats"
|
|
99
|
+
OP_SM_GET_STATS = "manager_search_get_stats"
|
|
100
|
+
OP_SM_PAUSE_INGEST = "manager_search_pause_index"
|
|
101
|
+
OP_SM_RESUME_INGEST = "manager_search_resume_index"
|
|
102
|
+
OP_SM_ALLOW_QUERYING = "manager_search_allow_querying"
|
|
103
|
+
OP_SM_DISALLOW_QUERYING = "manager_search_disallow_querying"
|
|
104
|
+
OP_SM_FREEZE_PLAN = "manager_search_freeze_plan"
|
|
105
|
+
OP_SM_UNFREEZE_PLAN = "manager_search_unfreeze_plan"
|
|
106
|
+
OP_SM_ANALYZE_DOCUMENT = "manager_search_analyze_document"
|
|
107
|
+
|
|
108
|
+
OP_UM_DROP_GROUP = "manager_users_drop_group"
|
|
109
|
+
OP_UM_DROP_USER = "manager_users_drop_user"
|
|
110
|
+
OP_UM_GET_ALL_GROUPS = "manager_users_get_all_groups"
|
|
111
|
+
OP_UM_GET_ALL_USERS = "manager_users_get_all_users"
|
|
112
|
+
OP_UM_GET_GROUP = "manager_users_get_group"
|
|
113
|
+
OP_UM_GET_ROLES = "manager_users_get_roles"
|
|
114
|
+
OP_UM_GET_USER = "manager_users_get_user"
|
|
115
|
+
OP_UM_UPSERT_GROUP = "manager_users_upsert_group"
|
|
116
|
+
OP_UM_UPSERT_USER = "manager_users_upsert_user"
|
|
117
|
+
OP_UM_CHANGE_PASSWORD = "manager_users_change_password"
|
|
118
|
+
|
|
119
|
+
OP_VM_GET_DESIGN_DOCUMENT = "manager_views_get_design_document"
|
|
120
|
+
OP_VM_GET_ALL_DESIGN_DOCUMENTS = "manager_views_get_all_design_documents"
|
|
121
|
+
OP_VM_UPSERT_DESIGN_DOCUMENT = "manager_views_upsert_design_document"
|
|
122
|
+
OP_VM_DROP_DESIGN_DOCUMENT = "manager_views_drop_design_document"
|
|
123
|
+
OP_VM_PUBLISH_DESIGN_DOCUMENT = "manager_views_publish_design_document"
|
|
124
|
+
|
|
125
|
+
OP_LIST_EACH = "list_each"
|
|
126
|
+
OP_LIST_LENGTH = "list_length"
|
|
127
|
+
OP_LIST_PUSH = "list_push"
|
|
128
|
+
OP_LIST_UNSHIFT = "list_unshift"
|
|
129
|
+
OP_LIST_INSERT = "list_insert"
|
|
130
|
+
OP_LIST_AT = "list_at"
|
|
131
|
+
OP_LIST_DELETE_AT = "list_delete_at"
|
|
132
|
+
OP_LIST_CLEAR = "list_clear"
|
|
133
|
+
|
|
134
|
+
OP_MAP_EACH = "map_each"
|
|
135
|
+
OP_MAP_LENGTH = "map_length"
|
|
136
|
+
OP_MAP_CLEAR = "map_clear"
|
|
137
|
+
OP_MAP_FETCH = "map_fetch"
|
|
138
|
+
OP_MAP_DELETE = "map_delete"
|
|
139
|
+
OP_MAP_KEY_EXISTS = "map_key"
|
|
140
|
+
OP_MAP_STORE = "map_store"
|
|
141
|
+
|
|
142
|
+
OP_QUEUE_EACH = "queue_each"
|
|
143
|
+
OP_QUEUE_LENGTH = "queue_length"
|
|
144
|
+
OP_QUEUE_CLEAR = "queue_clear"
|
|
145
|
+
OP_QUEUE_PUSH = "queue_push"
|
|
146
|
+
OP_QUEUE_POP = "queue_pop"
|
|
147
|
+
|
|
148
|
+
OP_SET_EACH = "set_each"
|
|
149
|
+
OP_SET_LENGTH = "set_length"
|
|
150
|
+
OP_SET_ADD = "set_add"
|
|
151
|
+
OP_SET_CLEAR = "set_clear"
|
|
152
|
+
OP_SET_DELETE = "set_delete"
|
|
153
|
+
|
|
154
|
+
STEP_REQUEST_ENCODING = "request_encoding"
|
|
155
|
+
STEP_DISPATCH_TO_SERVER = "dispatch_to_server"
|
|
156
|
+
|
|
157
|
+
# Common attributes
|
|
158
|
+
ATTR_SYSTEM_NAME = "db.system.name"
|
|
159
|
+
ATTR_CLUSTER_NAME = "couchbase.cluster.name"
|
|
160
|
+
ATTR_CLUSTER_UUID = "couchbase.cluster.uuid"
|
|
161
|
+
|
|
162
|
+
# Operation-level attributes
|
|
163
|
+
ATTR_OPERATION_NAME = "db.operation.name"
|
|
164
|
+
ATTR_SERVICE = "couchbase.service"
|
|
165
|
+
ATTR_BUCKET_NAME = "db.namespace"
|
|
166
|
+
ATTR_SCOPE_NAME = "couchbase.scope.name"
|
|
167
|
+
ATTR_COLLECTION_NAME = "couchbase.collection.name"
|
|
168
|
+
ATTR_RETRIES = "couchbase.retries"
|
|
169
|
+
ATTR_DURABILITY = "couchbase.durability"
|
|
170
|
+
ATTR_QUERY_STATEMENT = "db.query.text"
|
|
171
|
+
ATTR_ERROR_TYPE = "error.type"
|
|
172
|
+
|
|
173
|
+
# Dispatch-level attributes
|
|
174
|
+
ATTR_LOCAL_ID = "couchbase.local_id"
|
|
175
|
+
ATTR_OPERATION_ID = "couchbase.operation_id"
|
|
176
|
+
ATTR_PEER_ADDRESS = "network.peer.address"
|
|
177
|
+
ATTR_PEER_PORT = "network.peer.port"
|
|
178
|
+
ATTR_SERVER_DURATION = "couchbase.server_duration"
|
|
179
|
+
|
|
180
|
+
# Reserved attributes
|
|
181
|
+
ATTR_RESERVED_UNIT = "__unit"
|
|
182
|
+
|
|
183
|
+
ATTR_VALUE_SYSTEM_NAME = "couchbase"
|
|
184
|
+
|
|
185
|
+
ATTR_VALUE_DURABILITY_MAJORITY = "majority"
|
|
186
|
+
ATTR_VALUE_DURABILITY_MAJORITY_AND_PERSIST_TO_ACTIVE = "majority_and_persist_active"
|
|
187
|
+
ATTR_VALUE_DURABILITY_PERSIST_TO_MAJORITY = "persist_majority"
|
|
188
|
+
|
|
189
|
+
ATTR_VALUE_SERVICE_KV = "kv"
|
|
190
|
+
ATTR_VALUE_SERVICE_QUERY = "query"
|
|
191
|
+
ATTR_VALUE_SERVICE_SEARCH = "search"
|
|
192
|
+
ATTR_VALUE_SERVICE_VIEWS = "views"
|
|
193
|
+
ATTR_VALUE_SERVICE_ANALYTICS = "analytics"
|
|
194
|
+
ATTR_VALUE_SERVICE_MANAGEMENT = "management"
|
|
195
|
+
|
|
196
|
+
ATTR_VALUE_RESERVED_UNIT_SECONDS = "s"
|
|
197
|
+
|
|
198
|
+
METER_NAME_OPERATION_DURATION = "db.client.operation.duration"
|
|
199
|
+
end
|
|
200
|
+
end
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Copyright 2021 Couchbase, Inc.
|
|
4
|
+
# Copyright 2020-Present Couchbase, Inc.
|
|
5
|
+
#
|
|
6
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
# you may not use this file except in compliance with the License.
|
|
8
|
+
# You may obtain a copy of the License at
|
|
9
|
+
#
|
|
10
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
#
|
|
12
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
+
# See the License for the specific language governing permissions and
|
|
16
|
+
# limitations under the License.
|
|
17
|
+
|
|
18
|
+
require "logger"
|
|
19
|
+
require "time"
|
|
20
|
+
|
|
21
|
+
module Couchbase
|
|
22
|
+
module Utils
|
|
23
|
+
class StdlibLoggerAdapter
|
|
24
|
+
def initialize(logger, verbose: false)
|
|
25
|
+
raise ArgumentError, "logger argument must be or derive from stdlib Logger class" unless logger.is_a?(::Logger)
|
|
26
|
+
|
|
27
|
+
@logger = logger
|
|
28
|
+
@verbose = verbose
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def log(level, thread_id, seconds, nanoseconds, payload, filename, line, function)
|
|
32
|
+
logdev = @logger.instance_variable_get(:@logdev)
|
|
33
|
+
return unless logdev
|
|
34
|
+
|
|
35
|
+
severity = map_spdlog_level(level)
|
|
36
|
+
return unless severity
|
|
37
|
+
|
|
38
|
+
progname = "cxxcbc##{thread_id}"
|
|
39
|
+
payload += " at #{filename}:#{line} #{function}" if @verbose && filename
|
|
40
|
+
logdev.write(
|
|
41
|
+
@logger.send(:format_message, @logger.send(:format_severity, severity), ::Time.at(seconds, nanoseconds, :nanosecond), progname,
|
|
42
|
+
payload),
|
|
43
|
+
)
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def self.map_spdlog_level(level)
|
|
47
|
+
case level
|
|
48
|
+
when :trace, :debug
|
|
49
|
+
::Logger::Severity::DEBUG
|
|
50
|
+
when :info
|
|
51
|
+
::Logger::Severity::INFO
|
|
52
|
+
when :warn
|
|
53
|
+
::Logger::Severity::WARN
|
|
54
|
+
when :error
|
|
55
|
+
::Logger::Severity::ERROR
|
|
56
|
+
when :critical
|
|
57
|
+
::Logger::Severity::FATAL
|
|
58
|
+
else # rubocop:disable Style/EmptyElse
|
|
59
|
+
# covers :off
|
|
60
|
+
nil
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
end
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Copyright 2020-2021 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 "time"
|
|
18
|
+
|
|
19
|
+
module Couchbase
|
|
20
|
+
module Utils
|
|
21
|
+
# Various Time utilities
|
|
22
|
+
module Time
|
|
23
|
+
RELATIVE_EXPIRY_CUTOFF_SECONDS = 30 * 24 * 60 * 60
|
|
24
|
+
WORKAROUND_EXPIRY_CUTOFF_SECONDS = 50 * 365 * 24 * 60 * 60
|
|
25
|
+
|
|
26
|
+
module_function
|
|
27
|
+
|
|
28
|
+
# @param [Integer, #in_seconds, Time, nil] time_or_duration expiration time to associate with the document
|
|
29
|
+
def extract_expiry_time(time_or_duration)
|
|
30
|
+
if time_or_duration.respond_to?(:in_seconds) # Duration
|
|
31
|
+
[:duration, time_or_duration.in_seconds]
|
|
32
|
+
elsif time_or_duration.respond_to?(:tv_sec) # Time
|
|
33
|
+
[:time_point, time_or_duration.tv_sec]
|
|
34
|
+
elsif time_or_duration.is_a?(Integer)
|
|
35
|
+
if time_or_duration < RELATIVE_EXPIRY_CUTOFF_SECONDS
|
|
36
|
+
# looks like valid relative duration as specified in protocol (less than 30 days)
|
|
37
|
+
[:duration, time_or_duration]
|
|
38
|
+
elsif time_or_duration > WORKAROUND_EXPIRY_CUTOFF_SECONDS
|
|
39
|
+
effective_expiry = ::Time.at(time_or_duration).utc
|
|
40
|
+
warn "The specified expiry duration #{time_or_duration} is longer than 50 years. For bug-compatibility " \
|
|
41
|
+
"with previous versions of SDK 3.0.x, the number of seconds in the duration will be interpreted as " \
|
|
42
|
+
"the epoch second when the document should expire (#{effective_expiry}). Stuffing an epoch second " \
|
|
43
|
+
"into a Duration is deprecated and will no longer work in SDK 3.1. Consider using Time instance instead."
|
|
44
|
+
[:time_point, time_or_duration]
|
|
45
|
+
else
|
|
46
|
+
[:time_point, ::Time.now.tv_sec + time_or_duration]
|
|
47
|
+
end
|
|
48
|
+
else
|
|
49
|
+
[:duration, time_or_duration]
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
# This method converts its argument to milliseconds
|
|
54
|
+
#
|
|
55
|
+
# 1. Integer values are interpreted as a number of milliseconds
|
|
56
|
+
# 2. If the argument is a Duration-like object and responds to #in_milliseconds,
|
|
57
|
+
# then use it and convert result to Integer
|
|
58
|
+
# 3. Otherwise invoke #to_i on the argument and interpret it as a number of milliseconds
|
|
59
|
+
def extract_duration(number_or_duration)
|
|
60
|
+
return unless number_or_duration
|
|
61
|
+
return number_or_duration if number_or_duration.class == Integer # rubocop:disable Style/ClassEqualityComparison -- avoid overrides of #is_a?, #kind_of?
|
|
62
|
+
|
|
63
|
+
if number_or_duration.respond_to?(:in_milliseconds)
|
|
64
|
+
number_or_duration.in_milliseconds
|
|
65
|
+
else
|
|
66
|
+
number_or_duration
|
|
67
|
+
end.to_i
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
end
|
|
71
|
+
end
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Copyright 2020-2021 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
|
+
module Couchbase
|
|
18
|
+
# Module for internal tools, extensions and utilities
|
|
19
|
+
module Utils
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
require "couchbase/utils/time"
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Copyright 2020-2021 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
|
+
module Couchbase
|
|
18
|
+
# Version of the library and all bundled dependencies
|
|
19
|
+
#
|
|
20
|
+
# @example Display version (+Couchbase::BUILD_INFO+ contains more details)
|
|
21
|
+
# $ ruby -rcouchbase -e 'pp Couchbase::VERSION'
|
|
22
|
+
# {:sdk=>"3.4.0", :ruby_abi=>"3.1.0", :revision=>"416fe68e6029ec8a4c40611cf6e6b30d3b90d20f"}
|
|
23
|
+
VERSION = {} unless defined?(VERSION) # rubocop:disable Style/MutableConstant
|
|
24
|
+
VERSION.update(:sdk => "3.9.0")
|
|
25
|
+
end
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Copyright 2020-2021 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 "json"
|
|
18
|
+
|
|
19
|
+
module Couchbase
|
|
20
|
+
class Bucket
|
|
21
|
+
class ViewRow
|
|
22
|
+
# @return [String]
|
|
23
|
+
attr_accessor :id
|
|
24
|
+
|
|
25
|
+
# @return [#to_json]
|
|
26
|
+
attr_accessor :key
|
|
27
|
+
|
|
28
|
+
# @return [#to_json]
|
|
29
|
+
attr_accessor :value
|
|
30
|
+
|
|
31
|
+
# @yieldparam [ViewRow] self
|
|
32
|
+
def initialize
|
|
33
|
+
yield self if block_given?
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
class ViewMetaData
|
|
38
|
+
# @return [Integer]
|
|
39
|
+
attr_accessor :total_rows
|
|
40
|
+
|
|
41
|
+
# @api private
|
|
42
|
+
attr_writer :debug_info
|
|
43
|
+
|
|
44
|
+
def debug
|
|
45
|
+
JSON.parse(@debug_info)
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
# @yieldparam [ViewMetaData] self
|
|
49
|
+
def initialize
|
|
50
|
+
yield self if block_given?
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
class ViewResult
|
|
55
|
+
# @return [ViewMetaData] returns object representing additional metadata associated with this query
|
|
56
|
+
attr_accessor :meta_data
|
|
57
|
+
|
|
58
|
+
# @return [Array<ViewRow>]
|
|
59
|
+
attr_accessor :rows
|
|
60
|
+
|
|
61
|
+
# @yieldparam [ViewResult] self
|
|
62
|
+
def initialize
|
|
63
|
+
yield self if block_given?
|
|
64
|
+
end
|
|
65
|
+
end
|
|
66
|
+
end
|
|
67
|
+
end
|
data/lib/couchbase.rb
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Copyright 2020-2021 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 "couchbase/version"
|
|
18
|
+
require "couchbase/libcouchbase"
|
|
19
|
+
require "couchbase/fork_hooks"
|
|
20
|
+
require "couchbase/logger"
|
|
21
|
+
require "couchbase/cluster"
|
|
22
|
+
require "couchbase/deprecations"
|
|
23
|
+
|
|
24
|
+
require "couchbase/railtie" if defined?(Rails)
|
|
25
|
+
|
|
26
|
+
# @!macro uncommitted
|
|
27
|
+
# @couchbase.stability
|
|
28
|
+
# **Uncommitted:** This API may change in the future.
|
|
29
|
+
#
|
|
30
|
+
# @!macro volatile
|
|
31
|
+
# @couchbase.stability
|
|
32
|
+
# **Volatile:** This API is subject to change at any time.
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Copyright 2020-2021 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
|
+
module Couchbase
|
|
18
|
+
module Generators
|
|
19
|
+
class ConfigGenerator < Rails::Generators::Base
|
|
20
|
+
desc "Creates a Couchbase configuration file at config/couchbase.yml"
|
|
21
|
+
|
|
22
|
+
source_root File.expand_path(File.join("..", "templates"), __FILE__)
|
|
23
|
+
|
|
24
|
+
def create_config_file
|
|
25
|
+
template "couchbase.yml", File.join("config", "couchbase.yml")
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|