couchbase 3.4.1-arm64-darwin-20 → 3.4.3-arm64-darwin-20
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/lib/couchbase/authenticator.rb +0 -1
- data/lib/couchbase/cluster.rb +13 -13
- data/lib/couchbase/cluster_registry.rb +7 -2
- data/lib/couchbase/config_profiles.rb +1 -1
- data/lib/couchbase/configuration.rb +3 -4
- data/lib/couchbase/json_transcoder.rb +12 -5
- data/lib/couchbase/libcouchbase.bundle +0 -0
- data/lib/couchbase/management/collection_query_index_manager.rb +54 -15
- data/lib/couchbase/management/query_index_manager.rb +70 -5
- data/lib/couchbase/options.rb +85 -2
- data/lib/couchbase/raw_binary_transcoder.rb +37 -0
- data/lib/couchbase/raw_json_transcoder.rb +38 -0
- data/lib/couchbase/raw_string_transcoder.rb +40 -0
- data/lib/couchbase/search_options.rb +163 -240
- data/lib/couchbase/transcoder_flags.rb +62 -0
- data/lib/couchbase/version.rb +1 -1
- metadata +10 -6
data/lib/couchbase/options.rb
CHANGED
@@ -1029,10 +1029,38 @@ module Couchbase
|
|
1029
1029
|
# Options for {BinaryCollection#append}
|
1030
1030
|
class Append < Base
|
1031
1031
|
attr_accessor :cas # @return [Integer]
|
1032
|
+
attr_accessor :durability_level # @return [Symbol]
|
1033
|
+
attr_accessor :replicate_to # @return [Symbol]
|
1034
|
+
attr_accessor :persist_to # @return [Symbol]
|
1032
1035
|
|
1033
1036
|
# Creates an instance of options for {BinaryCollection#append}
|
1034
1037
|
#
|
1035
1038
|
# @param [Integer] cas The default CAS used (0 means no CAS in this context)
|
1039
|
+
# @param [Symbol] durability_level level of durability
|
1040
|
+
# +:none+::
|
1041
|
+
# no enhanced durability required for the mutation
|
1042
|
+
# +:majority+::
|
1043
|
+
# the mutation must be replicated to a majority of the Data Service nodes
|
1044
|
+
# (that is, held in the memory allocated to the bucket)
|
1045
|
+
# +:majority_and_persist_to_active+::
|
1046
|
+
# The mutation must be replicated to a majority of the Data Service nodes.
|
1047
|
+
# Additionally, it must be persisted (that is, written and synchronised to disk) on the
|
1048
|
+
# node hosting the active partition (vBucket) for the data.
|
1049
|
+
# +:persist_to_majority+::
|
1050
|
+
# The mutation must be persisted to a majority of the Data Service nodes.
|
1051
|
+
# Accordingly, it will be written to disk on those nodes.
|
1052
|
+
# @param [Symbol] replicate_to number of nodes to replicate
|
1053
|
+
# +:none+:: do not apply any replication requirements.
|
1054
|
+
# +:one+:: wait for replication to at least one node.
|
1055
|
+
# +:two+:: wait for replication to at least two nodes.
|
1056
|
+
# +:three+:: wait for replication to at least three nodes.
|
1057
|
+
# @param [Symbol] persist_to number of nodes to persist
|
1058
|
+
# +:none+:: do not apply any persistence requirements.
|
1059
|
+
# +:active+:: wait for persistence to active node
|
1060
|
+
# +:one+:: wait for persistence to at least one node.
|
1061
|
+
# +:two+:: wait for persistence to at least two nodes.
|
1062
|
+
# +:three+:: wait for persistence to at least three nodes.
|
1063
|
+
# +:four+:: wait for persistence to four nodes (active and replicas).
|
1036
1064
|
#
|
1037
1065
|
# @param [Integer, #in_milliseconds, nil] timeout
|
1038
1066
|
# @param [Proc, nil] retry_strategy the custom retry strategy, if set
|
@@ -1041,12 +1069,23 @@ module Couchbase
|
|
1041
1069
|
#
|
1042
1070
|
# @yieldparam [Append] self
|
1043
1071
|
def initialize(cas: nil,
|
1072
|
+
durability_level: :none,
|
1073
|
+
replicate_to: :none,
|
1074
|
+
persist_to: :none,
|
1044
1075
|
timeout: nil,
|
1045
1076
|
retry_strategy: nil,
|
1046
1077
|
client_context: nil,
|
1047
1078
|
parent_span: nil)
|
1048
1079
|
super(timeout: timeout, retry_strategy: retry_strategy, client_context: client_context, parent_span: parent_span)
|
1049
1080
|
@cas = cas
|
1081
|
+
|
1082
|
+
if durability_level != :none && (replicate_to != :none || persist_to != :none)
|
1083
|
+
raise ArgumentError, "durability_level conflicts with replicate_to and persist_to options"
|
1084
|
+
end
|
1085
|
+
|
1086
|
+
@durability_level = durability_level
|
1087
|
+
@replicate_to = replicate_to
|
1088
|
+
@persist_to = persist_to
|
1050
1089
|
yield self if block_given?
|
1051
1090
|
end
|
1052
1091
|
|
@@ -1055,6 +1094,9 @@ module Couchbase
|
|
1055
1094
|
{
|
1056
1095
|
timeout: Utils::Time.extract_duration(@timeout),
|
1057
1096
|
cas: @cas,
|
1097
|
+
durability_level: @durability_level,
|
1098
|
+
persist_to: @persist_to,
|
1099
|
+
replicate_to: @replicate_to,
|
1058
1100
|
}
|
1059
1101
|
end
|
1060
1102
|
|
@@ -1064,12 +1106,39 @@ module Couchbase
|
|
1064
1106
|
|
1065
1107
|
# Options for {BinaryCollection#prepend}
|
1066
1108
|
class Prepend < Base
|
1067
|
-
# @return [Integer]
|
1068
|
-
attr_accessor :
|
1109
|
+
attr_accessor :cas # @return [Integer]
|
1110
|
+
attr_accessor :durability_level # @return [Symbol]
|
1111
|
+
attr_accessor :replicate_to # @return [Symbol]
|
1112
|
+
attr_accessor :persist_to # @return [Symbol]
|
1069
1113
|
|
1070
1114
|
# Creates an instance of options for {BinaryCollection#prepend}
|
1071
1115
|
#
|
1072
1116
|
# @param [Integer] cas The default CAS used (0 means no CAS in this context)
|
1117
|
+
# @param [Symbol] durability_level level of durability
|
1118
|
+
# +:none+::
|
1119
|
+
# no enhanced durability required for the mutation
|
1120
|
+
# +:majority+::
|
1121
|
+
# the mutation must be replicated to a majority of the Data Service nodes
|
1122
|
+
# (that is, held in the memory allocated to the bucket)
|
1123
|
+
# +:majority_and_persist_to_active+::
|
1124
|
+
# The mutation must be replicated to a majority of the Data Service nodes.
|
1125
|
+
# Additionally, it must be persisted (that is, written and synchronised to disk) on the
|
1126
|
+
# node hosting the active partition (vBucket) for the data.
|
1127
|
+
# +:persist_to_majority+::
|
1128
|
+
# The mutation must be persisted to a majority of the Data Service nodes.
|
1129
|
+
# Accordingly, it will be written to disk on those nodes.
|
1130
|
+
# @param [Symbol] replicate_to number of nodes to replicate
|
1131
|
+
# +:none+:: do not apply any replication requirements.
|
1132
|
+
# +:one+:: wait for replication to at least one node.
|
1133
|
+
# +:two+:: wait for replication to at least two nodes.
|
1134
|
+
# +:three+:: wait for replication to at least three nodes.
|
1135
|
+
# @param [Symbol] persist_to number of nodes to persist
|
1136
|
+
# +:none+:: do not apply any persistence requirements.
|
1137
|
+
# +:active+:: wait for persistence to active node
|
1138
|
+
# +:one+:: wait for persistence to at least one node.
|
1139
|
+
# +:two+:: wait for persistence to at least two nodes.
|
1140
|
+
# +:three+:: wait for persistence to at least three nodes.
|
1141
|
+
# +:four+:: wait for persistence to four nodes (active and replicas).
|
1073
1142
|
#
|
1074
1143
|
# @param [Integer, #in_milliseconds, nil] timeout
|
1075
1144
|
# @param [Proc, nil] retry_strategy the custom retry strategy, if set
|
@@ -1078,12 +1147,23 @@ module Couchbase
|
|
1078
1147
|
#
|
1079
1148
|
# @yieldparam [Prepend] self
|
1080
1149
|
def initialize(cas: nil,
|
1150
|
+
durability_level: :none,
|
1151
|
+
replicate_to: :none,
|
1152
|
+
persist_to: :none,
|
1081
1153
|
timeout: nil,
|
1082
1154
|
retry_strategy: nil,
|
1083
1155
|
client_context: nil,
|
1084
1156
|
parent_span: nil)
|
1085
1157
|
super(timeout: timeout, retry_strategy: retry_strategy, client_context: client_context, parent_span: parent_span)
|
1086
1158
|
@cas = cas
|
1159
|
+
|
1160
|
+
if durability_level != :none && (replicate_to != :none || persist_to != :none)
|
1161
|
+
raise ArgumentError, "durability_level conflicts with replicate_to and persist_to options"
|
1162
|
+
end
|
1163
|
+
|
1164
|
+
@durability_level = durability_level
|
1165
|
+
@replicate_to = replicate_to
|
1166
|
+
@persist_to = persist_to
|
1087
1167
|
yield self if block_given?
|
1088
1168
|
end
|
1089
1169
|
|
@@ -1092,6 +1172,9 @@ module Couchbase
|
|
1092
1172
|
{
|
1093
1173
|
timeout: Utils::Time.extract_duration(@timeout),
|
1094
1174
|
cas: @cas,
|
1175
|
+
durability_level: @durability_level,
|
1176
|
+
persist_to: @persist_to,
|
1177
|
+
replicate_to: @replicate_to,
|
1095
1178
|
}
|
1096
1179
|
end
|
1097
1180
|
|
@@ -0,0 +1,37 @@
|
|
1
|
+
# Copyright 2023. Couchbase, Inc.
|
2
|
+
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
# you may not use this file except in compliance with the License.
|
5
|
+
# You may obtain a copy of the License at
|
6
|
+
#
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
#
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
# See the License for the specific language governing permissions and
|
13
|
+
# limitations under the License.
|
14
|
+
|
15
|
+
require "couchbase/transcoder_flags"
|
16
|
+
|
17
|
+
module Couchbase
|
18
|
+
class RawBinaryTranscoder
|
19
|
+
# @param [String] document
|
20
|
+
# @return [Array<String, Integer>] pair of encoded document and flags
|
21
|
+
def encode(document)
|
22
|
+
raise Error::EncodingFailure, "Only binary data supported by RawBinaryTranscoder" unless document.is_a?(String)
|
23
|
+
|
24
|
+
[document, TranscoderFlags.new(format: :binary).encode]
|
25
|
+
end
|
26
|
+
|
27
|
+
# @param [String] blob string of bytes, containing encoded representation of the document
|
28
|
+
# @param [Integer] flags bit field, describing how the data encoded
|
29
|
+
# @return [String] decoded document
|
30
|
+
def decode(blob, flags)
|
31
|
+
format = TranscoderFlags.decode(flags).format
|
32
|
+
raise Error::DecodingFailure, "Unable to decode #{format} with the RawBinaryTranscoder" unless format == :binary || format.nil?
|
33
|
+
|
34
|
+
blob
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
# Copyright 2023. Couchbase, Inc.
|
2
|
+
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
# you may not use this file except in compliance with the License.
|
5
|
+
# You may obtain a copy of the License at
|
6
|
+
#
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
#
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
# See the License for the specific language governing permissions and
|
13
|
+
# limitations under the License.
|
14
|
+
|
15
|
+
require "couchbase/transcoder_flags"
|
16
|
+
require "couchbase/errors"
|
17
|
+
|
18
|
+
module Couchbase
|
19
|
+
class RawJsonTranscoder
|
20
|
+
# @param [String] document
|
21
|
+
# @return [Array<String, Integer>] pair of encoded document and flags
|
22
|
+
def encode(document)
|
23
|
+
raise Error::EncodingFailure, "Only String and binary data supported by RawJsonTranscoder" unless document.is_a?(String)
|
24
|
+
|
25
|
+
[document, TranscoderFlags.new(format: :json).encode]
|
26
|
+
end
|
27
|
+
|
28
|
+
# @param [String] blob string of bytes, containing encoded representation of the document
|
29
|
+
# @param [Integer] flags bit field, describing how the data encoded
|
30
|
+
# @return [String] decoded document
|
31
|
+
def decode(blob, flags)
|
32
|
+
format = TranscoderFlags.decode(flags).format
|
33
|
+
raise Error::DecodingFailure, "Unable to decode #{format} with the RawJsonTranscoder" unless format == :json || format.nil?
|
34
|
+
|
35
|
+
blob
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# Copyright 2023. Couchbase, Inc.
|
2
|
+
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
# you may not use this file except in compliance with the License.
|
5
|
+
# You may obtain a copy of the License at
|
6
|
+
#
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
#
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
# See the License for the specific language governing permissions and
|
13
|
+
# limitations under the License.
|
14
|
+
|
15
|
+
require "couchbase/transcoder_flags"
|
16
|
+
require "couchbase/errors"
|
17
|
+
|
18
|
+
module Couchbase
|
19
|
+
class RawStringTranscoder
|
20
|
+
# @param [String] document
|
21
|
+
# @return [Array<String, Integer>] pair of encoded document and flags
|
22
|
+
def encode(document)
|
23
|
+
unless document.is_a?(String) && document.valid_encoding?
|
24
|
+
raise Error::EncodingFailure, "Only String data supported by RawStringTranscoder"
|
25
|
+
end
|
26
|
+
|
27
|
+
[document, TranscoderFlags.new(format: :string).encode]
|
28
|
+
end
|
29
|
+
|
30
|
+
# @param [String] blob string of bytes, containing encoded representation of the document
|
31
|
+
# @param [Integer] flags bit field, describing how the data encoded
|
32
|
+
# @return [String] decoded document
|
33
|
+
def decode(blob, flags)
|
34
|
+
format = TranscoderFlags.decode(flags).format
|
35
|
+
raise Error::DecodingFailure, "Unable to decode #{format} with the RawStringTranscoder" unless format == :string || format.nil?
|
36
|
+
|
37
|
+
blob
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|