couchbase 3.5.6 → 3.6.0
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 +2 -2
- data/ext/cache/extconf_include.rb +3 -3
- data/ext/cache/mozilla-ca-bundle.crt +3 -165
- data/ext/cache/mozilla-ca-bundle.sha256 +1 -1
- data/ext/cache/snappy/{585305c8dbb8f762f2c2e17f937f1cf3ac6cbc9c → 3cde171792b3607f75c14e5011eaf69da4857bd8}/snappy/CMakeLists.txt +14 -10
- data/ext/cache/snappy/{585305c8dbb8f762f2c2e17f937f1cf3ac6cbc9c → 3cde171792b3607f75c14e5011eaf69da4857bd8}/snappy/snappy.cc +7 -4
- data/ext/couchbase/CMakeLists.txt +12 -1
- data/ext/couchbase/cmake/Profiler.cmake +15 -0
- data/ext/couchbase/cmake/ThirdPartyDependencies.cmake +2 -2
- data/ext/couchbase/cmake/couchbase_cxx_client.pc.in +1 -1
- data/ext/couchbase/core/app_telemetry_address.cxx +55 -0
- data/ext/couchbase/core/app_telemetry_address.hxx +39 -0
- data/ext/couchbase/core/app_telemetry_meter.cxx +753 -0
- data/ext/couchbase/core/app_telemetry_meter.hxx +198 -0
- data/ext/couchbase/core/app_telemetry_reporter.cxx +895 -0
- data/ext/couchbase/core/app_telemetry_reporter.hxx +59 -0
- data/ext/couchbase/core/bucket.cxx +77 -35
- data/ext/couchbase/core/bucket.hxx +17 -10
- data/ext/couchbase/core/cluster.cxx +54 -16
- data/ext/couchbase/core/cluster_credentials.cxx +27 -0
- data/ext/couchbase/core/cluster_credentials.hxx +36 -0
- data/ext/couchbase/core/cluster_options.hxx +12 -0
- data/ext/couchbase/core/collections_component.cxx +7 -5
- data/ext/couchbase/core/http_component.cxx +6 -0
- data/ext/couchbase/core/impl/binary_collection.cxx +4 -0
- data/ext/couchbase/core/impl/bucket_manager.cxx +2 -0
- data/ext/couchbase/core/impl/cluster.cxx +9 -0
- data/ext/couchbase/core/impl/collection.cxx +2 -0
- data/ext/couchbase/core/impl/error.cxx +1 -0
- data/ext/couchbase/core/impl/logger.cxx +51 -0
- data/ext/couchbase/core/impl/replica_utils.cxx +1 -1
- data/ext/couchbase/core/impl/transaction_get_multi_replicas_from_preferred_server_group_spec.cxx +32 -0
- data/ext/couchbase/core/impl/transaction_get_multi_spec.cxx +30 -0
- data/ext/couchbase/core/impl/transaction_op_error_category.cxx +2 -0
- data/ext/couchbase/core/io/config_tracker.cxx +6 -6
- data/ext/couchbase/core/io/http_command.hxx +35 -11
- data/ext/couchbase/core/io/http_session.cxx +10 -0
- data/ext/couchbase/core/io/http_session.hxx +4 -0
- data/ext/couchbase/core/io/http_session_manager.hxx +83 -34
- data/ext/couchbase/core/io/mcbp_command.hxx +41 -2
- data/ext/couchbase/core/io/mcbp_session.cxx +52 -19
- data/ext/couchbase/core/io/mcbp_session.hxx +3 -0
- data/ext/couchbase/core/logger/logger.cxx +46 -0
- data/ext/couchbase/core/logger/logger.hxx +41 -1
- data/ext/couchbase/core/management/bucket_settings.hxx +1 -0
- data/ext/couchbase/core/management/bucket_settings_json.hxx +4 -0
- data/ext/couchbase/core/meta/features.hxx +32 -0
- data/ext/couchbase/core/operations/document_analytics.cxx +9 -9
- data/ext/couchbase/core/operations/document_append.cxx +1 -0
- data/ext/couchbase/core/operations/document_append.hxx +1 -0
- data/ext/couchbase/core/operations/document_get_all_replicas.hxx +10 -2
- data/ext/couchbase/core/operations/document_lookup_in.cxx +4 -0
- data/ext/couchbase/core/operations/document_lookup_in_all_replicas.hxx +14 -2
- data/ext/couchbase/core/operations/document_lookup_in_any_replica.hxx +4 -0
- data/ext/couchbase/core/operations/document_mutate_in.cxx +4 -0
- data/ext/couchbase/core/operations/document_mutate_in.hxx +1 -0
- data/ext/couchbase/core/operations/document_prepend.cxx +1 -0
- data/ext/couchbase/core/operations/document_prepend.hxx +1 -0
- data/ext/couchbase/core/operations/document_query.cxx +12 -10
- data/ext/couchbase/core/operations/http_noop.cxx +1 -0
- data/ext/couchbase/core/operations/management/bucket_create.cxx +3 -0
- data/ext/couchbase/core/operations/management/bucket_update.cxx +3 -0
- data/ext/couchbase/core/origin.cxx +0 -5
- data/ext/couchbase/core/origin.hxx +2 -11
- data/ext/couchbase/core/platform/random.cc +6 -3
- data/ext/couchbase/core/platform/random.h +2 -2
- data/ext/couchbase/core/protocol/cmd_mutate_in.hxx +9 -0
- data/ext/couchbase/core/timeout_defaults.hxx +4 -0
- data/ext/couchbase/core/topology/configuration.cxx +10 -13
- data/ext/couchbase/core/topology/configuration.hxx +14 -15
- data/ext/couchbase/core/topology/configuration_json.hxx +6 -0
- data/ext/couchbase/core/transactions/async_attempt_context.hxx +22 -2
- data/ext/couchbase/core/transactions/attempt_context.hxx +25 -7
- data/ext/couchbase/core/transactions/attempt_context_impl.cxx +688 -238
- data/ext/couchbase/core/transactions/attempt_context_impl.hxx +91 -12
- data/ext/couchbase/core/transactions/exceptions.cxx +5 -0
- data/ext/couchbase/core/transactions/exceptions.hxx +20 -0
- data/ext/couchbase/core/transactions/exceptions_fmt.hxx +3 -0
- data/ext/couchbase/core/transactions/forward_compat.cxx +71 -6
- data/ext/couchbase/core/transactions/forward_compat.hxx +45 -59
- data/ext/couchbase/core/transactions/get_multi_orchestrator.cxx +616 -0
- data/ext/couchbase/core/transactions/get_multi_orchestrator.hxx +61 -0
- data/ext/couchbase/core/transactions/internal/doc_record.cxx +8 -0
- data/ext/couchbase/core/transactions/internal/doc_record.hxx +16 -5
- data/ext/couchbase/core/transactions/internal/exceptions_internal.hxx +12 -0
- data/ext/couchbase/core/transactions/internal/transaction_context.hxx +13 -0
- data/ext/couchbase/core/transactions/internal/transaction_fields.hxx +1 -0
- data/ext/couchbase/core/transactions/staged_mutation.cxx +277 -96
- data/ext/couchbase/core/transactions/staged_mutation.hxx +28 -76
- data/ext/couchbase/core/transactions/transaction_context.cxx +33 -0
- data/ext/couchbase/core/transactions/transaction_get_multi_mode.hxx +28 -0
- data/ext/couchbase/core/transactions/transaction_get_multi_replicas_from_preferred_server_group_mode.hxx +27 -0
- data/ext/couchbase/core/transactions/transaction_get_multi_replicas_from_preferred_server_group_result.hxx +71 -0
- data/ext/couchbase/core/transactions/transaction_get_multi_result.hxx +66 -0
- data/ext/couchbase/core/transactions/transaction_links.hxx +10 -0
- data/ext/couchbase/core/transactions/transactions.cxx +8 -3
- data/ext/couchbase/core/utils/connection_string.cxx +4 -0
- data/ext/couchbase/core/utils/url_codec.cxx +26 -0
- data/ext/couchbase/core/utils/url_codec.hxx +11 -0
- data/ext/couchbase/core/websocket_codec.cxx +647 -0
- data/ext/couchbase/core/websocket_codec.hxx +77 -0
- data/ext/couchbase/couchbase/analytics_options.hxx +70 -6
- data/ext/couchbase/couchbase/application_telemetry_options.hxx +124 -0
- data/ext/couchbase/couchbase/cluster_options.hxx +17 -0
- data/ext/couchbase/couchbase/error_codes.hxx +1 -0
- data/ext/couchbase/couchbase/logger.hxx +16 -0
- data/ext/couchbase/couchbase/management/bucket_settings.hxx +1 -0
- data/ext/couchbase/couchbase/query_options.hxx +70 -6
- data/ext/couchbase/couchbase/transactions/async_attempt_context.hxx +29 -5
- data/ext/couchbase/couchbase/transactions/attempt_context.hxx +24 -7
- data/ext/couchbase/couchbase/transactions/transaction_get_multi_mode.hxx +47 -0
- data/ext/couchbase/couchbase/transactions/transaction_get_multi_options.hxx +44 -0
- data/ext/couchbase/couchbase/transactions/transaction_get_multi_replicas_from_preferred_server_group_mode.hxx +46 -0
- data/ext/couchbase/couchbase/transactions/transaction_get_multi_replicas_from_preferred_server_group_options.hxx +48 -0
- data/ext/couchbase/couchbase/transactions/transaction_get_multi_replicas_from_preferred_server_group_result.hxx +109 -0
- data/ext/couchbase/couchbase/transactions/transaction_get_multi_replicas_from_preferred_server_group_spec.hxx +47 -0
- data/ext/couchbase/couchbase/transactions/transaction_get_multi_result.hxx +102 -0
- data/ext/couchbase/couchbase/transactions/transaction_get_multi_spec.hxx +45 -0
- data/ext/extconf.rb +6 -0
- data/ext/rcb_buckets.cxx +26 -0
- data/lib/active_support/cache/couchbase_store.rb +1 -1
- data/lib/couchbase/cluster.rb +1 -1
- data/lib/couchbase/collection.rb +1 -1
- data/lib/couchbase/collection_options.rb +2 -2
- data/lib/couchbase/management/analytics_index_manager.rb +4 -4
- data/lib/couchbase/management/bucket_manager.rb +8 -2
- data/lib/couchbase/protostellar/cluster.rb +2 -2
- data/lib/couchbase/protostellar/collection.rb +1 -1
- data/lib/couchbase/protostellar/management/collection_query_index_manager.rb +1 -1
- data/lib/couchbase/protostellar/request_generator/admin/bucket.rb +4 -4
- data/lib/couchbase/protostellar/request_generator/admin/collection.rb +6 -6
- data/lib/couchbase/protostellar/request_generator/admin/query.rb +13 -13
- data/lib/couchbase/protostellar/request_generator/kv.rb +25 -25
- data/lib/couchbase/protostellar/request_generator/query.rb +4 -4
- data/lib/couchbase/protostellar/request_generator/search.rb +25 -25
- data/lib/couchbase/protostellar/response_converter/search.rb +1 -1
- data/lib/couchbase/protostellar/retry/reason.rb +1 -1
- data/lib/couchbase/protostellar/timeouts.rb +1 -1
- data/lib/couchbase/scope.rb +1 -1
- data/lib/couchbase/transcoder_flags.rb +1 -1
- data/lib/couchbase/utils/stdlib_logger_adapter.rb +1 -1
- data/lib/couchbase/version.rb +1 -1
- metadata +47 -19
- /data/ext/cache/snappy/{585305c8dbb8f762f2c2e17f937f1cf3ac6cbc9c → 3cde171792b3607f75c14e5011eaf69da4857bd8}/snappy/COPYING +0 -0
- /data/ext/cache/snappy/{585305c8dbb8f762f2c2e17f937f1cf3ac6cbc9c → 3cde171792b3607f75c14e5011eaf69da4857bd8}/snappy/cmake/SnappyConfig.cmake.in +0 -0
- /data/ext/cache/snappy/{585305c8dbb8f762f2c2e17f937f1cf3ac6cbc9c → 3cde171792b3607f75c14e5011eaf69da4857bd8}/snappy/cmake/config.h.in +0 -0
- /data/ext/cache/snappy/{585305c8dbb8f762f2c2e17f937f1cf3ac6cbc9c → 3cde171792b3607f75c14e5011eaf69da4857bd8}/snappy/snappy-c.cc +0 -0
- /data/ext/cache/snappy/{585305c8dbb8f762f2c2e17f937f1cf3ac6cbc9c → 3cde171792b3607f75c14e5011eaf69da4857bd8}/snappy/snappy-c.h +0 -0
- /data/ext/cache/snappy/{585305c8dbb8f762f2c2e17f937f1cf3ac6cbc9c → 3cde171792b3607f75c14e5011eaf69da4857bd8}/snappy/snappy-internal.h +0 -0
- /data/ext/cache/snappy/{585305c8dbb8f762f2c2e17f937f1cf3ac6cbc9c → 3cde171792b3607f75c14e5011eaf69da4857bd8}/snappy/snappy-sinksource.cc +0 -0
- /data/ext/cache/snappy/{585305c8dbb8f762f2c2e17f937f1cf3ac6cbc9c → 3cde171792b3607f75c14e5011eaf69da4857bd8}/snappy/snappy-sinksource.h +0 -0
- /data/ext/cache/snappy/{585305c8dbb8f762f2c2e17f937f1cf3ac6cbc9c → 3cde171792b3607f75c14e5011eaf69da4857bd8}/snappy/snappy-stubs-internal.cc +0 -0
- /data/ext/cache/snappy/{585305c8dbb8f762f2c2e17f937f1cf3ac6cbc9c → 3cde171792b3607f75c14e5011eaf69da4857bd8}/snappy/snappy-stubs-internal.h +0 -0
- /data/ext/cache/snappy/{585305c8dbb8f762f2c2e17f937f1cf3ac6cbc9c → 3cde171792b3607f75c14e5011eaf69da4857bd8}/snappy/snappy-stubs-public.h.in +0 -0
- /data/ext/cache/snappy/{585305c8dbb8f762f2c2e17f937f1cf3ac6cbc9c → 3cde171792b3607f75c14e5011eaf69da4857bd8}/snappy/snappy.h +0 -0
@@ -0,0 +1,47 @@
|
|
1
|
+
/*
|
2
|
+
* Copyright 2021-Present Couchbase, Inc.
|
3
|
+
*
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
* you may not use this file except in compliance with the License.
|
6
|
+
* You may obtain a copy of the License at
|
7
|
+
*
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
*
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
* See the License for the specific language governing permissions and
|
14
|
+
* limitations under the License.
|
15
|
+
*/
|
16
|
+
#pragma once
|
17
|
+
|
18
|
+
#include <cstdint>
|
19
|
+
|
20
|
+
namespace couchbase::transactions
|
21
|
+
{
|
22
|
+
/**
|
23
|
+
* Strategy to deal with potential read skews while reading multiple documents.
|
24
|
+
*
|
25
|
+
* Essentially when a transaction reads document X and then Y, and another
|
26
|
+
* transaction commits a change to Y inbetween those reads - read skew has
|
27
|
+
* occurred.
|
28
|
+
*/
|
29
|
+
enum class transaction_get_multi_mode : std::uint8_t {
|
30
|
+
/**
|
31
|
+
* Some time-bounded effort will be made to detect and avoid read skew.
|
32
|
+
*/
|
33
|
+
prioritise_latency,
|
34
|
+
|
35
|
+
/**
|
36
|
+
* No read skew detection should be attempted. Once the documents are fetched, they will be
|
37
|
+
* returned immediately.
|
38
|
+
*/
|
39
|
+
disable_read_skew_detection,
|
40
|
+
|
41
|
+
/**
|
42
|
+
* Great effort will be made to detect and avoid read skew.
|
43
|
+
*/
|
44
|
+
prioritise_read_skew_detection,
|
45
|
+
};
|
46
|
+
|
47
|
+
} // namespace couchbase::transactions
|
@@ -0,0 +1,44 @@
|
|
1
|
+
/*
|
2
|
+
* Copyright 2021-Present Couchbase, Inc.
|
3
|
+
*
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
* you may not use this file except in compliance with the License.
|
6
|
+
* You may obtain a copy of the License at
|
7
|
+
*
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
*
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
* See the License for the specific language governing permissions and
|
14
|
+
* limitations under the License.
|
15
|
+
*/
|
16
|
+
#pragma once
|
17
|
+
|
18
|
+
#include <couchbase/transactions/transaction_get_multi_mode.hxx>
|
19
|
+
|
20
|
+
namespace couchbase
|
21
|
+
{
|
22
|
+
namespace core::transactions
|
23
|
+
{
|
24
|
+
class attempt_context_impl;
|
25
|
+
} // namespace core::transactions
|
26
|
+
|
27
|
+
namespace transactions
|
28
|
+
{
|
29
|
+
class transaction_get_multi_options
|
30
|
+
{
|
31
|
+
public:
|
32
|
+
auto mode(transaction_get_multi_mode mode) -> transaction_get_multi_options&
|
33
|
+
{
|
34
|
+
mode_ = mode;
|
35
|
+
return *this;
|
36
|
+
}
|
37
|
+
|
38
|
+
private:
|
39
|
+
friend class core::transactions::attempt_context_impl;
|
40
|
+
|
41
|
+
transaction_get_multi_mode mode_{ transaction_get_multi_mode::prioritise_latency };
|
42
|
+
};
|
43
|
+
} // namespace transactions
|
44
|
+
} // namespace couchbase
|
@@ -0,0 +1,46 @@
|
|
1
|
+
/*
|
2
|
+
* Copyright 2021-Present Couchbase, Inc.
|
3
|
+
*
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
* you may not use this file except in compliance with the License.
|
6
|
+
* You may obtain a copy of the License at
|
7
|
+
*
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
*
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
* See the License for the specific language governing permissions and
|
14
|
+
* limitations under the License.
|
15
|
+
*/
|
16
|
+
#pragma once
|
17
|
+
|
18
|
+
#include <cstdint>
|
19
|
+
|
20
|
+
namespace couchbase::transactions
|
21
|
+
{
|
22
|
+
/**
|
23
|
+
* Strategy to deal with potential read skews while reading multiple documents.
|
24
|
+
*
|
25
|
+
* Essentially when a transaction reads document X and then Y, and another
|
26
|
+
* transaction commits a change to Y inbetween those reads - read skew has
|
27
|
+
* occurred.
|
28
|
+
*/
|
29
|
+
enum class transaction_get_multi_replicas_from_preferred_server_group_mode : std::uint8_t {
|
30
|
+
/**
|
31
|
+
* Some time-bounded effort will be made to detect and avoid read skew.
|
32
|
+
*/
|
33
|
+
prioritise_latency,
|
34
|
+
|
35
|
+
/**
|
36
|
+
* No read skew detection should be attempted. Once the documents are fetched, they will be
|
37
|
+
* returned immediately.
|
38
|
+
*/
|
39
|
+
disable_read_skew_detection,
|
40
|
+
|
41
|
+
/**
|
42
|
+
* Great effort will be made to detect and avoid read skew.
|
43
|
+
*/
|
44
|
+
prioritise_read_skew_detection,
|
45
|
+
};
|
46
|
+
} // namespace couchbase::transactions
|
@@ -0,0 +1,48 @@
|
|
1
|
+
/*
|
2
|
+
* Copyright 2021-Present Couchbase, Inc.
|
3
|
+
*
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
* you may not use this file except in compliance with the License.
|
6
|
+
* You may obtain a copy of the License at
|
7
|
+
*
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
*
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
* See the License for the specific language governing permissions and
|
14
|
+
* limitations under the License.
|
15
|
+
*/
|
16
|
+
#pragma once
|
17
|
+
|
18
|
+
#include <couchbase/transactions/transaction_get_multi_replicas_from_preferred_server_group_mode.hxx>
|
19
|
+
|
20
|
+
namespace couchbase
|
21
|
+
{
|
22
|
+
namespace core::transactions
|
23
|
+
{
|
24
|
+
class attempt_context_impl;
|
25
|
+
} // namespace core::transactions
|
26
|
+
|
27
|
+
namespace transactions
|
28
|
+
{
|
29
|
+
class transaction_get_multi_replicas_from_preferred_server_group_options
|
30
|
+
{
|
31
|
+
public:
|
32
|
+
auto mode(transaction_get_multi_replicas_from_preferred_server_group_mode mode)
|
33
|
+
-> transaction_get_multi_replicas_from_preferred_server_group_options&
|
34
|
+
{
|
35
|
+
mode_ = mode;
|
36
|
+
return *this;
|
37
|
+
}
|
38
|
+
|
39
|
+
private:
|
40
|
+
friend class core::transactions::attempt_context_impl;
|
41
|
+
|
42
|
+
transaction_get_multi_replicas_from_preferred_server_group_mode mode_{
|
43
|
+
transaction_get_multi_replicas_from_preferred_server_group_mode::prioritise_latency
|
44
|
+
};
|
45
|
+
};
|
46
|
+
|
47
|
+
} // namespace transactions
|
48
|
+
} // namespace couchbase
|
@@ -0,0 +1,109 @@
|
|
1
|
+
/*
|
2
|
+
* Copyright 2021-Present Couchbase, Inc.
|
3
|
+
*
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
* you may not use this file except in compliance with the License.
|
6
|
+
* You may obtain a copy of the License at
|
7
|
+
*
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
*
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
* See the License for the specific language governing permissions and
|
14
|
+
* limitations under the License.
|
15
|
+
*/
|
16
|
+
#pragma once
|
17
|
+
|
18
|
+
#include "couchbase/error_codes.hxx"
|
19
|
+
#include <couchbase/codec/default_json_transcoder.hxx>
|
20
|
+
|
21
|
+
#include <optional>
|
22
|
+
#include <stdexcept>
|
23
|
+
#include <system_error>
|
24
|
+
#include <vector>
|
25
|
+
|
26
|
+
namespace couchbase
|
27
|
+
{
|
28
|
+
namespace core::transactions
|
29
|
+
{
|
30
|
+
class attempt_context_impl;
|
31
|
+
} // namespace core::transactions
|
32
|
+
|
33
|
+
namespace transactions
|
34
|
+
{
|
35
|
+
class transaction_get_multi_replicas_from_preferred_server_group_result
|
36
|
+
{
|
37
|
+
public:
|
38
|
+
transaction_get_multi_replicas_from_preferred_server_group_result(
|
39
|
+
const transaction_get_multi_replicas_from_preferred_server_group_result&) = default;
|
40
|
+
~transaction_get_multi_replicas_from_preferred_server_group_result() = default;
|
41
|
+
transaction_get_multi_replicas_from_preferred_server_group_result(
|
42
|
+
transaction_get_multi_replicas_from_preferred_server_group_result&&) = default;
|
43
|
+
auto operator=(const transaction_get_multi_replicas_from_preferred_server_group_result&)
|
44
|
+
-> transaction_get_multi_replicas_from_preferred_server_group_result& = default;
|
45
|
+
auto operator=(transaction_get_multi_replicas_from_preferred_server_group_result&&)
|
46
|
+
-> transaction_get_multi_replicas_from_preferred_server_group_result& = default;
|
47
|
+
|
48
|
+
/**
|
49
|
+
* Content of the document.
|
50
|
+
*
|
51
|
+
* @return content of the document.
|
52
|
+
*/
|
53
|
+
template<typename Document,
|
54
|
+
typename Transcoder = codec::default_json_transcoder,
|
55
|
+
std::enable_if_t<!codec::is_transcoder_v<Document>, bool> = true,
|
56
|
+
std::enable_if_t<codec::is_transcoder_v<Transcoder>, bool> = true>
|
57
|
+
[[nodiscard]] auto content_as(std::size_t spec_index) const -> Document
|
58
|
+
{
|
59
|
+
if (spec_index >= content_.size()) {
|
60
|
+
throw std::invalid_argument("spec index " + std::to_string(spec_index) + " is not valid");
|
61
|
+
}
|
62
|
+
if (const auto& content = content_[spec_index]; content.has_value()) {
|
63
|
+
return Transcoder::template decode<Document>(content.value());
|
64
|
+
}
|
65
|
+
throw std::system_error(errc::key_value::document_not_found,
|
66
|
+
"document was not found for index " + std::to_string(spec_index));
|
67
|
+
}
|
68
|
+
|
69
|
+
/**
|
70
|
+
* Content of the document.
|
71
|
+
*
|
72
|
+
* @return content of the document.
|
73
|
+
*/
|
74
|
+
template<typename Transcoder, std::enable_if_t<codec::is_transcoder_v<Transcoder>, bool> = true>
|
75
|
+
[[nodiscard]] auto content_as(std::size_t spec_index) const -> typename Transcoder::document_type
|
76
|
+
{
|
77
|
+
if (spec_index >= content_.size()) {
|
78
|
+
throw std::invalid_argument("spec index " + std::to_string(spec_index) + " is not valid");
|
79
|
+
}
|
80
|
+
if (const auto& content = content_[spec_index]; content.has_value()) {
|
81
|
+
return Transcoder::decode(content.value());
|
82
|
+
}
|
83
|
+
throw std::system_error(errc::key_value::document_not_found,
|
84
|
+
"document was not found for index " + std::to_string(spec_index));
|
85
|
+
}
|
86
|
+
|
87
|
+
/**
|
88
|
+
* Check if spec returned any content
|
89
|
+
*
|
90
|
+
* @return the id of this document.
|
91
|
+
*/
|
92
|
+
[[nodiscard]] auto exists(std::size_t spec_index) const -> bool
|
93
|
+
{
|
94
|
+
return spec_index >= content_.size() && content_[spec_index].has_value();
|
95
|
+
}
|
96
|
+
|
97
|
+
private:
|
98
|
+
friend core::transactions::attempt_context_impl;
|
99
|
+
|
100
|
+
explicit transaction_get_multi_replicas_from_preferred_server_group_result(
|
101
|
+
std::vector<std::optional<codec::encoded_value>> content)
|
102
|
+
: content_{ std::move(content) }
|
103
|
+
{
|
104
|
+
}
|
105
|
+
|
106
|
+
std::vector<std::optional<codec::encoded_value>> content_;
|
107
|
+
};
|
108
|
+
} // namespace transactions
|
109
|
+
} // namespace couchbase
|
@@ -0,0 +1,47 @@
|
|
1
|
+
/*
|
2
|
+
* Copyright 2021-Present Couchbase, Inc.
|
3
|
+
*
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
* you may not use this file except in compliance with the License.
|
6
|
+
* You may obtain a copy of the License at
|
7
|
+
*
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
*
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
* See the License for the specific language governing permissions and
|
14
|
+
* limitations under the License.
|
15
|
+
*/
|
16
|
+
#pragma once
|
17
|
+
|
18
|
+
#include <string>
|
19
|
+
|
20
|
+
namespace couchbase
|
21
|
+
{
|
22
|
+
class collection;
|
23
|
+
namespace core::transactions
|
24
|
+
{
|
25
|
+
class attempt_context_impl;
|
26
|
+
} // namespace core::transactions
|
27
|
+
|
28
|
+
namespace transactions
|
29
|
+
{
|
30
|
+
class transaction_get_multi_replicas_from_preferred_server_group_spec
|
31
|
+
{
|
32
|
+
public:
|
33
|
+
transaction_get_multi_replicas_from_preferred_server_group_spec(
|
34
|
+
const couchbase::collection& collection,
|
35
|
+
std::string id);
|
36
|
+
|
37
|
+
private:
|
38
|
+
friend class core::transactions::attempt_context_impl;
|
39
|
+
|
40
|
+
std::string bucket_;
|
41
|
+
std::string scope_;
|
42
|
+
std::string collection_;
|
43
|
+
std::string id_;
|
44
|
+
};
|
45
|
+
|
46
|
+
} // namespace transactions
|
47
|
+
} // namespace couchbase
|
@@ -0,0 +1,102 @@
|
|
1
|
+
/*
|
2
|
+
* Copyright 2021-Present Couchbase, Inc.
|
3
|
+
*
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
* you may not use this file except in compliance with the License.
|
6
|
+
* You may obtain a copy of the License at
|
7
|
+
*
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
*
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
* See the License for the specific language governing permissions and
|
14
|
+
* limitations under the License.
|
15
|
+
*/
|
16
|
+
#pragma once
|
17
|
+
|
18
|
+
#include <couchbase/codec/default_json_transcoder.hxx>
|
19
|
+
|
20
|
+
#include <optional>
|
21
|
+
#include <vector>
|
22
|
+
|
23
|
+
namespace couchbase
|
24
|
+
{
|
25
|
+
namespace core::transactions
|
26
|
+
{
|
27
|
+
class attempt_context_impl;
|
28
|
+
} // namespace core::transactions
|
29
|
+
|
30
|
+
namespace transactions
|
31
|
+
{
|
32
|
+
class transaction_get_multi_result
|
33
|
+
{
|
34
|
+
public:
|
35
|
+
transaction_get_multi_result() = default;
|
36
|
+
~transaction_get_multi_result() = default;
|
37
|
+
transaction_get_multi_result(const transaction_get_multi_result&) = default;
|
38
|
+
transaction_get_multi_result(transaction_get_multi_result&&) = default;
|
39
|
+
auto operator=(const transaction_get_multi_result&) -> transaction_get_multi_result& = default;
|
40
|
+
auto operator=(transaction_get_multi_result&&) -> transaction_get_multi_result& = default;
|
41
|
+
|
42
|
+
/**
|
43
|
+
* Content of the document.
|
44
|
+
*
|
45
|
+
* @return content of the document.
|
46
|
+
*/
|
47
|
+
template<typename Document,
|
48
|
+
typename Transcoder = codec::default_json_transcoder,
|
49
|
+
std::enable_if_t<!codec::is_transcoder_v<Document>, bool> = true,
|
50
|
+
std::enable_if_t<codec::is_transcoder_v<Transcoder>, bool> = true>
|
51
|
+
[[nodiscard]] auto content_as(std::size_t spec_index) const -> Document
|
52
|
+
{
|
53
|
+
if (spec_index >= content_.size()) {
|
54
|
+
throw std::invalid_argument("spec index " + std::to_string(spec_index) + " is not valid");
|
55
|
+
}
|
56
|
+
if (const auto& content = content_[spec_index]; content.has_value()) {
|
57
|
+
return Transcoder::template decode<Document>(content.value());
|
58
|
+
}
|
59
|
+
throw std::system_error(errc::key_value::document_not_found,
|
60
|
+
"document was not found for index " + std::to_string(spec_index));
|
61
|
+
}
|
62
|
+
|
63
|
+
/**
|
64
|
+
* Content of the document.
|
65
|
+
*
|
66
|
+
* @return content of the document.
|
67
|
+
*/
|
68
|
+
template<typename Transcoder, std::enable_if_t<codec::is_transcoder_v<Transcoder>, bool> = true>
|
69
|
+
[[nodiscard]] auto content_as(std::size_t spec_index) const -> typename Transcoder::document_type
|
70
|
+
{
|
71
|
+
if (spec_index >= content_.size()) {
|
72
|
+
throw std::invalid_argument("spec index " + std::to_string(spec_index) + " is not valid");
|
73
|
+
}
|
74
|
+
if (const auto& content = content_[spec_index]; content.has_value()) {
|
75
|
+
return Transcoder::decode(content_[spec_index]);
|
76
|
+
}
|
77
|
+
throw std::system_error(errc::key_value::document_not_found,
|
78
|
+
"document was not found for index " + std::to_string(spec_index));
|
79
|
+
}
|
80
|
+
|
81
|
+
/**
|
82
|
+
* Check if spec returned any content
|
83
|
+
*
|
84
|
+
* @return the id of this document.
|
85
|
+
*/
|
86
|
+
[[nodiscard]] auto exists(std::size_t spec_index) const -> bool
|
87
|
+
{
|
88
|
+
return spec_index >= content_.size() && content_[spec_index].has_value();
|
89
|
+
}
|
90
|
+
|
91
|
+
private:
|
92
|
+
friend core::transactions::attempt_context_impl;
|
93
|
+
|
94
|
+
explicit transaction_get_multi_result(std::vector<std::optional<codec::encoded_value>> content)
|
95
|
+
: content_{ std::move(content) }
|
96
|
+
{
|
97
|
+
}
|
98
|
+
|
99
|
+
std::vector<std::optional<codec::encoded_value>> content_;
|
100
|
+
};
|
101
|
+
} // namespace transactions
|
102
|
+
} // namespace couchbase
|
@@ -0,0 +1,45 @@
|
|
1
|
+
/*
|
2
|
+
* Copyright 2021-Present Couchbase, Inc.
|
3
|
+
*
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
* you may not use this file except in compliance with the License.
|
6
|
+
* You may obtain a copy of the License at
|
7
|
+
*
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
*
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
* See the License for the specific language governing permissions and
|
14
|
+
* limitations under the License.
|
15
|
+
*/
|
16
|
+
#pragma once
|
17
|
+
|
18
|
+
#include <string>
|
19
|
+
|
20
|
+
namespace couchbase
|
21
|
+
{
|
22
|
+
class collection;
|
23
|
+
namespace core::transactions
|
24
|
+
{
|
25
|
+
class attempt_context_impl;
|
26
|
+
} // namespace core::transactions
|
27
|
+
|
28
|
+
namespace transactions
|
29
|
+
{
|
30
|
+
class transaction_get_multi_spec
|
31
|
+
{
|
32
|
+
public:
|
33
|
+
transaction_get_multi_spec(const couchbase::collection& collection, std::string id);
|
34
|
+
|
35
|
+
private:
|
36
|
+
friend class core::transactions::attempt_context_impl;
|
37
|
+
|
38
|
+
std::string bucket_;
|
39
|
+
std::string scope_;
|
40
|
+
std::string collection_;
|
41
|
+
std::string id_;
|
42
|
+
};
|
43
|
+
|
44
|
+
} // namespace transactions
|
45
|
+
} // namespace couchbase
|
data/ext/extconf.rb
CHANGED
@@ -93,6 +93,12 @@ cmake_flags = [
|
|
93
93
|
"-DCOUCHBASE_CXX_CLIENT_INSTALL=OFF",
|
94
94
|
]
|
95
95
|
|
96
|
+
if version.start_with?("4")
|
97
|
+
# snappy requires CMake 3.1
|
98
|
+
cmake_flags << "-DCMAKE_POLICY_VERSION_MINIMUM=3.5"
|
99
|
+
end
|
100
|
+
|
101
|
+
|
96
102
|
extconf_include = File.expand_path("cache/extconf_include.rb", __dir__)
|
97
103
|
if File.exist?(extconf_include)
|
98
104
|
puts "-- include extra cmake options from #{extconf_include}"
|
data/ext/rcb_buckets.cxx
CHANGED
@@ -232,6 +232,17 @@ cb_generate_bucket_settings(VALUE bucket,
|
|
232
232
|
}
|
233
233
|
}
|
234
234
|
|
235
|
+
if (VALUE num_vbuckets = rb_hash_aref(bucket, rb_id2sym(rb_intern("num_vbuckets")));
|
236
|
+
!NIL_P(num_vbuckets)) {
|
237
|
+
if (TYPE(num_vbuckets) == T_FIXNUM) {
|
238
|
+
entry.num_vbuckets = FIX2UINT(num_vbuckets);
|
239
|
+
} else {
|
240
|
+
throw ruby_exception(
|
241
|
+
rb_eArgError,
|
242
|
+
rb_sprintf("num vbuckets must be an Integer, given %+" PRIsVALUE, num_vbuckets));
|
243
|
+
}
|
244
|
+
}
|
245
|
+
|
235
246
|
if (is_create) {
|
236
247
|
if (VALUE conflict_resolution_type =
|
237
248
|
rb_hash_aref(bucket, rb_id2sym(rb_intern("conflict_resolution_type")));
|
@@ -506,6 +517,18 @@ cb_extract_bucket_settings(const core::management::cluster::bucket_settings& ent
|
|
506
517
|
break;
|
507
518
|
}
|
508
519
|
}
|
520
|
+
switch (entry.storage_backend) {
|
521
|
+
case core::management::cluster::bucket_storage_backend::couchstore:
|
522
|
+
rb_hash_aset(
|
523
|
+
bucket, rb_id2sym(rb_intern("storage_backend")), rb_id2sym(rb_intern("couchstore")));
|
524
|
+
break;
|
525
|
+
case core::management::cluster::bucket_storage_backend::magma:
|
526
|
+
rb_hash_aset(bucket, rb_id2sym(rb_intern("storage_backend")), rb_id2sym(rb_intern("magma")));
|
527
|
+
break;
|
528
|
+
case core::management::cluster::bucket_storage_backend::unknown:
|
529
|
+
rb_hash_aset(bucket, rb_id2sym(rb_intern("storage_backend")), Qnil);
|
530
|
+
break;
|
531
|
+
}
|
509
532
|
if (entry.history_retention_collection_default.has_value()) {
|
510
533
|
rb_hash_aset(bucket,
|
511
534
|
rb_id2sym(rb_intern("history_retention_collection_default")),
|
@@ -518,6 +541,9 @@ cb_extract_bucket_settings(const core::management::cluster::bucket_settings& ent
|
|
518
541
|
rb_hash_aset(
|
519
542
|
bucket, rb_id2sym(rb_intern("history_retention_duration")), ULONG2NUM(val.value()));
|
520
543
|
}
|
544
|
+
if (const auto& val = entry.num_vbuckets; val.has_value()) {
|
545
|
+
rb_hash_aset(bucket, rb_id2sym(rb_intern("num_vbuckets")), USHORT2NUM(val.value()));
|
546
|
+
}
|
521
547
|
|
522
548
|
VALUE capabilities = rb_ary_new_capa(static_cast<long>(entry.capabilities.size()));
|
523
549
|
for (const auto& capa : entry.capabilities) {
|
data/lib/couchbase/cluster.rb
CHANGED
data/lib/couchbase/collection.rb
CHANGED
@@ -381,7 +381,7 @@ module Couchbase
|
|
381
381
|
yield ScanResult.new(
|
382
382
|
id: resp[:id],
|
383
383
|
id_only: resp[:id_only],
|
384
|
-
transcoder: @transcoder
|
384
|
+
transcoder: @transcoder,
|
385
385
|
)
|
386
386
|
else
|
387
387
|
yield ScanResult.new(
|
@@ -391,7 +391,7 @@ module Couchbase
|
|
391
391
|
expiry: resp[:expiry],
|
392
392
|
encoded: resp[:encoded],
|
393
393
|
flags: resp[:flags],
|
394
|
-
transcoder: @transcoder
|
394
|
+
transcoder: @transcoder,
|
395
395
|
)
|
396
396
|
end
|
397
397
|
end
|
@@ -846,7 +846,7 @@ module Couchbase
|
|
846
846
|
entry[:access_key_id],
|
847
847
|
nil,
|
848
848
|
entry[:region],
|
849
|
-
service_endpoint: entry[:service_endpoint]
|
849
|
+
service_endpoint: entry[:service_endpoint],
|
850
850
|
)
|
851
851
|
when :couchbase
|
852
852
|
CouchbaseRemoteAnalyticsLink.new(
|
@@ -857,8 +857,8 @@ module Couchbase
|
|
857
857
|
encryption: EncryptionSettings.new(
|
858
858
|
level: entry[:encryption_level],
|
859
859
|
certificate: entry[:certificate],
|
860
|
-
client_certificate: entry[:client_certificate]
|
861
|
-
)
|
860
|
+
client_certificate: entry[:client_certificate],
|
861
|
+
),
|
862
862
|
)
|
863
863
|
when :azureblob
|
864
864
|
AzureBlobExternalAnalyticsLink.new(
|
@@ -866,7 +866,7 @@ module Couchbase
|
|
866
866
|
entry[:dataverse],
|
867
867
|
account_name: entry[:account_name],
|
868
868
|
blob_endpoint: entry[:blob_endpoint],
|
869
|
-
endpoint_suffix: entry[:endpoint_suffix]
|
869
|
+
endpoint_suffix: entry[:endpoint_suffix],
|
870
870
|
)
|
871
871
|
end
|
872
872
|
end
|
@@ -206,7 +206,6 @@ module Couchbase
|
|
206
206
|
def create_bucket(settings, options = Options::Bucket::CreateBucket.new)
|
207
207
|
@backend.bucket_create(
|
208
208
|
{
|
209
|
-
|
210
209
|
name: settings.name,
|
211
210
|
flush_enabled: settings.flush_enabled,
|
212
211
|
ram_quota_mb: settings.ram_quota_mb,
|
@@ -222,6 +221,7 @@ module Couchbase
|
|
222
221
|
history_retention_collection_default: settings.history_retention_collection_default,
|
223
222
|
history_retention_duration: settings.history_retention_duration,
|
224
223
|
history_retention_bytes: settings.history_retention_bytes,
|
224
|
+
num_vbuckets: settings.num_vbuckets,
|
225
225
|
}, options.to_backend
|
226
226
|
)
|
227
227
|
end
|
@@ -252,6 +252,7 @@ module Couchbase
|
|
252
252
|
history_retention_collection_default: settings.history_retention_collection_default,
|
253
253
|
history_retention_bytes: settings.history_retention_bytes,
|
254
254
|
history_retention_duration: settings.history_retention_duration,
|
255
|
+
num_vbuckets: settings.num_vbuckets,
|
255
256
|
}, options.to_backend
|
256
257
|
)
|
257
258
|
end
|
@@ -342,9 +343,11 @@ module Couchbase
|
|
342
343
|
bucket.minimum_durability_level = entry[:minimum_durability_level]
|
343
344
|
bucket.compression_mode = entry[:compression_mode]
|
344
345
|
bucket.instance_variable_set(:@healthy, entry[:nodes].all? { |node| node[:status] == "healthy" })
|
346
|
+
bucket.storage_backend = entry[:storage_backend]
|
345
347
|
bucket.history_retention_collection_default = entry[:history_retention_collection_default]
|
346
348
|
bucket.history_retention_bytes = entry[:history_retention_bytes]
|
347
349
|
bucket.history_retention_duration = entry[:history_retention_duration]
|
350
|
+
bucket.num_vbuckets = entry[:num_vbuckets]
|
348
351
|
end
|
349
352
|
end
|
350
353
|
end
|
@@ -405,7 +408,7 @@ module Couchbase
|
|
405
408
|
# @return [nil, :none, :majority, :majority_and_persist_to_active, :persist_to_majority] the minimum durability level
|
406
409
|
attr_accessor :minimum_durability_level
|
407
410
|
|
408
|
-
# @return [Boolean, nil] whether to enable history retention on collections
|
411
|
+
# @return [Boolean, nil] whether to enable history retention on collections by default
|
409
412
|
attr_accessor :history_retention_collection_default
|
410
413
|
|
411
414
|
# @return [Integer, nil] the maximum size, in bytes, of the change history that is written to disk for all
|
@@ -416,6 +419,9 @@ module Couchbase
|
|
416
419
|
# collections in this bucket
|
417
420
|
attr_accessor :history_retention_duration
|
418
421
|
|
422
|
+
# @return [Integer, nil] the number of vBuckets the bucket should have. If not set, the server default will be used
|
423
|
+
attr_accessor :num_vbuckets
|
424
|
+
|
419
425
|
# @api private
|
420
426
|
# @return [Boolean] false if status of the bucket is not healthy
|
421
427
|
def healthy?
|