couchbase 3.0.0.alpha.2-universal-darwin-19 → 3.0.0.alpha.3-universal-darwin-19

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.
Files changed (83) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/tests-dev-preview.yml +52 -0
  3. data/.gitmodules +3 -0
  4. data/.idea/vcs.xml +1 -0
  5. data/.yardopts +1 -0
  6. data/README.md +1 -1
  7. data/Rakefile +5 -1
  8. data/bin/init-cluster +13 -5
  9. data/couchbase.gemspec +2 -1
  10. data/examples/managing_query_indexes.rb +1 -1
  11. data/examples/managing_search_indexes.rb +62 -0
  12. data/examples/search.rb +187 -0
  13. data/ext/.clang-tidy +1 -0
  14. data/ext/build_version.hxx.in +1 -1
  15. data/ext/couchbase/bucket.hxx +0 -40
  16. data/ext/couchbase/couchbase.cxx +2578 -1368
  17. data/ext/couchbase/io/http_session.hxx +27 -7
  18. data/ext/couchbase/io/mcbp_parser.hxx +2 -0
  19. data/ext/couchbase/io/mcbp_session.hxx +53 -24
  20. data/ext/couchbase/io/session_manager.hxx +6 -1
  21. data/ext/couchbase/operations.hxx +13 -0
  22. data/ext/couchbase/operations/bucket_create.hxx +1 -0
  23. data/ext/couchbase/operations/bucket_drop.hxx +1 -0
  24. data/ext/couchbase/operations/bucket_flush.hxx +1 -0
  25. data/ext/couchbase/operations/bucket_get.hxx +1 -0
  26. data/ext/couchbase/operations/bucket_get_all.hxx +1 -0
  27. data/ext/couchbase/operations/bucket_update.hxx +1 -0
  28. data/ext/couchbase/operations/cluster_developer_preview_enable.hxx +1 -0
  29. data/ext/couchbase/operations/collection_create.hxx +6 -1
  30. data/ext/couchbase/operations/collection_drop.hxx +1 -0
  31. data/ext/couchbase/operations/command.hxx +86 -11
  32. data/ext/couchbase/operations/document_decrement.hxx +1 -0
  33. data/ext/couchbase/operations/document_exists.hxx +1 -0
  34. data/ext/couchbase/operations/document_get.hxx +1 -0
  35. data/ext/couchbase/operations/document_get_and_lock.hxx +1 -0
  36. data/ext/couchbase/operations/document_get_and_touch.hxx +1 -0
  37. data/ext/couchbase/operations/document_get_projected.hxx +243 -0
  38. data/ext/couchbase/operations/document_increment.hxx +4 -1
  39. data/ext/couchbase/operations/document_insert.hxx +1 -0
  40. data/ext/couchbase/operations/document_lookup_in.hxx +1 -0
  41. data/ext/couchbase/operations/document_mutate_in.hxx +1 -0
  42. data/ext/couchbase/operations/document_query.hxx +13 -2
  43. data/ext/couchbase/operations/document_remove.hxx +1 -0
  44. data/ext/couchbase/operations/document_replace.hxx +1 -0
  45. data/ext/couchbase/operations/document_search.hxx +337 -0
  46. data/ext/couchbase/operations/document_touch.hxx +1 -0
  47. data/ext/couchbase/operations/document_unlock.hxx +1 -0
  48. data/ext/couchbase/operations/document_upsert.hxx +1 -0
  49. data/ext/couchbase/operations/query_index_build_deferred.hxx +1 -0
  50. data/ext/couchbase/operations/query_index_create.hxx +1 -0
  51. data/ext/couchbase/operations/query_index_drop.hxx +1 -0
  52. data/ext/couchbase/operations/query_index_get_all.hxx +1 -0
  53. data/ext/couchbase/operations/scope_create.hxx +1 -0
  54. data/ext/couchbase/operations/scope_drop.hxx +1 -0
  55. data/ext/couchbase/operations/scope_get_all.hxx +2 -0
  56. data/ext/couchbase/operations/search_index.hxx +62 -0
  57. data/ext/couchbase/operations/search_index_analyze_document.hxx +92 -0
  58. data/ext/couchbase/operations/search_index_control_ingest.hxx +78 -0
  59. data/ext/couchbase/operations/search_index_control_plan_freeze.hxx +80 -0
  60. data/ext/couchbase/operations/search_index_control_query.hxx +80 -0
  61. data/ext/couchbase/operations/search_index_drop.hxx +77 -0
  62. data/ext/couchbase/operations/search_index_get.hxx +80 -0
  63. data/ext/couchbase/operations/search_index_get_all.hxx +82 -0
  64. data/ext/couchbase/operations/search_index_get_documents_count.hxx +81 -0
  65. data/ext/couchbase/operations/search_index_upsert.hxx +106 -0
  66. data/ext/couchbase/protocol/client_opcode.hxx +10 -0
  67. data/ext/couchbase/protocol/cmd_get_collection_id.hxx +117 -0
  68. data/ext/couchbase/timeout_defaults.hxx +32 -0
  69. data/ext/couchbase/version.hxx +1 -1
  70. data/ext/test/main.cxx +5 -5
  71. data/lib/couchbase/binary_collection.rb +16 -12
  72. data/lib/couchbase/binary_collection_options.rb +4 -0
  73. data/lib/couchbase/cluster.rb +88 -8
  74. data/lib/couchbase/collection.rb +39 -15
  75. data/lib/couchbase/collection_options.rb +19 -2
  76. data/lib/couchbase/json_transcoder.rb +2 -2
  77. data/lib/couchbase/management/bucket_manager.rb +37 -23
  78. data/lib/couchbase/management/collection_manager.rb +15 -6
  79. data/lib/couchbase/management/query_index_manager.rb +16 -6
  80. data/lib/couchbase/management/search_index_manager.rb +61 -14
  81. data/lib/couchbase/search_options.rb +1492 -0
  82. data/lib/couchbase/version.rb +1 -1
  83. metadata +22 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d3590c3ec0086255c72da32955a533915946c5f1a2380a668853d474645f7e18
4
- data.tar.gz: f0eacadba27b4c5668f0fa4a02e457ad5f5338485297f23a39b038e4ef8cda3c
3
+ metadata.gz: 5523baaeabe62572762a0af31a6636401970e9b8f760b071c855a9c59766e7ef
4
+ data.tar.gz: 860e1fd99369e1e075fbc80629e051f4f1f41515b2ee084a64c5342a35fea7a2
5
5
  SHA512:
6
- metadata.gz: 18986bda3fbfb90cc77c6bc640c363f69e896e9611863e5ab608beeec24557e6e0d6c93f3241bf007909142eb97ada16046b1eb8a0227c3de43156dbea826b20
7
- data.tar.gz: 7d54ba280b68565b60a375e0f5766ea40eb34daf48c798504403b4f657a9d2bc3429ddef9bed350538f2c56667158a132db153724b9aaba9059c0e8589071fc2
6
+ metadata.gz: 7655d328ee6cd5b5b4d830deaf75053b0d5ccdd15ee77eafd188be81841c05f1433c560be08aa71a2b7ab58d59b5ff427fd1cee9ea095fb2874075b39c7b8023
7
+ data.tar.gz: 85510dc74b15eadecf816aa8b59938dad14d9e1dc118d3f6b665161a581d1d4493faadd5e6cdece784a22bd63e3d036e07f734848de65a13a4857be620501ca7
@@ -0,0 +1,52 @@
1
+ name: tests-dev-preview
2
+
3
+ on:
4
+ push:
5
+ branches: [ master ]
6
+ pull_request:
7
+ branches: [ master ]
8
+
9
+ jobs:
10
+ test:
11
+
12
+ runs-on: ubuntu-latest
13
+
14
+ services:
15
+ couchbase:
16
+ image: couchbase:enterprise-6.5.1
17
+ ports:
18
+ - 8091-8094:8091-8094
19
+ - 11210:11210
20
+
21
+ steps:
22
+ - name: Install build environment
23
+ run: sudo apt-get install -y libssl-dev cmake gcc g++ curl
24
+
25
+ - uses: actions/checkout@v2
26
+ with:
27
+ submodules: recursive
28
+
29
+ - name: Set up ruby
30
+ uses: ruby/setup-ruby@v1
31
+ with:
32
+ ruby-version: 2.6
33
+
34
+ - name: Install dependencies
35
+ run: bundle install
36
+
37
+ - name: Initialize couchbase
38
+ run: ./bin/init-cluster
39
+ env:
40
+ DEVELOPER_PREVIEW: yes
41
+
42
+ - name: Compile extension
43
+ run: bundle exec rake compile
44
+
45
+ - name: Display library version
46
+ run: bundle exec ruby -I lib -r couchbase -e 'pp Couchbase::VERSION'
47
+
48
+ - name: Run tests
49
+ run: bundle exec rake test
50
+ env:
51
+ DEVELOPER_PREVIEW: yes
52
+ TEST_SERVER_VERSION: 6.5.1
@@ -16,3 +16,6 @@
16
16
  [submodule "ext/third_party/snappy"]
17
17
  path = ext/third_party/snappy
18
18
  url = git://github.com/google/snappy.git
19
+ [submodule "test_data/sdk_test_cases"]
20
+ path = test_data/sdk_test_cases
21
+ url = git://github.com/couchbaselabs/sdk-testcases
@@ -8,5 +8,6 @@
8
8
  <mapping directory="$PROJECT_DIR$/ext/third_party/json" vcs="Git" />
9
9
  <mapping directory="$PROJECT_DIR$/ext/third_party/snappy" vcs="Git" />
10
10
  <mapping directory="$PROJECT_DIR$/ext/third_party/spdlog" vcs="Git" />
11
+ <mapping directory="$PROJECT_DIR$/test_data/sdk_test_cases" vcs="Git" />
11
12
  </component>
12
13
  </project>
@@ -0,0 +1 @@
1
+ --output-dir doc/couchbase-ruby-client-master lib - README.md
data/README.md CHANGED
@@ -16,7 +16,7 @@ Please attach version information to ticket/post. To obtain this information use
16
16
  Add this line to your application's Gemfile:
17
17
 
18
18
  ```ruby
19
- gem "couchbase", "3.0.0.alpha.2"
19
+ gem "couchbase", "3.0.0.alpha.3"
20
20
  ```
21
21
 
22
22
  And then execute:
data/Rakefile CHANGED
@@ -33,12 +33,16 @@ task :doc do
33
33
  input_dir = File.join(__dir__, "lib")
34
34
  output_dir = File.join(__dir__, "doc", "couchbase-ruby-client-#{Couchbase::VERSION[:sdk]}")
35
35
  rm_rf output_dir
36
- sh "yard doc --output-dir #{output_dir} #{input_dir}"
36
+ sh "yard doc --output-dir #{output_dir} #{input_dir} - README.md"
37
37
  puts "#{File.realpath(output_dir)}/index.html"
38
38
  end
39
39
 
40
40
  task :docs => :doc
41
41
 
42
+ task :undocumented => :doc do
43
+ sh "yard stats --list-undoc --compact"
44
+ end
45
+
42
46
  task :render_git_revision do
43
47
  build_version_path = File.join(__dir__, 'ext', 'build_version.hxx.in')
44
48
  File.write(build_version_path, File.read(build_version_path).gsub('@BACKEND_GIT_REVISION@', `git rev-parse HEAD`.strip))
@@ -14,9 +14,12 @@
14
14
  # See the License for the specific language governing permissions and
15
15
  # limitations under the License.
16
16
 
17
- HOST="localhost"
18
- USERNAME="Administrator"
19
- PASSWORD="password"
17
+ HOST=${HOST:-localhost}
18
+ USERNAME=${USERNAME:-Administrator}
19
+ PASSWORD=${PASSWOWRD:-password}
20
+ QUOTA=${QUOTA:-256}
21
+ DEVELOPER_PREVIEW=${DEVELOPER_PREVIEW:-no}
22
+
20
23
  CREDS="${USERNAME}:${PASSWORD}"
21
24
 
22
25
  sleep 1
@@ -33,11 +36,11 @@ curl -sS -w "\n" -u ${CREDS} http://${HOST}:8091/nodes/self/controller/settings
33
36
 
34
37
  # Setup Services
35
38
  curl -sS -w "\n" -u ${CREDS} http://${HOST}:8091/node/controller/setupServices \
36
- -d 'services=kv%2Cn1ql%2Cindex'
39
+ -d 'services=kv%2Cn1ql%2Cindex%2Cfts'
37
40
 
38
41
  # Setup Memory Quotas
39
42
  curl -sS -w "\n" -u ${CREDS} http://${HOST}:8091/pools/default \
40
- -d 'memoryQuota=256' \
43
+ -d "memoryQuota=${QUOTA}" \
41
44
  -d 'indexMemoryQuota=256'
42
45
 
43
46
  # Setup Administrator username and password
@@ -60,3 +63,8 @@ curl -sS -w "\n" -u ${CREDS} http://${HOST}:8091/pools/default/buckets \
60
63
  -d 'ramQuotaMB=100' \
61
64
  -d 'bucketType=membase' \
62
65
  -d 'name=default'
66
+
67
+ if [ "x${DEVELOPER_PREVIEW}" != "xno" ]; then
68
+ curl -sS -w "\n" -u ${CREDS} http://${HOST}:8091/settings/developerPreview \
69
+ -d "enabled=true"
70
+ fi
@@ -29,9 +29,10 @@ Gem::Specification.new do |spec|
29
29
  spec.metadata["homepage_uri"] = spec.homepage
30
30
  spec.metadata["source_code_uri"] = "https://github.com/couchbase/couchbase-ruby-client"
31
31
  spec.metadata["changelog_uri"] = "#{spec.metadata["source_code_uri"]}/releases"
32
+ spec.metadata["github_repo"] = "ssh://github.com/couchbase/couchbase-ruby-client"
32
33
 
33
34
  spec.files = Dir.chdir(File.expand_path("..", __FILE__)) do
34
- `git ls-files --recurse-submodules -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
35
+ `git ls-files --recurse-submodules -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features|test_data)/}) }
35
36
  end
36
37
  spec.bindir = "exe"
37
38
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
@@ -28,7 +28,7 @@ bucket_name = "beer-sample"
28
28
 
29
29
  options = Cluster::ClusterOptions.new
30
30
  options.authenticate("Administrator", "password")
31
- cluster = Cluster.connect("couchbase://192.168.42.101", options)
31
+ cluster = Cluster.connect("couchbase://localhost", options)
32
32
 
33
33
  display_indexes(cluster.query_indexes.get_all_indexes(bucket_name), bucket_name)
34
34
 
@@ -0,0 +1,62 @@
1
+ require "couchbase"
2
+ include Couchbase
3
+
4
+ def measure(msg)
5
+ start = Time.now
6
+ yield
7
+ printf "%s in %.2f seconds\n", msg, Time.now - start
8
+ end
9
+
10
+ options = Cluster::ClusterOptions.new
11
+ options.authenticate("Administrator", "password")
12
+ cluster = Cluster.connect("couchbase://localhost", options)
13
+
14
+ search_indexes = cluster.search_indexes.get_all_indexes
15
+ puts "There are #{search_indexes.size} search indexes on the cluster"
16
+ search_indexes.each do |index|
17
+ num_docs = cluster.search_indexes.get_indexed_documents_count(index.name)
18
+ puts "* #{index.name.inspect} contains #{num_docs} documents"
19
+ end
20
+
21
+ search_index_name = "my_index"
22
+ begin
23
+ index = cluster.search_indexes.get_index(search_index_name)
24
+ measure("index #{index.name.inspect} has been dropped") do
25
+ cluster.search_indexes.drop_index(index.name)
26
+ end
27
+ rescue Error::IndexNotFound
28
+ # Ignored
29
+ end
30
+
31
+ index = Management::SearchIndex.new
32
+ index.type = "fulltext-index"
33
+ index.name = search_index_name
34
+ index.source_type = "couchbase"
35
+ index.source_name = "beer-sample"
36
+
37
+ measure("index #{search_index_name.inspect} has been created") do
38
+ cluster.search_indexes.upsert_index(index)
39
+ end
40
+ num_indexed = 0
41
+ loop do
42
+ sleep(1)
43
+ num = cluster.search_indexes.get_indexed_documents_count(search_index_name)
44
+ break if num_indexed == num
45
+ num_indexed = num
46
+ puts "#{index.name.inspect} indexed #{num_indexed}"
47
+ end
48
+
49
+ search_indexes = cluster.search_indexes.get_all_indexes
50
+ puts "There are #{search_indexes.size} search indexes on the cluster"
51
+ search_indexes.each do |index|
52
+ num_docs = cluster.search_indexes.get_indexed_documents_count(index.name)
53
+ puts "* #{index.name.inspect} contains #{num_docs} documents"
54
+ end
55
+
56
+ document = {
57
+ title: "Hello world",
58
+ content: "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua."
59
+ }
60
+ analysis = cluster.search_indexes.analyze_document(search_index_name, document)
61
+ puts "Analysis of document using definition of the index #{search_index_name}:"
62
+ pp analysis
@@ -0,0 +1,187 @@
1
+ require 'couchbase'
2
+
3
+ include Couchbase
4
+
5
+ options = Cluster::ClusterOptions.new
6
+ options.authenticate("Administrator", "password")
7
+ cluster = Cluster.connect("couchbase://localhost", options)
8
+
9
+ # create index definition, if it does not exist already
10
+ search_index_name = "beer_search"
11
+
12
+ begin
13
+ cluster.search_indexes.get_index(search_index_name)
14
+ rescue Error::IndexNotFound
15
+ index = Management::SearchIndex.new
16
+ index.type = "fulltext-index"
17
+ index.name = search_index_name
18
+ index.source_type = "couchbase"
19
+ index.source_name = "beer-sample"
20
+ index.params = {
21
+ mapping: {
22
+ default_datetime_parser: "dateTimeOptional",
23
+ types: {
24
+ "beer" => {
25
+ properties: {
26
+ "abv" => {
27
+ fields: [
28
+ {
29
+ name: "abv",
30
+ type: "number",
31
+ include_in_all: true,
32
+ index: true,
33
+ store: true,
34
+ docvalues: true,
35
+ }
36
+ ]
37
+ },
38
+ "category" => {
39
+ fields: [
40
+ {
41
+ name: "category",
42
+ type: "text",
43
+ include_in_all: true,
44
+ include_term_vectors: true,
45
+ index: true,
46
+ store: true,
47
+ docvalues: true,
48
+ }
49
+ ]
50
+ },
51
+ "description" => {
52
+ fields: [
53
+ {
54
+ name: "description",
55
+ type: "text",
56
+ include_in_all: true,
57
+ include_term_vectors: true,
58
+ index: true,
59
+ store: true,
60
+ docvalues: true,
61
+ }
62
+ ]
63
+ },
64
+ "name" => {
65
+ fields: [
66
+ {
67
+ name: "name",
68
+ type: "text",
69
+ include_in_all: true,
70
+ include_term_vectors: true,
71
+ index: true,
72
+ store: true,
73
+ docvalues: true,
74
+ }
75
+ ]
76
+ },
77
+ "style" => {
78
+ fields: [
79
+ {
80
+ name: "style",
81
+ type: "text",
82
+ include_in_all: true,
83
+ include_term_vectors: true,
84
+ index: true,
85
+ store: true,
86
+ docvalues: true,
87
+ }
88
+ ]
89
+ },
90
+ "updated" => {
91
+ fields: [
92
+ {
93
+ name: "updated",
94
+ type: "datetime",
95
+ include_in_all: true,
96
+ index: true,
97
+ store: true,
98
+ docvalues: true,
99
+ }
100
+ ]
101
+ },
102
+ }
103
+ }
104
+ }
105
+ }
106
+ }
107
+
108
+ cluster.search_indexes.upsert_index(index)
109
+
110
+ num_indexed = 0
111
+ loop do
112
+ sleep(1)
113
+ num = cluster.search_indexes.get_indexed_documents_count(search_index_name)
114
+ break if num_indexed == num
115
+ num_indexed = num
116
+ puts "indexing #{search_index_name.inspect}: #{num_indexed} documents"
117
+ end
118
+ end
119
+
120
+ # search with facets advanced sort
121
+ query = Cluster::SearchQuery.match_phrase("hop beer")
122
+ options = Cluster::SearchOptions.new
123
+ options.limit = 10
124
+ options.fields = %w[name]
125
+ options.highlight_style = :html
126
+ options.highlight_fields = %w[name description]
127
+ options.sort = [
128
+ Cluster::SearchSort.field("abv") do |spec|
129
+ spec.type = :number
130
+ end,
131
+ Cluster::SearchSort.score do |spec|
132
+ spec.desc = true
133
+ end,
134
+ "category",
135
+ Cluster::SearchSort.id,
136
+ ]
137
+
138
+ res = cluster.search_query(search_index_name, query, options)
139
+ res.rows.each_with_index do |row, idx|
140
+ document = row.fields
141
+ puts "\n#{idx}. #{document["name"]} (id: #{row.id.inspect})"
142
+ row.fragments.each do |field, fragments|
143
+ puts " * #{field}"
144
+ fragments.each do |fragment|
145
+ puts " - #{fragment.gsub(/\n/, ' ')}"
146
+ end
147
+ end
148
+ end
149
+
150
+ # search with facets
151
+ query = Cluster::SearchQuery.term("beer")
152
+ query.field = "type"
153
+
154
+ options = Cluster::SearchOptions.new
155
+ options.facets = {}
156
+
157
+ term_facet = Cluster::SearchFacet.term("name")
158
+ term_facet.size = 3
159
+ options.facets["by_name"] = term_facet
160
+
161
+ date_facet = Cluster::SearchFacet.date_range("updated")
162
+ date_facet.add("old", nil, Time.new(2013, 1, 1))
163
+ date_facet.size = 3
164
+ options.facets["by_time"] = date_facet
165
+
166
+ numeric_facet = Cluster::SearchFacet.numeric_range("abv")
167
+ numeric_facet.size = 3
168
+ numeric_facet.add("strong", 4.9, nil)
169
+ numeric_facet.add("light", nil, 4.89)
170
+ options.facets["by_strength"] = numeric_facet
171
+
172
+ res = cluster.search_query(search_index_name, query, options)
173
+
174
+ puts "\n==== Top 3 beer names (out of #{res.facets["by_name"].total}):"
175
+ res.facets["by_name"].terms.each_with_index do |term, idx|
176
+ puts "#{idx}. #{term.term} (#{term.count} records)"
177
+ end
178
+
179
+ puts "\n==== Beer by strength (out of #{res.facets["by_strength"].total}):"
180
+ res.facets["by_strength"].numeric_ranges.each_with_index do |range, idx|
181
+ puts "#{idx}. #{range.name}, ABV: [#{range.min}..#{range.max}] (#{range.count} records)"
182
+ end
183
+
184
+ puts "\n==== The most recently updated (out of #{res.facets["by_time"].total}):"
185
+ res.facets["by_time"].date_ranges.each_with_index do |range, idx|
186
+ puts "#{idx}. #{range.name} [#{range.start_time}..#{range.end_time}] (#{range.count} records)"
187
+ end
@@ -17,4 +17,5 @@ Checks: |-
17
17
  -cppcoreguidelines-avoid-magic-numbers,
18
18
  -cppcoreguidelines-pro-bounds-pointer-arithmetic,
19
19
  -modernize-use-trailing-return-type,
20
+ -llvmlibc-callee-namespace,
20
21
  -fuchsia-*
@@ -22,5 +22,5 @@
22
22
  #define BACKEND_C_COMPILER "@CMAKE_C_COMPILER_ID@ @CMAKE_C_COMPILER_VERSION@"
23
23
  #define BACKEND_SYSTEM "@CMAKE_SYSTEM@"
24
24
  #define BACKEND_SYSTEM_PROCESSOR "@CMAKE_SYSTEM_PROCESSOR@"
25
- #define BACKEND_GIT_REVISION "5b91db73c89347cfb4985490051aea4d82f56c0e"
25
+ #define BACKEND_GIT_REVISION "86b887957baf7230bfbe853de48b4507b9c2c18d"
26
26
 
@@ -24,7 +24,6 @@
24
24
 
25
25
  namespace couchbase
26
26
  {
27
-
28
27
  class bucket
29
28
  {
30
29
  public:
@@ -51,16 +50,6 @@ class bucket
51
50
  return;
52
51
  }
53
52
 
54
- auto session_manifest = session->manifest();
55
- if (!manifest_cache_) {
56
- if (session_manifest) {
57
- manifest_cache_ = session_manifest.value();
58
- }
59
- } else {
60
- if (session_manifest && session_manifest->uid > manifest_cache_->uid) {
61
- manifest_cache_ = session->manifest().value();
62
- }
63
- }
64
53
  sessions_.emplace(index, std::move(session));
65
54
  }
66
55
 
@@ -81,14 +70,6 @@ class bucket
81
70
  size_t index = 0;
82
71
  std::tie(request.partition, index) = config_.map_key(request.id.key);
83
72
  auto session = sessions_.at(index);
84
- if (manifest_cache_) {
85
- request.id.collection_uid = get_collection_uid(request.id.collection);
86
- } else {
87
- if (!request.id.collection.empty() && request.id.collection != "_default._default") {
88
- handler(make_response(std::make_error_code(error::common_errc::unsupported_operation), request, {}));
89
- return;
90
- }
91
- }
92
73
  auto cmd = std::make_shared<operations::command<Request>>(ctx_, std::move(request));
93
74
  cmd->send_to(session, std::forward<Handler>(handler));
94
75
  }
@@ -105,32 +86,11 @@ class bucket
105
86
  }
106
87
 
107
88
  private:
108
- [[nodiscard]] uint32_t get_collection_uid(const std::string& collection_path)
109
- {
110
- Expects(manifest_cache_.has_value());
111
- Expects(!collection_path.empty());
112
- auto dot = collection_path.find('.');
113
- Expects(dot != std::string::npos);
114
- std::string scope = collection_path.substr(0, dot);
115
- std::string collection = collection_path.substr(dot + 1);
116
- for (const auto& s : manifest_cache_->scopes) {
117
- if (s.name == scope) {
118
- for (const auto& c : s.collections) {
119
- if (c.name == collection) {
120
- return gsl::narrow_cast<std::uint32_t>(c.uid);
121
- }
122
- }
123
- }
124
- }
125
- Ensures(false); // FIXME: return collection not found
126
- return 0;
127
- }
128
89
 
129
90
  asio::io_context& ctx_;
130
91
  std::string name_;
131
92
  configuration config_;
132
93
  bool closed_{ false };
133
- std::optional<collections_manifest> manifest_cache_{};
134
94
  std::map<size_t, std::shared_ptr<io::mcbp_session>> sessions_{};
135
95
  };
136
96
  } // namespace couchbase