couchbase 3.5.1-x86_64-linux-musl → 3.5.2-x86_64-linux-musl

Sign up to get free protection for your applications and to get access to all the features.
Files changed (57) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -1
  3. data/lib/active_support/cache/couchbase_store.rb +4 -1
  4. data/lib/couchbase/3.1/libcouchbase.so +0 -0
  5. data/lib/couchbase/3.2/libcouchbase.so +0 -0
  6. data/lib/couchbase/3.3/libcouchbase.so +0 -0
  7. data/lib/couchbase/analytics_options.rb +2 -0
  8. data/lib/couchbase/authenticator.rb +2 -0
  9. data/lib/couchbase/binary_collection.rb +2 -0
  10. data/lib/couchbase/binary_collection_options.rb +2 -0
  11. data/lib/couchbase/bucket.rb +2 -0
  12. data/lib/couchbase/cluster.rb +2 -0
  13. data/lib/couchbase/collection.rb +3 -1
  14. data/lib/couchbase/collection_options.rb +2 -0
  15. data/lib/couchbase/config_profiles.rb +2 -0
  16. data/lib/couchbase/configuration.rb +2 -0
  17. data/lib/couchbase/datastructures/couchbase_list.rb +4 -4
  18. data/lib/couchbase/datastructures/couchbase_map.rb +4 -4
  19. data/lib/couchbase/datastructures/couchbase_queue.rb +4 -4
  20. data/lib/couchbase/datastructures/couchbase_set.rb +4 -4
  21. data/lib/couchbase/datastructures.rb +2 -0
  22. data/lib/couchbase/diagnostics.rb +2 -0
  23. data/lib/couchbase/errors.rb +46 -8
  24. data/lib/couchbase/json_transcoder.rb +2 -0
  25. data/lib/couchbase/key_value_scan.rb +2 -0
  26. data/lib/couchbase/logger.rb +2 -0
  27. data/lib/couchbase/management/analytics_index_manager.rb +2 -0
  28. data/lib/couchbase/management/bucket_manager.rb +2 -0
  29. data/lib/couchbase/management/collection_manager.rb +2 -0
  30. data/lib/couchbase/management/collection_query_index_manager.rb +2 -0
  31. data/lib/couchbase/management/query_index_manager.rb +2 -0
  32. data/lib/couchbase/management/scope_search_index_manager.rb +2 -0
  33. data/lib/couchbase/management/search_index_manager.rb +2 -0
  34. data/lib/couchbase/management/user_manager.rb +2 -0
  35. data/lib/couchbase/management/view_index_manager.rb +2 -0
  36. data/lib/couchbase/management.rb +2 -0
  37. data/lib/couchbase/mutation_state.rb +2 -0
  38. data/lib/couchbase/options.rb +2 -0
  39. data/lib/couchbase/protostellar/request_generator/kv.rb +1 -1
  40. data/lib/couchbase/query_options.rb +2 -0
  41. data/lib/couchbase/railtie.rb +2 -0
  42. data/lib/couchbase/raw_binary_transcoder.rb +2 -0
  43. data/lib/couchbase/raw_json_transcoder.rb +2 -0
  44. data/lib/couchbase/raw_string_transcoder.rb +2 -0
  45. data/lib/couchbase/scope.rb +2 -0
  46. data/lib/couchbase/search_options.rb +91 -63
  47. data/lib/couchbase/subdoc.rb +5 -3
  48. data/lib/couchbase/transcoder_flags.rb +2 -0
  49. data/lib/couchbase/utils/generic_logger_adapter.rb +3 -1
  50. data/lib/couchbase/utils/stdlib_logger_adapter.rb +2 -0
  51. data/lib/couchbase/utils/time.rb +3 -1
  52. data/lib/couchbase/utils.rb +2 -0
  53. data/lib/couchbase/version.rb +3 -1
  54. data/lib/couchbase/view_options.rb +2 -0
  55. data/lib/couchbase.rb +2 -0
  56. data/lib/rails/generators/couchbase/config/config_generator.rb +2 -0
  57. metadata +6 -6
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b0c7e86b2aa5b6d298306f0a42cf0717d7e6da5a79057142ddda2b83ca7154b7
4
- data.tar.gz: d52b0517164cf05707b40c91278ba63f6b77a2a8b94b26e5ea7ce1ca1d9022fd
3
+ metadata.gz: 768b17f0b217f875026f77a85d6b5939de06e7b424335f3f2e563725cc8af6c8
4
+ data.tar.gz: 80a1760b1d60b7917c3b9e935b7e04264be374955ab2df5335fdc2c36136ef42
5
5
  SHA512:
6
- metadata.gz: a0da1493c068891cd37905687075eeaca8f94de7ec59ce372c5fde430aaec00d06b946dc102582b87730996adc7e1dbdafae8fe6555b34f8eb029cbc671d8a40
7
- data.tar.gz: 59aecb87523f711c0ec17c7ecbd50512c800bd0ee7e3fd96b781dbc7e711d7dd3240664bc9b16f676339342eb344f59ce68cae8c2b98c690d7547926fbc37a03
6
+ metadata.gz: 624f8fcdaa090c9fa870f0f673eb66cdadff326b2827f17d3fa1d0ed9bc92c801a01d35cf84ce120a2ab1238635b5ba63c15f4bacbab8f3d6eeb92e40840029a
7
+ data.tar.gz: 6b74b4309b9eee172f1a669a5ce30fc5762ec8ad16138df12dc97729fcff86533912df35c5bef483053dcf152a72c31cd51a63facbd508299a93d70fb6af6d0e
data/README.md CHANGED
@@ -23,7 +23,7 @@ The library has been tested with MRI 3.0, 3.1, 3.2 and 3.3. Supported platforms
23
23
  Add this line to your application's Gemfile:
24
24
 
25
25
  ```ruby
26
- gem "couchbase", "3.5.1"
26
+ gem "couchbase", "3.5.2"
27
27
  ```
28
28
 
29
29
  And then execute:
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Copyright 2020-2021 Couchbase, Inc.
2
4
  #
3
5
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -106,7 +108,8 @@ module ActiveSupport
106
108
  operation_options = ::Couchbase::Options::Query(named_parameters: {"pattern" => pattern}, metrics: true)
107
109
  operation_options.consistent_with(::Couchbase::MutationState.new(@last_mutation_token)) if @last_mutation_token
108
110
  begin
109
- result = cluster.query("DELETE FROM #{scope_qualifier} cache WHERE REGEXP_MATCHES(META(cache).id, $pattern)", operation_options)
111
+ result = cluster.query("DELETE FROM #{scope_qualifier} cache_store_ WHERE REGEXP_MATCHES(META(cache_store_).id, $pattern)",
112
+ operation_options)
110
113
  result.meta_data.metrics.mutation_count
111
114
  rescue ::Couchbase::Error::ParsingFailure, ::Couchbase::Error::ServiceNotAvailable
112
115
  raise NotImplementedError, "The server does not support delete_matched operation"
Binary file
Binary file
Binary file
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Copyright 2020-2021 Couchbase, Inc.
2
4
  #
3
5
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Copyright 2020-2021 Couchbase, Inc.
2
4
  #
3
5
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Copyright 2020-2021 Couchbase, Inc.
2
4
  #
3
5
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Copyright 2020-2021 Couchbase, Inc.
2
4
  #
3
5
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Copyright 2020-2021 Couchbase, Inc.
2
4
  #
3
5
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Copyright 2020-2021 Couchbase, Inc.
2
4
  #
3
5
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Copyright 2020-2021 Couchbase, Inc.
2
4
  #
3
5
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -136,7 +138,7 @@ module Couchbase
136
138
  # @return [GetResult]
137
139
  def get_and_lock(id, lock_time, options = Options::GetAndLock::DEFAULT)
138
140
  resp = @backend.document_get_and_lock(bucket_name, @scope_name, @name, id,
139
- lock_time.respond_to?(:in_seconds) ? lock_time.public_send(:in_seconds) : lock_time,
141
+ lock_time.respond_to?(:in_seconds) ? lock_time.in_seconds : lock_time,
140
142
  options.to_backend)
141
143
  GetResult.new do |res|
142
144
  res.transcoder = options.transcoder
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Copyright 2020-2021 Couchbase, Inc.
2
4
  #
3
5
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Copyright 2020-2022 Couchbase, Inc.
2
4
  #
3
5
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Copyright 2020-2021 Couchbase, Inc.
2
4
  #
3
5
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Copyright 2020-2021 Couchbase, Inc.
2
4
  #
3
5
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -42,7 +44,7 @@ module Couchbase
42
44
  # @yieldparam [Object] item
43
45
  #
44
46
  # @return [CouchbaseList, Enumerable]
45
- def each
47
+ def each(&)
46
48
  if block_given?
47
49
  begin
48
50
  result = @collection.get(@id, @options.get_options)
@@ -52,9 +54,7 @@ module Couchbase
52
54
  current = []
53
55
  @cas = 0
54
56
  end
55
- current.each do |entry|
56
- yield entry
57
- end
57
+ current.each(&)
58
58
  self
59
59
  else
60
60
  enum_for(:each)
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Copyright 2020-2021 Couchbase, Inc.
2
4
  #
3
5
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -42,7 +44,7 @@ module Couchbase
42
44
  # @yieldparam [Object] item
43
45
  #
44
46
  # @return [CouchbaseMap, Enumerable]
45
- def each
47
+ def each(&)
46
48
  if block_given?
47
49
  begin
48
50
  result = @collection.get(@id, @options.get_options)
@@ -52,9 +54,7 @@ module Couchbase
52
54
  current = []
53
55
  @cas = 0
54
56
  end
55
- current.each do |key, value|
56
- yield key, value
57
- end
57
+ current.each(&)
58
58
  self
59
59
  else
60
60
  enum_for(:each)
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Copyright 2020-2021 Couchbase, Inc.
2
4
  #
3
5
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -42,7 +44,7 @@ module Couchbase
42
44
  # @yieldparam [Object] item
43
45
  #
44
46
  # @return [CouchbaseQueue, Enumerable]
45
- def each
47
+ def each(&)
46
48
  if block_given?
47
49
  begin
48
50
  result = @collection.get(@id, @options.get_options)
@@ -52,9 +54,7 @@ module Couchbase
52
54
  current = []
53
55
  @cas = 0
54
56
  end
55
- current.each do |entry|
56
- yield entry
57
- end
57
+ current.each(&)
58
58
  self
59
59
  else
60
60
  enum_for(:each)
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Copyright 2020-2021 Couchbase, Inc.
2
4
  #
3
5
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -42,7 +44,7 @@ module Couchbase
42
44
  # @yieldparam [Object] item
43
45
  #
44
46
  # @return [CouchbaseSet, Enumerable]
45
- def each
47
+ def each(&)
46
48
  if block_given?
47
49
  begin
48
50
  result = @collection.get(@id, @options.get_options)
@@ -52,9 +54,7 @@ module Couchbase
52
54
  current = []
53
55
  @cas = 0
54
56
  end
55
- current.each do |entry|
56
- yield entry
57
- end
57
+ current.each(&)
58
58
  self
59
59
  else
60
60
  enum_for(:each)
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Copyright 2020-2021 Couchbase, Inc.
2
4
  #
3
5
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Copyright 2020-2021 Couchbase, Inc.
2
4
  #
3
5
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Copyright 2020-2023 Couchbase, Inc.
2
4
  #
3
5
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -18,30 +20,66 @@ module Couchbase
18
20
  # This namespace contains all error types that the library might raise.
19
21
  module Error
20
22
  class CouchbaseError < StandardError
21
- # @return [Hash] attributes associated with the error
23
+ # @return [Hash, nil] attributes associated with the error
22
24
  attr_reader :context
23
25
 
24
- def initialize(msg = nil, context = nil)
25
- @context = context unless context.nil?
26
+ # @return [CouchbaseError, nil] original error that caused this one
27
+ attr_reader :cause
28
+
29
+ def initialize(msg = nil, context = nil, cause = nil)
30
+ @context = context
31
+ @cause = cause
26
32
  super(msg)
27
33
  end
28
34
 
35
+ def context=(context)
36
+ return unless context.is_a?(String)
37
+
38
+ @context =
39
+ begin
40
+ JSON.parse(context)
41
+ rescue StandardError
42
+ context
43
+ end
44
+ end
45
+
29
46
  def to_s
30
- defined?(@context) ? "#{super}, context=#{JSON.generate(@context)}" : super
47
+ result = super
48
+ result << ", context=#{JSON.generate(@context)}" if @context
49
+ result << ", cause=#{@cause}" if @cause
50
+ result
31
51
  end
32
52
  end
33
53
 
34
54
  class InvalidArgument < ArgumentError
35
- # @return [Hash] attributes associated with the error
55
+ # @return [Hash, nil] attributes associated with the error
36
56
  attr_reader :context
37
57
 
38
- def initialize(msg = nil, context = nil)
39
- @context = context unless context.nil?
58
+ # @return [CouchbaseError, nil] original error that caused this one
59
+ attr_reader :cause
60
+
61
+ def initialize(msg = nil, context = nil, cause = nil)
62
+ @context = context
63
+ @cause = cause
40
64
  super(msg)
41
65
  end
42
66
 
67
+ def context=(context)
68
+ return unless context.is_a?(String)
69
+
70
+ @context =
71
+ begin
72
+ JSON.parse(context)
73
+ rescue StandardError
74
+ context
75
+ end
76
+ end
77
+
43
78
  def to_s
44
- defined?(@context) ? "#{super}, context=#{JSON.generate(@context)}" : super
79
+ result = super
80
+ result << ", context=#{JSON.generate(@context)}" if @context
81
+ result << ", cause=#{@cause}" if @cause
82
+ result
45
83
  end
46
84
  end
47
85
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Copyright 2020-2021 Couchbase, Inc.
2
4
  #
3
5
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Copyright 2023. Couchbase, Inc.
2
4
  #
3
5
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Copyright 2020-Present Couchbase, Inc.
2
4
  #
3
5
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Copyright 2020-2021 Couchbase, Inc.
2
4
  #
3
5
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Copyright 2020-2021 Couchbase, Inc.
2
4
  #
3
5
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Copyright 2020-2021 Couchbase, Inc.
2
4
  #
3
5
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Copyright 2023 Couchbase, Inc.
2
4
  #
3
5
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Copyright 2020-2021 Couchbase, Inc.
2
4
  #
3
5
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Copyright 2024. Couchbase, Inc.
2
4
  #
3
5
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Copyright 2020-2021 Couchbase, Inc.
2
4
  #
3
5
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Copyright 2020-2021 Couchbase, Inc.
2
4
  #
3
5
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Copyright 2020-2021 Couchbase, Inc.
2
4
  #
3
5
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Copyright 2020-2021 Couchbase, Inc.
2
4
  #
3
5
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Copyright 2020-2021 Couchbase, Inc.
2
4
  #
3
5
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Copyright 2020-2021 Couchbase, Inc.
2
4
  #
3
5
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -110,7 +110,7 @@ module Couchbase
110
110
  proto_req = Generated::KV::V1::GetAndLockRequest.new(
111
111
  **location,
112
112
  key: id,
113
- lock_time: lock_time.respond_to?(:in_seconds) ? lock_time.public_send(:in_seconds) : lock_time
113
+ lock_time: lock_time.respond_to?(:in_seconds) ? lock_time.in_seconds : lock_time
114
114
  )
115
115
 
116
116
  create_kv_request(proto_req, :get_and_lock, options)
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Copyright 2020-2021 Couchbase, Inc.
2
4
  #
3
5
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Copyright 2020-2021 Couchbase, Inc.
2
4
  #
3
5
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Copyright 2023. Couchbase, Inc.
2
4
  #
3
5
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Copyright 2023. Couchbase, Inc.
2
4
  #
3
5
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Copyright 2023. Couchbase, Inc.
2
4
  #
3
5
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Copyright 2020-2021 Couchbase, Inc.
2
4
  #
3
5
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Copyright 2020-2021 Couchbase, Inc.
2
4
  #
3
5
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -92,8 +94,8 @@ module Couchbase
92
94
  # @yieldparam [MatchQuery] query
93
95
  #
94
96
  # @return [MatchQuery]
95
- def self.match(match, &block)
96
- MatchQuery.new(match, &block)
97
+ def self.match(match, &)
98
+ MatchQuery.new(match, &)
97
99
  end
98
100
 
99
101
  # A match query analyzes the input text and uses that analyzed text to query the index.
@@ -143,8 +145,8 @@ module Couchbase
143
145
  # @yieldparam [MatchPhraseQuery] query
144
146
  #
145
147
  # @return [MatchPhraseQuery]
146
- def self.match_phrase(match_phrase, &block)
147
- MatchPhraseQuery.new(match_phrase, &block)
148
+ def self.match_phrase(match_phrase, &)
149
+ MatchPhraseQuery.new(match_phrase, &)
148
150
  end
149
151
 
150
152
  # The input text is analyzed and a phrase query is built with the terms resulting from the analysis.
@@ -183,8 +185,8 @@ module Couchbase
183
185
  # @yieldparam [RegexpQuery] query
184
186
  #
185
187
  # @return [RegexpQuery]
186
- def self.regexp(regexp, &block)
187
- RegexpQuery.new(regexp, &block)
188
+ def self.regexp(regexp, &)
189
+ RegexpQuery.new(regexp, &)
188
190
  end
189
191
 
190
192
  # Finds documents containing terms that match the specified regular expression.
@@ -219,8 +221,8 @@ module Couchbase
219
221
  # @yieldparam [QueryStringQuery] query
220
222
  #
221
223
  # @return [QueryStringQuery]
222
- def self.query_string(query_string, &block)
223
- QueryStringQuery.new(query_string, &block)
224
+ def self.query_string(query_string, &)
225
+ QueryStringQuery.new(query_string, &)
224
226
  end
225
227
 
226
228
  # The query string query allows humans to describe complex queries using a simple syntax.
@@ -251,8 +253,8 @@ module Couchbase
251
253
  # @yieldparam [WildcardQuery] query
252
254
  #
253
255
  # @return [WildcardQuery]
254
- def self.wildcard(wildcard, &block)
255
- WildcardQuery.new(wildcard, &block)
256
+ def self.wildcard(wildcard, &)
257
+ WildcardQuery.new(wildcard, &)
256
258
  end
257
259
 
258
260
  # Interprets * and ? wildcards as found in a lot of applications, for an easy implementation of such a search feature.
@@ -354,8 +356,8 @@ module Couchbase
354
356
  # @yieldparam [DateRangeQuery] query
355
357
  #
356
358
  # @return [DateRangeQuery]
357
- def self.date_range(&block)
358
- DateRangeQuery.new(&block)
359
+ def self.date_range(&)
360
+ DateRangeQuery.new(&)
359
361
  end
360
362
 
361
363
  # The date range query finds documents containing a date value in the specified field within the specified range.
@@ -402,11 +404,11 @@ module Couchbase
402
404
  yield self if block_given?
403
405
  end
404
406
 
405
- DATE_FORMAT_RFC3339 = "%Y-%m-%dT%H:%M:%S%:z".freeze
407
+ DATE_FORMAT_RFC3339 = "%Y-%m-%dT%H:%M:%S%:z"
406
408
 
407
409
  # @return [Hash<Symbol, #to_json>]
408
410
  def to_h
409
- raise ArgumentError, "either start_time or end_time must be set for DateRangeQuery" if @start_time.nil? && @end_time.nil?
411
+ raise Error::InvalidArgument, "either start_time or end_time must be set for DateRangeQuery" if @start_time.nil? && @end_time.nil?
410
412
 
411
413
  data = {}
412
414
  data[:boost] = boost if boost
@@ -437,8 +439,8 @@ module Couchbase
437
439
  # @yieldparam [NumericRangeQuery] query
438
440
  #
439
441
  # @return [NumericRangeQuery]
440
- def self.numeric_range(&block)
441
- NumericRangeQuery.new(&block)
442
+ def self.numeric_range(&)
443
+ NumericRangeQuery.new(&)
442
444
  end
443
445
 
444
446
  # The numeric range query finds documents containing a numeric value in the specified field within the specified range.
@@ -483,7 +485,7 @@ module Couchbase
483
485
 
484
486
  # @return [Hash<Symbol, #to_json>]
485
487
  def to_h
486
- raise ArgumentError, "either min or max must be set for NumericRangeQuery" if @min.nil? && @max.nil?
488
+ raise Error::InvalidArgument, "either min or max must be set for NumericRangeQuery" if @min.nil? && @max.nil?
487
489
 
488
490
  data = {}
489
491
  data[:boost] = boost if boost
@@ -505,8 +507,8 @@ module Couchbase
505
507
  # @yieldparam [TermRangeQuery] query
506
508
  #
507
509
  # @return [TermRangeQuery]
508
- def self.term_range(&block)
509
- TermRangeQuery.new(&block)
510
+ def self.term_range(&)
511
+ TermRangeQuery.new(&)
510
512
  end
511
513
 
512
514
  # The term range query finds documents containing a string value in the specified field within the specified range.
@@ -551,7 +553,7 @@ module Couchbase
551
553
 
552
554
  # @return [Hash<Symbol, #to_json>]
553
555
  def to_h
554
- raise ArgumentError, "either min or max must be set for TermRangeQuery" if @min.nil? && @max.nil?
556
+ raise Error::InvalidArgument, "either min or max must be set for TermRangeQuery" if @min.nil? && @max.nil?
555
557
 
556
558
  data = {}
557
559
  data[:boost] = boost if boost
@@ -577,8 +579,8 @@ module Couchbase
577
579
  # @param [String] distance how big is area (number with units)
578
580
  #
579
581
  # @return [GeoDistanceQuery]
580
- def self.geo_distance(longitude, latitude, distance, &block)
581
- GeoDistanceQuery.new(longitude, latitude, distance, &block)
582
+ def self.geo_distance(longitude, latitude, distance, &)
583
+ GeoDistanceQuery.new(longitude, latitude, distance, &)
582
584
  end
583
585
 
584
586
  # Finds `geopoint` indexed matches around a point with the given distance.
@@ -623,8 +625,8 @@ module Couchbase
623
625
  # @param [Float] bottom_right_latitude
624
626
  #
625
627
  # @return [GeoBoundingBoxQuery]
626
- def self.geo_bounding_box(top_left_longitude, top_left_latitude, bottom_right_longitude, bottom_right_latitude, &block)
627
- GeoBoundingBoxQuery.new(top_left_longitude, top_left_latitude, bottom_right_longitude, bottom_right_latitude, &block)
628
+ def self.geo_bounding_box(top_left_longitude, top_left_latitude, bottom_right_longitude, bottom_right_latitude, &)
629
+ GeoBoundingBoxQuery.new(top_left_longitude, top_left_latitude, bottom_right_longitude, bottom_right_latitude, &)
628
630
  end
629
631
 
630
632
  # Finds `geopoint` indexed matches in a given bounding box.
@@ -688,8 +690,8 @@ module Couchbase
688
690
  # @return [GeoPolygonQuery]
689
691
  #
690
692
  # @!macro uncommitted
691
- def self.geo_polygon(coordinates, &block)
692
- GeoPolygonQuery.new(coordinates, &block)
693
+ def self.geo_polygon(coordinates, &)
694
+ GeoPolygonQuery.new(coordinates, &)
693
695
  end
694
696
 
695
697
  # A search query which allows to match inside a geo polygon.
@@ -754,7 +756,7 @@ module Couchbase
754
756
 
755
757
  # @return [Hash<Symbol, #to_json>]
756
758
  def to_h
757
- raise ArgumentError, "compound conjunction query must have sub-queries" if @queries.nil? || @queries.empty?
759
+ raise Error::InvalidArgument, "compound conjunction query must have sub-queries" if @queries.nil? || @queries.empty?
758
760
 
759
761
  data = {:conjuncts => @queries.uniq.map(&:to_h)}
760
762
  data[:boost] = boost if boost
@@ -799,11 +801,11 @@ module Couchbase
799
801
 
800
802
  # @return [Hash<Symbol, #to_json>]
801
803
  def to_h
802
- raise ArgumentError, "compound disjunction query must have sub-queries" if @queries.nil? || @queries.empty?
804
+ raise Error::InvalidArgument, "compound disjunction query must have sub-queries" if @queries.nil? || @queries.empty?
803
805
 
804
806
  data = {:disjuncts => @queries.uniq.map(&:to_h)}
805
807
  if min
806
- raise ArgumentError, "disjunction query has fewer sub-queries than configured minimum" if @queries.size < min
808
+ raise Error::InvalidArgument, "disjunction query has fewer sub-queries than configured minimum" if @queries.size < min
807
809
 
808
810
  data[:min] = min
809
811
  end
@@ -817,8 +819,8 @@ module Couchbase
817
819
  # @yieldparam [BooleanQuery] query
818
820
  #
819
821
  # @return [BooleanQuery]
820
- def self.booleans(&block)
821
- BooleanQuery.new(&block)
822
+ def self.booleans(&)
823
+ BooleanQuery.new(&)
822
824
  end
823
825
 
824
826
  # The boolean query is a useful combination of conjunction and disjunction queries.
@@ -828,7 +830,7 @@ module Couchbase
828
830
 
829
831
  # @yieldparam [BooleanQuery] self
830
832
  def initialize
831
- super()
833
+ super
832
834
  @must = ConjunctionQuery.new
833
835
  @must_not = DisjunctionQuery.new
834
836
  @should = DisjunctionQuery.new
@@ -861,7 +863,10 @@ module Couchbase
861
863
 
862
864
  # @return [Hash<Symbol, #to_json>]
863
865
  def to_h
864
- raise ArgumentError, "BooleanQuery must have at least one non-empty sub-query" if @must.empty? && @must_not.empty? && @should.empty?
866
+ if @must.empty? && @must_not.empty? && @should.empty?
867
+ raise Error::InvalidArgument,
868
+ "BooleanQuery must have at least one non-empty sub-query"
869
+ end
865
870
 
866
871
  data = {}
867
872
  data[:must] = @must.to_h unless @must.empty?
@@ -878,8 +883,8 @@ module Couchbase
878
883
  # @param [String] term
879
884
  #
880
885
  # @return [TermQuery]
881
- def self.term(term, &block)
882
- TermQuery.new(term, &block)
886
+ def self.term(term, &)
887
+ TermQuery.new(term, &)
883
888
  end
884
889
 
885
890
  # A query that looks for **exact** matches of the term in the index (no analyzer, no stemming). Useful to check what the actual
@@ -925,8 +930,8 @@ module Couchbase
925
930
  # @param [String] prefix
926
931
  #
927
932
  # @return [PrefixQuery]
928
- def self.prefix(prefix, &block)
929
- PrefixQuery.new(prefix, &block)
933
+ def self.prefix(prefix, &)
934
+ PrefixQuery.new(prefix, &)
930
935
  end
931
936
 
932
937
  # The prefix query finds documents containing terms that start with the provided prefix. Usual better alternative is `MatchQuery`.
@@ -999,15 +1004,15 @@ module Couchbase
999
1004
  # @yieldparam [MatchAllQuery] query
1000
1005
  #
1001
1006
  # @return [MatchAllQuery]
1002
- def self.match_all(&block)
1003
- MatchAllQuery.new(&block)
1007
+ def self.match_all(&)
1008
+ MatchAllQuery.new(&)
1004
1009
  end
1005
1010
 
1006
1011
  # A query that matches all indexed documents.
1007
1012
  class MatchAllQuery < SearchQuery
1008
1013
  # @yieldparam [MatchAllQuery] self
1009
1014
  def initialize
1010
- super()
1015
+ super
1011
1016
  yield self if block_given?
1012
1017
  end
1013
1018
 
@@ -1022,15 +1027,15 @@ module Couchbase
1022
1027
  # @yieldparam [MatchNoneQuery] query
1023
1028
  #
1024
1029
  # @return [MatchNoneQuery]
1025
- def self.match_none(&block)
1026
- MatchNoneQuery.new(&block)
1030
+ def self.match_none(&)
1031
+ MatchNoneQuery.new(&)
1027
1032
  end
1028
1033
 
1029
1034
  # A query that matches nothing.
1030
1035
  class MatchNoneQuery < SearchQuery
1031
1036
  # @yieldparam [MatchNoneQuery] self
1032
1037
  def initialize
1033
- super()
1038
+ super
1034
1039
  yield self if block_given?
1035
1040
  end
1036
1041
 
@@ -1054,6 +1059,8 @@ module Couchbase
1054
1059
 
1055
1060
  # @api private
1056
1061
  def to_backend
1062
+ raise Error::InvalidArgument, "Vector search requires at least one vector query" if @vector_queries.empty?
1063
+
1057
1064
  {vector_queries: @vector_queries.map(&:to_h).to_json}.merge(@options.to_backend)
1058
1065
  end
1059
1066
  end
@@ -1068,13 +1075,23 @@ module Couchbase
1068
1075
 
1069
1076
  # Constructs a +VectorQuery+ instance
1070
1077
  #
1071
- # @param [String] vector_field_name the document field that contains the vector.
1072
- # @param [Array<Float>] vector_query the vector query to run.
1078
+ # @overload initialize(vector_field_name, vector_query)
1079
+ # @param [String] vector_field_name the document field that contains the vector.
1080
+ # @param [Array<Float>] vector_query the vector query.
1073
1081
  #
1074
- # @yieldparam [MatchPhraseQuery] self
1082
+ # @overload initialize(vector_field_name, base64_vector_query)
1083
+ # @param [String] vector_field_name the document field that contains the vector.
1084
+ # @param [String] base64_vector_query the vector query represented as a base64-encoded sequence of little-endian IEEE 754 floats.
1085
+ #
1086
+ # @yieldparam [VectorQuery] self
1075
1087
  def initialize(vector_field_name, vector_query)
1076
1088
  @vector_field_name = vector_field_name
1077
- @vector_query = vector_query
1089
+
1090
+ if vector_query.respond_to?(:to_str)
1091
+ @base64_vector_query = vector_query.to_str
1092
+ else
1093
+ @vector_query = vector_query
1094
+ end
1078
1095
 
1079
1096
  yield self if block_given?
1080
1097
  end
@@ -1086,12 +1103,23 @@ module Couchbase
1086
1103
  "Number of candidates must be at least 1, #{num_candidates} given"
1087
1104
  end
1088
1105
 
1089
- {
1106
+ h = {
1090
1107
  field: @vector_field_name,
1091
1108
  vector: @vector_query,
1109
+ vector_base64: @base64_vector_query,
1092
1110
  k: num_candidates || 3,
1093
1111
  boost: boost,
1094
1112
  }.compact
1113
+
1114
+ raise Error::InvalidArgument, "The vector cannot be nil" if !h.include?(:vector) && !h.include?(:vector_base64)
1115
+ raise Error::InvalidArgument, "The vector query cannot be an empty array" if h.include?(:vector) && h[:vector].empty?
1116
+
1117
+ if h.include?(:vector_base64) && h[:vector_base64].empty?
1118
+ raise Error::InvalidArgument,
1119
+ "The base64-encoded vector query cannot be empty"
1120
+ end
1121
+
1122
+ h
1095
1123
  end
1096
1124
 
1097
1125
  # @api private
@@ -1103,21 +1131,21 @@ module Couchbase
1103
1131
  class SearchSort
1104
1132
  # @yieldparam [SearchSortScore]
1105
1133
  # @return [SearchSortScore]
1106
- def self.score(&block)
1107
- SearchSortScore.new(&block)
1134
+ def self.score(&)
1135
+ SearchSortScore.new(&)
1108
1136
  end
1109
1137
 
1110
1138
  # @yieldparam [SearchSortId]
1111
1139
  # @return [SearchSortScore]
1112
- def self.id(&block)
1113
- SearchSortId.new(&block)
1140
+ def self.id(&)
1141
+ SearchSortId.new(&)
1114
1142
  end
1115
1143
 
1116
1144
  # @param [String] name field name
1117
1145
  # @yieldparam [SearchSortField]
1118
1146
  # @return [SearchSortField]
1119
- def self.field(name, &block)
1120
- SearchSortField.new(name, &block)
1147
+ def self.field(name, &)
1148
+ SearchSortField.new(name, &)
1121
1149
  end
1122
1150
 
1123
1151
  # @param [String] name field name
@@ -1125,8 +1153,8 @@ module Couchbase
1125
1153
  # @param [Float] latitude
1126
1154
  # @yieldparam [SearchSortField]
1127
1155
  # @return [SearchSortGeoDistance]
1128
- def self.geo_distance(name, longitude, latitude, &block)
1129
- SearchSortGeoDistance.new(name, longitude, latitude, &block)
1156
+ def self.geo_distance(name, longitude, latitude, &)
1157
+ SearchSortGeoDistance.new(name, longitude, latitude, &)
1130
1158
  end
1131
1159
 
1132
1160
  class SearchSortScore < SearchSort
@@ -1229,20 +1257,20 @@ module Couchbase
1229
1257
  class SearchFacet
1230
1258
  # @param [String] field_name
1231
1259
  # @return [SearchFacetTerm]
1232
- def self.term(field_name, &block)
1233
- SearchFacetTerm.new(field_name, &block)
1260
+ def self.term(field_name, &)
1261
+ SearchFacetTerm.new(field_name, &)
1234
1262
  end
1235
1263
 
1236
1264
  # @param [String] field_name
1237
1265
  # @return [SearchFacetNumericRange]
1238
- def self.numeric_range(field_name, &block)
1239
- SearchFacetNumericRange.new(field_name, &block)
1266
+ def self.numeric_range(field_name, &)
1267
+ SearchFacetNumericRange.new(field_name, &)
1240
1268
  end
1241
1269
 
1242
1270
  # @param [String] field_name
1243
1271
  # @return [SearchFacetDateRange]
1244
- def self.date_range(field_name, &block)
1245
- SearchFacetDateRange.new(field_name, &block)
1272
+ def self.date_range(field_name, &)
1273
+ SearchFacetDateRange.new(field_name, &)
1246
1274
  end
1247
1275
 
1248
1276
  class SearchFacetTerm
@@ -1306,7 +1334,7 @@ module Couchbase
1306
1334
  yield self if block_given?
1307
1335
  end
1308
1336
 
1309
- DATE_FORMAT_RFC3339 = "%Y-%m-%dT%H:%M:%S%:z".freeze
1337
+ DATE_FORMAT_RFC3339 = "%Y-%m-%dT%H:%M:%S%:z"
1310
1338
 
1311
1339
  # @param [String] name the name of the range
1312
1340
  # @param [Time, String, nil] start_time lower bound of the range (pass +nil+ if there is no lower bound)
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Copyright 2020-2021 Couchbase, Inc.
2
4
  #
3
5
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -245,9 +247,9 @@ module Couchbase
245
247
  @expand_macros
246
248
  end
247
249
 
248
- CAS = "${Mutation.CAS}".freeze
249
- SEQ_NO = "${Mutation.seqno}".freeze
250
- VALUE_CRC32C = "${Mutation.value_crc32c}".freeze
250
+ CAS = "${Mutation.CAS}"
251
+ SEQ_NO = "${Mutation.seqno}"
252
+ VALUE_CRC32C = "${Mutation.value_crc32c}"
251
253
 
252
254
  attr_reader :type
253
255
  attr_reader :path
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Copyright 2023. Couchbase, Inc.
2
4
  #
3
5
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Copyright 2021 Couchbase, Inc.
2
4
  # Copyright 2020-Present Couchbase, Inc.
3
5
  #
@@ -18,7 +20,7 @@ require "time"
18
20
  module Couchbase
19
21
  module Utils
20
22
  class GenericLoggerAdapter
21
- DATETIME_FORMAT = "%Y-%m-%dT%H:%M:%S.%6N".freeze
23
+ DATETIME_FORMAT = "%Y-%m-%dT%H:%M:%S.%6N"
22
24
 
23
25
  def initialize(logger, verbose: false)
24
26
  @logger = logger
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Copyright 2021 Couchbase, Inc.
2
4
  # Copyright 2020-Present Couchbase, Inc.
3
5
  #
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Copyright 2020-2021 Couchbase, Inc.
2
4
  #
3
5
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -59,7 +61,7 @@ module Couchbase
59
61
  return number_or_duration if number_or_duration.class == Integer # rubocop:disable Style/ClassEqualityComparison avoid overrides of #is_a?, #kind_of?
60
62
 
61
63
  if number_or_duration.respond_to?(:in_milliseconds)
62
- number_or_duration.public_send(:in_milliseconds)
64
+ number_or_duration.in_milliseconds
63
65
  else
64
66
  number_or_duration
65
67
  end.to_i
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Copyright 2020-2021 Couchbase, Inc.
2
4
  #
3
5
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Copyright 2020-2021 Couchbase, Inc.
2
4
  #
3
5
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -19,5 +21,5 @@ module Couchbase
19
21
  # $ ruby -rcouchbase -e 'pp Couchbase::VERSION'
20
22
  # {:sdk=>"3.4.0", :ruby_abi=>"3.1.0", :revision=>"416fe68e6029ec8a4c40611cf6e6b30d3b90d20f"}
21
23
  VERSION = {} unless defined?(VERSION) # rubocop:disable Style/MutableConstant
22
- VERSION.update(:sdk => "3.5.1".freeze)
24
+ VERSION.update(:sdk => "3.5.2")
23
25
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Copyright 2020-2021 Couchbase, Inc.
2
4
  #
3
5
  # Licensed under the Apache License, Version 2.0 (the "License");
data/lib/couchbase.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Copyright 2020-2021 Couchbase, Inc.
2
4
  #
3
5
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Copyright 2020-2021 Couchbase, Inc.
2
4
  #
3
5
  # Licensed under the Apache License, Version 2.0 (the "License");
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: couchbase
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.5.1
4
+ version: 3.5.2
5
5
  platform: x86_64-linux-musl
6
6
  authors:
7
7
  - Sergey Avseyev
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-04-24 00:00:00.000000000 Z
11
+ date: 2024-07-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: grpc
@@ -161,9 +161,9 @@ metadata:
161
161
  homepage_uri: https://docs.couchbase.com/ruby-sdk/current/hello-world/start-using-sdk.html
162
162
  bug_tracker_uri: https://couchbase.com/issues/browse/RCBC
163
163
  mailing_list_uri: https://forums.couchbase.com/c/ruby-sdk
164
- source_code_uri: https://github.com/couchbase/couchbase-ruby-client/tree/3.5.1
165
- changelog_uri: https://github.com/couchbase/couchbase-ruby-client/releases/tag/3.5.1
166
- documentation_uri: https://docs.couchbase.com/sdk-api/couchbase-ruby-client-3.5.1/index.html
164
+ source_code_uri: https://github.com/couchbase/couchbase-ruby-client/tree/3.5.2
165
+ changelog_uri: https://github.com/couchbase/couchbase-ruby-client/releases/tag/3.5.2
166
+ documentation_uri: https://docs.couchbase.com/sdk-api/couchbase-ruby-client-3.5.2/index.html
167
167
  github_repo: ssh://github.com/couchbase/couchbase-ruby-client
168
168
  rubygems_mfa_required: 'true'
169
169
  post_install_message:
@@ -176,7 +176,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
176
176
  requirements:
177
177
  - - ">"
178
178
  - !ruby/object:Gem::Version
179
- version: '3.0'
179
+ version: '3.1'
180
180
  required_rubygems_version: !ruby/object:Gem::Requirement
181
181
  requirements:
182
182
  - - ">="