couchbase 3.5.5 → 3.5.6
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 +4 -4
- data/README.md +1 -1
- data/ext/cache/extconf_include.rb +3 -3
- data/ext/cache/mozilla-ca-bundle.crt +64 -33
- data/ext/cache/mozilla-ca-bundle.sha256 +1 -1
- data/ext/couchbase/CMakeLists.txt +1 -1
- data/ext/couchbase/core/bucket.cxx +16 -14
- data/ext/couchbase/core/bucket.hxx +2 -1
- data/ext/couchbase/core/cluster.cxx +9 -7
- data/ext/couchbase/core/cluster.hxx +2 -1
- data/ext/couchbase/core/impl/cluster.cxx +55 -18
- data/ext/couchbase/core/impl/collection.cxx +12 -11
- data/ext/couchbase/core/impl/observe_poll.cxx +7 -7
- data/ext/couchbase/core/impl/replica_utils.cxx +5 -5
- data/ext/couchbase/core/impl/replica_utils.hxx +2 -1
- data/ext/couchbase/core/logger/logger.cxx +1 -1
- data/ext/couchbase/core/meta/features.hxx +5 -0
- data/ext/couchbase/core/operations/document_get_all_replicas.hxx +3 -4
- data/ext/couchbase/core/operations/document_get_any_replica.hxx +3 -3
- data/ext/couchbase/core/operations/document_lookup_in_all_replicas.hxx +3 -3
- data/ext/couchbase/core/operations/document_lookup_in_any_replica.hxx +3 -3
- data/ext/couchbase.cxx +1 -0
- data/ext/extconf.rb +10 -0
- data/ext/rcb_backend.cxx +77 -1
- data/ext/rcb_logger.cxx +6 -1
- data/ext/rcb_logger.hxx +3 -0
- data/ext/rcb_range_scan.cxx +2 -4
- data/lib/couchbase/bucket.rb +0 -8
- data/lib/couchbase/cluster.rb +2 -13
- data/lib/couchbase/collection.rb +0 -43
- data/lib/couchbase/collection_options.rb +3 -3
- data/lib/couchbase/datastructures/couchbase_queue.rb +1 -1
- data/lib/couchbase/datastructures/couchbase_set.rb +1 -1
- data/lib/couchbase/deprecations.rb +61 -0
- data/lib/couchbase/fork_hooks.rb +32 -0
- data/lib/couchbase/management/analytics_index_manager.rb +1 -1
- data/lib/couchbase/management/bucket_manager.rb +1 -1
- data/lib/couchbase/management/collection_manager.rb +1 -1
- data/lib/couchbase/management/query_index_manager.rb +1 -1
- data/lib/couchbase/options.rb +2 -2
- data/lib/couchbase/protostellar/request_generator/query.rb +1 -1
- data/lib/couchbase/utils/time.rb +1 -1
- data/lib/couchbase/version.rb +1 -1
- data/lib/couchbase.rb +2 -0
- metadata +7 -5
@@ -206,3 +206,8 @@
|
|
206
206
|
* All options classes in the Public API expose the parent_span option.
|
207
207
|
*/
|
208
208
|
#define COUCHBASE_CXX_CLIENT_PUBLIC_API_PARENT_SPAN 1
|
209
|
+
|
210
|
+
/**
|
211
|
+
* core API like with_bucket_configuration() yields shared_ptr instead of configuration copy
|
212
|
+
*/
|
213
|
+
#define COUCHBASE_CXX_CLIENT_CORE_RETURNS_POINTER_TO_CONFIG 1
|
@@ -26,7 +26,6 @@
|
|
26
26
|
#include "core/utils/movable_function.hxx"
|
27
27
|
#include "couchbase/error_codes.hxx"
|
28
28
|
|
29
|
-
#include <functional>
|
30
29
|
#include <memory>
|
31
30
|
#include <mutex>
|
32
31
|
|
@@ -65,8 +64,8 @@ struct get_all_replicas_request {
|
|
65
64
|
id = id,
|
66
65
|
timeout = timeout,
|
67
66
|
read_preference = read_preference,
|
68
|
-
h = std::forward<Handler>(handler)](
|
69
|
-
|
67
|
+
h = std::forward<Handler>(handler)](
|
68
|
+
std::error_code ec, std::shared_ptr<topology::configuration> config) mutable {
|
70
69
|
if (ec) {
|
71
70
|
return h(response_type{ make_key_value_error_context(ec, id) });
|
72
71
|
}
|
@@ -82,7 +81,7 @@ struct get_all_replicas_request {
|
|
82
81
|
"Unable to retrieve replicas for \"{}\", server_group={}, number_of_replicas={}",
|
83
82
|
id,
|
84
83
|
origin.options().server_group,
|
85
|
-
config
|
84
|
+
config->num_replicas.value_or(0));
|
86
85
|
return h(response_type{
|
87
86
|
make_key_value_error_context(errc::key_value::document_irretrievable, id) });
|
88
87
|
}
|
@@ -61,8 +61,8 @@ struct get_any_replica_request {
|
|
61
61
|
id = id,
|
62
62
|
timeout = timeout,
|
63
63
|
read_preference = read_preference,
|
64
|
-
h = std::forward<Handler>(handler)](
|
65
|
-
|
64
|
+
h = std::forward<Handler>(handler)](
|
65
|
+
std::error_code ec, std::shared_ptr<topology::configuration> config) mutable {
|
66
66
|
const auto [e, origin] = core->origin();
|
67
67
|
if (e && !ec) {
|
68
68
|
ec = e;
|
@@ -75,7 +75,7 @@ struct get_any_replica_request {
|
|
75
75
|
"Unable to retrieve replicas for \"{}\", server_group={}, number_of_replicas={}",
|
76
76
|
id,
|
77
77
|
origin.options().server_group,
|
78
|
-
config
|
78
|
+
config->num_replicas.value_or(0));
|
79
79
|
ec = errc::key_value::document_irretrievable;
|
80
80
|
}
|
81
81
|
|
@@ -94,8 +94,8 @@ struct lookup_in_all_replicas_request {
|
|
94
94
|
core->with_bucket_configuration(
|
95
95
|
id.bucket(),
|
96
96
|
[core, id, timeout, specs, parent_span, read_preference, h = std::forward<Handler>(h)](
|
97
|
-
std::error_code ec,
|
98
|
-
if (!config
|
97
|
+
std::error_code ec, std::shared_ptr<topology::configuration> config) mutable {
|
98
|
+
if (!config->capabilities.supports_subdoc_read_replica()) {
|
99
99
|
ec = errc::common::feature_not_available;
|
100
100
|
}
|
101
101
|
|
@@ -111,7 +111,7 @@ struct lookup_in_all_replicas_request {
|
|
111
111
|
"Unable to retrieve replicas for \"{}\", server_group={}, number_of_replicas={}",
|
112
112
|
id,
|
113
113
|
origin.options().server_group,
|
114
|
-
config
|
114
|
+
config->num_replicas.value_or(0));
|
115
115
|
ec = errc::key_value::document_irretrievable;
|
116
116
|
}
|
117
117
|
|
@@ -92,8 +92,8 @@ struct lookup_in_any_replica_request {
|
|
92
92
|
return core->with_bucket_configuration(
|
93
93
|
id.bucket(),
|
94
94
|
[core, id, timeout, specs, parent_span, read_preference, h = std::forward<Handler>(h)](
|
95
|
-
std::error_code ec,
|
96
|
-
if (!config
|
95
|
+
std::error_code ec, std::shared_ptr<topology::configuration> config) mutable {
|
96
|
+
if (!config->capabilities.supports_subdoc_read_replica()) {
|
97
97
|
ec = errc::common::feature_not_available;
|
98
98
|
}
|
99
99
|
const auto [e, origin] = core->origin();
|
@@ -108,7 +108,7 @@ struct lookup_in_any_replica_request {
|
|
108
108
|
"Unable to retrieve replicas for \"{}\", server_group={}, number_of_replicas={}",
|
109
109
|
id,
|
110
110
|
origin.options().server_group,
|
111
|
-
config
|
111
|
+
config->num_replicas.value_or(0));
|
112
112
|
ec = errc::key_value::document_irretrievable;
|
113
113
|
}
|
114
114
|
|
data/ext/couchbase.cxx
CHANGED
data/ext/extconf.rb
CHANGED
@@ -154,6 +154,16 @@ build_dir = ENV['CB_EXT_BUILD_DIR'] ||
|
|
154
154
|
File.join(Dir.tmpdir, "cb-#{build_type}-#{RUBY_VERSION}-#{RUBY_PATCHLEVEL}-#{RUBY_PLATFORM}-#{SDK_VERSION}")
|
155
155
|
FileUtils.rm_rf(build_dir, verbose: true) unless ENV['CB_PRESERVE_BUILD_DIR']
|
156
156
|
FileUtils.mkdir_p(build_dir, verbose: true)
|
157
|
+
if ENV["CB_CREATE_BUILD_DIR_LINK"]
|
158
|
+
links = [
|
159
|
+
File.expand_path(File.join(project_path, "..", "build")),
|
160
|
+
File.expand_path(File.join(project_path, "build"))
|
161
|
+
]
|
162
|
+
links.each do |link|
|
163
|
+
next if link == build_dir
|
164
|
+
FileUtils.ln_sf(build_dir, link, verbose: true)
|
165
|
+
end
|
166
|
+
end
|
157
167
|
Dir.chdir(build_dir) do
|
158
168
|
puts "-- build #{build_type} extension #{SDK_VERSION} for ruby #{RUBY_VERSION}-#{RUBY_PATCHLEVEL}-#{RUBY_PLATFORM}"
|
159
169
|
sys(cmake, *cmake_flags, "-B#{build_dir}", "-S#{project_path}")
|
data/ext/rcb_backend.cxx
CHANGED
@@ -17,6 +17,9 @@
|
|
17
17
|
|
18
18
|
#include <couchbase/cluster.hxx>
|
19
19
|
|
20
|
+
#include <couchbase/fork_event.hxx>
|
21
|
+
#include <couchbase/ip_protocol.hxx>
|
22
|
+
|
20
23
|
#include <core/cluster.hxx>
|
21
24
|
#include <core/logger/logger.hxx>
|
22
25
|
#include <core/utils/connection_string.hxx>
|
@@ -25,11 +28,12 @@
|
|
25
28
|
#include <spdlog/fmt/bundled/core.h>
|
26
29
|
|
27
30
|
#include <future>
|
31
|
+
#include <list>
|
28
32
|
#include <memory>
|
33
|
+
#include <mutex>
|
29
34
|
|
30
35
|
#include <ruby.h>
|
31
36
|
|
32
|
-
#include "couchbase/ip_protocol.hxx"
|
33
37
|
#include "rcb_backend.hxx"
|
34
38
|
#include "rcb_exceptions.hxx"
|
35
39
|
#include "rcb_logger.hxx"
|
@@ -44,10 +48,79 @@ struct cb_backend_data {
|
|
44
48
|
std::unique_ptr<cluster> instance{ nullptr };
|
45
49
|
};
|
46
50
|
|
51
|
+
class instance_registry
|
52
|
+
{
|
53
|
+
public:
|
54
|
+
void add(cluster* instance)
|
55
|
+
{
|
56
|
+
std::scoped_lock lock(instances_mutex_);
|
57
|
+
known_instances_.push_back(instance);
|
58
|
+
}
|
59
|
+
|
60
|
+
void remove(cluster* instance)
|
61
|
+
{
|
62
|
+
std::scoped_lock lock(instances_mutex_);
|
63
|
+
known_instances_.remove(instance);
|
64
|
+
}
|
65
|
+
|
66
|
+
void notify_fork(couchbase::fork_event event)
|
67
|
+
{
|
68
|
+
if (event != couchbase::fork_event::prepare) {
|
69
|
+
init_logger();
|
70
|
+
}
|
71
|
+
|
72
|
+
{
|
73
|
+
std::scoped_lock lock(instances_mutex_);
|
74
|
+
for (auto* instance : known_instances_) {
|
75
|
+
instance->notify_fork(event);
|
76
|
+
}
|
77
|
+
}
|
78
|
+
|
79
|
+
if (event == couchbase::fork_event::prepare) {
|
80
|
+
flush_logger();
|
81
|
+
couchbase::core::logger::shutdown();
|
82
|
+
}
|
83
|
+
}
|
84
|
+
|
85
|
+
private:
|
86
|
+
std::mutex instances_mutex_;
|
87
|
+
std::list<cluster*> known_instances_;
|
88
|
+
};
|
89
|
+
|
90
|
+
instance_registry instances;
|
91
|
+
|
92
|
+
VALUE
|
93
|
+
cb_Backend_notify_fork(VALUE self, VALUE event)
|
94
|
+
{
|
95
|
+
static const auto id_prepare{ rb_intern("prepare") };
|
96
|
+
static const auto id_parent{ rb_intern("parent") };
|
97
|
+
static const auto id_child{ rb_intern("child") };
|
98
|
+
|
99
|
+
try {
|
100
|
+
cb_check_type(event, T_SYMBOL);
|
101
|
+
|
102
|
+
if (rb_sym2id(event) == id_prepare) {
|
103
|
+
instances.notify_fork(couchbase::fork_event::prepare);
|
104
|
+
} else if (rb_sym2id(event) == id_parent) {
|
105
|
+
instances.notify_fork(couchbase::fork_event::parent);
|
106
|
+
} else if (rb_sym2id(event) == id_child) {
|
107
|
+
instances.notify_fork(couchbase::fork_event::child);
|
108
|
+
} else {
|
109
|
+
throw ruby_exception(rb_eTypeError,
|
110
|
+
rb_sprintf("unexpected fork event type %" PRIsVALUE "", event));
|
111
|
+
}
|
112
|
+
} catch (const ruby_exception& e) {
|
113
|
+
rb_exc_raise(e.exception_object());
|
114
|
+
}
|
115
|
+
|
116
|
+
return Qnil;
|
117
|
+
}
|
118
|
+
|
47
119
|
void
|
48
120
|
cb_backend_close(cb_backend_data* backend)
|
49
121
|
{
|
50
122
|
if (auto instance = std::move(backend->instance); instance) {
|
123
|
+
instances.remove(instance.get());
|
51
124
|
auto promise = std::make_shared<std::promise<void>>();
|
52
125
|
auto f = promise->get_future();
|
53
126
|
instance->close([promise = std::move(promise)]() mutable {
|
@@ -446,6 +519,7 @@ cb_Backend_open(VALUE self, VALUE connstr, VALUE credentials, VALUE options)
|
|
446
519
|
error, fmt::format("failed to connect to the Couchbase Server \"{}\"", connection_string));
|
447
520
|
}
|
448
521
|
backend->instance = std::make_unique<couchbase::cluster>(std::move(cluster));
|
522
|
+
instances.add(backend->instance.get());
|
449
523
|
} catch (const std::system_error& se) {
|
450
524
|
rb_exc_raise(cb_map_error_code(
|
451
525
|
se.code(), fmt::format("failed to perform {}: {}", __func__, se.what()), false));
|
@@ -509,6 +583,8 @@ init_backend(VALUE mCouchbase)
|
|
509
583
|
rb_define_method(cBackend, "open", cb_Backend_open, 3);
|
510
584
|
rb_define_method(cBackend, "open_bucket", cb_Backend_open_bucket, 2);
|
511
585
|
rb_define_method(cBackend, "close", cb_Backend_close, 0);
|
586
|
+
|
587
|
+
rb_define_singleton_method(cBackend, "notify_fork", cb_Backend_notify_fork, 1);
|
512
588
|
return cBackend;
|
513
589
|
}
|
514
590
|
|
data/ext/rcb_logger.cxx
CHANGED
@@ -268,13 +268,18 @@ cb_Backend_install_logger_shim(VALUE self, VALUE logger, VALUE log_level)
|
|
268
268
|
} // namespace
|
269
269
|
|
270
270
|
void
|
271
|
-
|
271
|
+
install_terminate_handler()
|
272
272
|
{
|
273
273
|
if (auto env_val =
|
274
274
|
spdlog::details::os::getenv("COUCHBASE_BACKEND_DONT_INSTALL_TERMINATE_HANDLER");
|
275
275
|
env_val.empty()) {
|
276
276
|
core::platform::install_backtrace_terminate_handler();
|
277
277
|
}
|
278
|
+
}
|
279
|
+
|
280
|
+
void
|
281
|
+
init_logger()
|
282
|
+
{
|
278
283
|
if (auto env_val = spdlog::details::os::getenv("COUCHBASE_BACKEND_DONT_USE_BUILTIN_LOGGER");
|
279
284
|
env_val.empty()) {
|
280
285
|
auto default_log_level = core::logger::level::info;
|
data/ext/rcb_logger.hxx
CHANGED
data/ext/rcb_range_scan.cxx
CHANGED
@@ -245,13 +245,11 @@ cb_Backend_document_scan_create(VALUE self,
|
|
245
245
|
std::promise<tl::expected<couchbase::core::topology::configuration, std::error_code>> promise;
|
246
246
|
auto f = promise.get_future();
|
247
247
|
cluster.with_bucket_configuration(
|
248
|
-
bucket_name,
|
249
|
-
[promise = std::move(promise)](
|
250
|
-
std::error_code ec, const couchbase::core::topology::configuration& config) mutable {
|
248
|
+
bucket_name, [promise = std::move(promise)](std::error_code ec, const auto& config) mutable {
|
251
249
|
if (ec) {
|
252
250
|
return promise.set_value(tl::unexpected(ec));
|
253
251
|
}
|
254
|
-
promise.set_value(config);
|
252
|
+
promise.set_value(*config);
|
255
253
|
});
|
256
254
|
auto config = cb_wait_for_future(f);
|
257
255
|
if (!config.has_value()) {
|
data/lib/couchbase/bucket.rb
CHANGED
@@ -134,13 +134,5 @@ module Couchbase
|
|
134
134
|
end
|
135
135
|
end
|
136
136
|
end
|
137
|
-
|
138
|
-
# @api private
|
139
|
-
# TODO: deprecate in 3.1
|
140
|
-
PingOptions = ::Couchbase::Options::Ping
|
141
|
-
|
142
|
-
# @api private
|
143
|
-
# TODO: deprecate in 3.1
|
144
|
-
ViewOptions = ::Couchbase::Options::View
|
145
137
|
end
|
146
138
|
end
|
data/lib/couchbase/cluster.rb
CHANGED
@@ -48,7 +48,7 @@ module Couchbase
|
|
48
48
|
# @param [Options::Cluster, nil] options custom options when creating the cluster connection
|
49
49
|
#
|
50
50
|
# @example Explicitly create options object and initialize PasswordAuthenticator internally
|
51
|
-
# options = Cluster
|
51
|
+
# options = Options::Cluster.new
|
52
52
|
# options.authenticate("Administrator", "password")
|
53
53
|
# Cluster.connect("couchbase://localhost", options)
|
54
54
|
#
|
@@ -354,7 +354,7 @@ module Couchbase
|
|
354
354
|
raise ArgumentError, "options must have authenticator configured"
|
355
355
|
end
|
356
356
|
else
|
357
|
-
raise ArgumentError, "unexpected second argument, have to be String or
|
357
|
+
raise ArgumentError, "unexpected second argument, have to be String or Options::Cluster"
|
358
358
|
end
|
359
359
|
end
|
360
360
|
|
@@ -447,16 +447,5 @@ module Couchbase
|
|
447
447
|
end
|
448
448
|
end
|
449
449
|
end
|
450
|
-
|
451
|
-
# @api private
|
452
|
-
ClusterOptions = ::Couchbase::Options::Cluster
|
453
|
-
# @api private
|
454
|
-
DiagnosticsOptions = ::Couchbase::Options::Diagnostics
|
455
|
-
# @api private
|
456
|
-
AnalyticsOptions = ::Couchbase::Options::Analytics
|
457
|
-
# @api private
|
458
|
-
QueryOptions = ::Couchbase::Options::Query
|
459
|
-
# @api private
|
460
|
-
SearchOptions = ::Couchbase::Options::Search
|
461
450
|
end
|
462
451
|
end
|
data/lib/couchbase/collection.rb
CHANGED
@@ -660,48 +660,5 @@ module Couchbase
|
|
660
660
|
end
|
661
661
|
end
|
662
662
|
end
|
663
|
-
|
664
|
-
# @api private
|
665
|
-
# TODO: deprecate in 3.1
|
666
|
-
GetOptions = ::Couchbase::Options::Get
|
667
|
-
# @api private
|
668
|
-
# TODO: deprecate in 3.1
|
669
|
-
GetAndLockOptions = ::Couchbase::Options::GetAndLock
|
670
|
-
# @api private
|
671
|
-
# TODO: deprecate in 3.1
|
672
|
-
GetAndTouchOptions = ::Couchbase::Options::GetAndTouch
|
673
|
-
# @api private
|
674
|
-
# TODO: deprecate in 3.1
|
675
|
-
LookupInOptions = ::Couchbase::Options::LookupIn
|
676
|
-
# @api private
|
677
|
-
# TODO: deprecate in 3.1
|
678
|
-
MutateInOptions = ::Couchbase::Options::MutateIn
|
679
|
-
# @api private
|
680
|
-
# TODO: deprecate in 3.1
|
681
|
-
UnlockOptions = ::Couchbase::Options::Unlock
|
682
|
-
# @api private
|
683
|
-
# TODO: deprecate in 3.1
|
684
|
-
TouchOptions = ::Couchbase::Options::Touch
|
685
|
-
# @api private
|
686
|
-
# TODO: deprecate in 3.1
|
687
|
-
ReplaceOptions = ::Couchbase::Options::Replace
|
688
|
-
# @api private
|
689
|
-
# TODO: deprecate in 3.1
|
690
|
-
UpsertOptions = ::Couchbase::Options::Upsert
|
691
|
-
# @api private
|
692
|
-
# TODO: deprecate in 3.1
|
693
|
-
InsertOptions = ::Couchbase::Options::Insert
|
694
|
-
# @api private
|
695
|
-
# TODO: deprecate in 3.1
|
696
|
-
RemoveOptions = ::Couchbase::Options::Remove
|
697
|
-
# @api private
|
698
|
-
# TODO: deprecate in 3.1
|
699
|
-
ExistsOptions = ::Couchbase::Options::Exists
|
700
|
-
# @api private
|
701
|
-
# TODO: deprecate in 3.1
|
702
|
-
GetAnyReplicaOptions = ::Couchbase::Options::GetAnyReplica
|
703
|
-
# @api private
|
704
|
-
# TODO: deprecate in 3.1
|
705
|
-
GetAllReplicasOptions = ::Couchbase::Options::GetAllReplicas
|
706
663
|
end
|
707
664
|
end
|
@@ -80,7 +80,7 @@ module Couchbase
|
|
80
80
|
|
81
81
|
# @deprecated Use {#expiry_time}
|
82
82
|
# @return [Integer] the expiration if fetched and present
|
83
|
-
def expiry # rubocop:disable Style/TrivialAccessors will be removed in next major release
|
83
|
+
def expiry # rubocop:disable Style/TrivialAccessors -- will be removed in next major release
|
84
84
|
@expiry
|
85
85
|
end
|
86
86
|
|
@@ -211,7 +211,7 @@ module Couchbase
|
|
211
211
|
|
212
212
|
# @api private
|
213
213
|
#
|
214
|
-
# @see
|
214
|
+
# @see Options::MutateIn#create_as_deleted
|
215
215
|
#
|
216
216
|
# @return [Boolean] true if the document is a tombstone (created in deleted state)
|
217
217
|
def deleted?
|
@@ -273,7 +273,7 @@ module Couchbase
|
|
273
273
|
|
274
274
|
# @api private
|
275
275
|
#
|
276
|
-
# @see
|
276
|
+
# @see Options::MutateIn#create_as_deleted
|
277
277
|
#
|
278
278
|
# @return [Boolean] true if the document is a tombstone (created in deleted state)
|
279
279
|
def deleted?
|
@@ -112,7 +112,7 @@ module Couchbase
|
|
112
112
|
LookupInSpec.get("[-1]"),
|
113
113
|
], @options.lookup_in_options)
|
114
114
|
obj = result.exists?(0) ? result.content(0) : nil
|
115
|
-
options =
|
115
|
+
options = Options::MutateIn.new
|
116
116
|
options.cas = result.cas
|
117
117
|
@collection.mutate_in(@id, [
|
118
118
|
MutateInSpec.remove("[-1]"),
|
@@ -109,7 +109,7 @@ module Couchbase
|
|
109
109
|
idx = result.content.index(obj)
|
110
110
|
return false unless idx
|
111
111
|
|
112
|
-
options =
|
112
|
+
options = Options::MutateIn.new
|
113
113
|
options.cas = result.cas
|
114
114
|
@collection.mutate_in(@id, [
|
115
115
|
MutateInSpec.remove("[#{idx}]"),
|
@@ -0,0 +1,61 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2020-2025 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 Deprecations
|
19
|
+
def self.deprecate_constants(removed_in_version, parent, constants)
|
20
|
+
deprecator = Module.new do
|
21
|
+
define_method(:const_missing) do |old_name|
|
22
|
+
return super unless constants.key?(old_name)
|
23
|
+
|
24
|
+
new_name = constants[old_name]
|
25
|
+
|
26
|
+
warn "NOTE: #{name}::#{old_name} is deprecated; use Couchbase::#{new_name} instead. " \
|
27
|
+
"It will be removed in version #{removed_in_version}."
|
28
|
+
Couchbase.const_get(new_name)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
parent.singleton_class.prepend(deprecator)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
Deprecations.deprecate_constants("3.6.0", Cluster,
|
36
|
+
AnalyticsOptions: "Options::Analytics",
|
37
|
+
ClusterOptions: "Options::Cluster",
|
38
|
+
DiagnosticsOptions: "Options::Diagnostics",
|
39
|
+
QueryOptions: "Options::Query",
|
40
|
+
SearchOptions: "Options::Search")
|
41
|
+
|
42
|
+
Deprecations.deprecate_constants("3.6.0", Bucket,
|
43
|
+
PingOptions: "Options::Ping",
|
44
|
+
ViewOptions: "Options::View")
|
45
|
+
|
46
|
+
Deprecations.deprecate_constants("3.6.0", Collection,
|
47
|
+
ExistsOptions: "Options::Exists",
|
48
|
+
GetAllReplicasOptions: "Options::GetAllReplicas",
|
49
|
+
GetAndLockOptions: "Options::GetAndLock",
|
50
|
+
GetAndTouchOptions: "Options::GetAndTouch",
|
51
|
+
GetAnyReplicaOptions: "Options::GetAnyReplica",
|
52
|
+
GetOptions: "Options::Get",
|
53
|
+
InsertOptions: "Options::Insert",
|
54
|
+
LookupInOptions: "Options::LookupIn",
|
55
|
+
MutateInOptions: "Options::MutateIn",
|
56
|
+
RemoveOptions: "Options::Remove",
|
57
|
+
ReplaceOptions: "Options::Replace",
|
58
|
+
TouchOptions: "Options::Touch",
|
59
|
+
UnlockOptions: "Options::Unlock",
|
60
|
+
UpsertOptions: "Options::Upsert")
|
61
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2020-2025 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 ForkHooks
|
19
|
+
def _fork
|
20
|
+
Couchbase::Backend.notify_fork(:prepare)
|
21
|
+
pid = super
|
22
|
+
if pid
|
23
|
+
Couchbase::Backend.notify_fork(:parent)
|
24
|
+
else
|
25
|
+
Couchbase::Backend.notify_fork(:child)
|
26
|
+
end
|
27
|
+
pid
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
Process.singleton_class.prepend(Couchbase::ForkHooks)
|
@@ -513,7 +513,7 @@ module Couchbase
|
|
513
513
|
end
|
514
514
|
end
|
515
515
|
|
516
|
-
# rubocop:disable Naming/MethodName constructor shortcuts
|
516
|
+
# rubocop:disable Naming/MethodName -- constructor shortcuts
|
517
517
|
module_function
|
518
518
|
|
519
519
|
# Construct {CreateDataverse} options for {AnalyticsIndexManager#create_dataverse}
|
@@ -137,7 +137,7 @@ module Couchbase
|
|
137
137
|
end
|
138
138
|
end
|
139
139
|
|
140
|
-
# rubocop:disable Naming/MethodName constructor shortcuts
|
140
|
+
# rubocop:disable Naming/MethodName -- constructor shortcuts
|
141
141
|
module_function
|
142
142
|
|
143
143
|
# Construct {CreateBucket} options for {BucketManager#create_bucket}
|
@@ -149,7 +149,7 @@ module Couchbase
|
|
149
149
|
DEFAULT = DropCollection.new.freeze
|
150
150
|
end
|
151
151
|
|
152
|
-
# rubocop:disable Naming/MethodName constructor shortcuts
|
152
|
+
# rubocop:disable Naming/MethodName -- constructor shortcuts
|
153
153
|
module_function
|
154
154
|
|
155
155
|
# Construct {GetAllScopes} options for {CollectionManager#get_all_scopes}
|
@@ -339,7 +339,7 @@ module Couchbase
|
|
339
339
|
end
|
340
340
|
end
|
341
341
|
|
342
|
-
# rubocop:disable Naming/MethodName constructor shortcuts
|
342
|
+
# rubocop:disable Naming/MethodName -- constructor shortcuts
|
343
343
|
module_function
|
344
344
|
|
345
345
|
# Construct {GetAllIndexes} options for {QueryIndexManager#get_all_indexes}
|
data/lib/couchbase/options.rb
CHANGED
@@ -2392,7 +2392,7 @@ module Couchbase
|
|
2392
2392
|
|
2393
2393
|
# @param [:and, :or, nil] vector_query_combination
|
2394
2394
|
#
|
2395
|
-
# @yieldparam [
|
2395
|
+
# @yieldparam [Options::VectorSearch] self
|
2396
2396
|
def initialize(vector_query_combination: nil)
|
2397
2397
|
@vector_query_combination = vector_query_combination
|
2398
2398
|
|
@@ -2536,7 +2536,7 @@ module Couchbase
|
|
2536
2536
|
# TODO: deprecate in 3.1
|
2537
2537
|
CommonOptions = ::Couchbase::Options::Base
|
2538
2538
|
|
2539
|
-
# rubocop:disable Naming/MethodName constructor shortcuts
|
2539
|
+
# rubocop:disable Naming/MethodName -- constructor shortcuts
|
2540
2540
|
module_function
|
2541
2541
|
|
2542
2542
|
# Construct {Get} options for {Collection#get}
|
data/lib/couchbase/utils/time.rb
CHANGED
@@ -58,7 +58,7 @@ module Couchbase
|
|
58
58
|
# 3. Otherwise invoke #to_i on the argument and interpret it as a number of milliseconds
|
59
59
|
def extract_duration(number_or_duration)
|
60
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?
|
61
|
+
return number_or_duration if number_or_duration.class == Integer # rubocop:disable Style/ClassEqualityComparison -- avoid overrides of #is_a?, #kind_of?
|
62
62
|
|
63
63
|
if number_or_duration.respond_to?(:in_milliseconds)
|
64
64
|
number_or_duration.in_milliseconds
|
data/lib/couchbase/version.rb
CHANGED
@@ -21,5 +21,5 @@ module Couchbase
|
|
21
21
|
# $ ruby -rcouchbase -e 'pp Couchbase::VERSION'
|
22
22
|
# {:sdk=>"3.4.0", :ruby_abi=>"3.1.0", :revision=>"416fe68e6029ec8a4c40611cf6e6b30d3b90d20f"}
|
23
23
|
VERSION = {} unless defined?(VERSION) # rubocop:disable Style/MutableConstant
|
24
|
-
VERSION.update(:sdk => "3.5.
|
24
|
+
VERSION.update(:sdk => "3.5.6")
|
25
25
|
end
|
data/lib/couchbase.rb
CHANGED
@@ -16,8 +16,10 @@
|
|
16
16
|
|
17
17
|
require "couchbase/version"
|
18
18
|
require "couchbase/libcouchbase"
|
19
|
+
require "couchbase/fork_hooks"
|
19
20
|
require "couchbase/logger"
|
20
21
|
require "couchbase/cluster"
|
22
|
+
require "couchbase/deprecations"
|
21
23
|
|
22
24
|
require "couchbase/railtie" if defined?(Rails)
|
23
25
|
|