couchbase 3.0.0.alpha.5-universal-darwin-19 → 3.0.0.beta.1-universal-darwin-19
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +12 -3
- data/README.md +4 -2
- data/Rakefile +1 -1
- data/couchbase.gemspec +17 -12
- data/ext/.idea/misc.xml +12 -0
- data/ext/CMakeLists.txt +10 -1
- data/ext/build_config.hxx.in +20 -0
- data/ext/build_version.hxx.in +1 -1
- data/ext/couchbase/bucket.hxx +90 -24
- data/ext/couchbase/cluster.hxx +125 -84
- data/ext/couchbase/cluster_options.hxx +53 -0
- data/ext/couchbase/configuration.hxx +220 -2
- data/ext/couchbase/couchbase.cxx +134 -127
- data/ext/couchbase/io/dns_client.hxx +3 -1
- data/ext/couchbase/io/http_command.hxx +91 -0
- data/ext/couchbase/io/http_session.hxx +58 -19
- data/ext/couchbase/io/http_session_manager.hxx +26 -31
- data/ext/couchbase/io/mcbp_command.hxx +180 -0
- data/ext/couchbase/io/mcbp_message.hxx +5 -0
- data/ext/couchbase/io/mcbp_session.hxx +213 -98
- data/ext/couchbase/io/streams.hxx +165 -0
- data/ext/couchbase/operations.hxx +1 -1
- data/ext/couchbase/operations/analytics_dataset_create.hxx +1 -1
- data/ext/couchbase/operations/bucket_create.hxx +4 -2
- data/ext/couchbase/operations/bucket_drop.hxx +4 -2
- data/ext/couchbase/operations/bucket_flush.hxx +4 -2
- data/ext/couchbase/operations/bucket_get.hxx +4 -2
- data/ext/couchbase/operations/bucket_get_all.hxx +4 -2
- data/ext/couchbase/operations/bucket_update.hxx +4 -2
- data/ext/couchbase/operations/cluster_developer_preview_enable.hxx +4 -2
- data/ext/couchbase/operations/collection_create.hxx +4 -2
- data/ext/couchbase/operations/collection_drop.hxx +4 -2
- data/ext/couchbase/operations/document_analytics.hxx +0 -4
- data/ext/couchbase/operations/document_decrement.hxx +6 -3
- data/ext/couchbase/operations/document_get.hxx +3 -0
- data/ext/couchbase/operations/document_get_and_lock.hxx +3 -0
- data/ext/couchbase/operations/document_get_and_touch.hxx +5 -2
- data/ext/couchbase/operations/document_get_projected.hxx +12 -9
- data/ext/couchbase/operations/document_increment.hxx +6 -3
- data/ext/couchbase/operations/document_insert.hxx +5 -2
- data/ext/couchbase/operations/document_lookup_in.hxx +3 -0
- data/ext/couchbase/operations/document_mutate_in.hxx +6 -3
- data/ext/couchbase/operations/document_remove.hxx +3 -0
- data/ext/couchbase/operations/document_replace.hxx +5 -2
- data/ext/couchbase/operations/document_search.hxx +6 -7
- data/ext/couchbase/operations/document_touch.hxx +5 -2
- data/ext/couchbase/operations/document_unlock.hxx +3 -0
- data/ext/couchbase/operations/document_upsert.hxx +5 -2
- data/ext/couchbase/operations/query_index_build_deferred.hxx +3 -3
- data/ext/couchbase/operations/query_index_create.hxx +3 -3
- data/ext/couchbase/operations/query_index_drop.hxx +3 -3
- data/ext/couchbase/operations/query_index_get_all.hxx +3 -3
- data/ext/couchbase/operations/scope_create.hxx +4 -2
- data/ext/couchbase/operations/scope_drop.hxx +4 -2
- data/ext/couchbase/operations/scope_get_all.hxx +4 -2
- data/ext/couchbase/operations/search_index_analyze_document.hxx +2 -2
- data/ext/couchbase/operations/search_index_control_ingest.hxx +2 -2
- data/ext/couchbase/operations/search_index_control_plan_freeze.hxx +2 -2
- data/ext/couchbase/operations/search_index_control_query.hxx +2 -2
- data/ext/couchbase/operations/search_index_drop.hxx +2 -2
- data/ext/couchbase/operations/search_index_get.hxx +2 -2
- data/ext/couchbase/operations/search_index_get_all.hxx +2 -2
- data/ext/couchbase/operations/search_index_get_documents_count.hxx +2 -2
- data/ext/couchbase/operations/search_index_upsert.hxx +2 -2
- data/ext/couchbase/origin.hxx +148 -0
- data/ext/couchbase/protocol/cmd_cluster_map_change_notification.hxx +1 -6
- data/ext/couchbase/protocol/cmd_decrement.hxx +5 -5
- data/ext/couchbase/protocol/cmd_get_and_touch.hxx +5 -5
- data/ext/couchbase/protocol/cmd_get_cluster_config.hxx +1 -6
- data/ext/couchbase/protocol/cmd_increment.hxx +5 -5
- data/ext/couchbase/protocol/cmd_info.hxx +0 -11
- data/ext/couchbase/protocol/cmd_insert.hxx +5 -5
- data/ext/couchbase/protocol/cmd_mutate_in.hxx +6 -6
- data/ext/couchbase/protocol/cmd_replace.hxx +5 -5
- data/ext/couchbase/protocol/cmd_touch.hxx +1 -1
- data/ext/couchbase/protocol/cmd_upsert.hxx +5 -5
- data/ext/couchbase/timeout_defaults.hxx +7 -0
- data/ext/couchbase/utils/connection_string.hxx +139 -0
- data/ext/extconf.rb +44 -11
- data/ext/test/main.cxx +93 -15
- data/ext/third_party/http_parser/Makefile +160 -0
- data/ext/third_party/json/Makefile +77 -0
- data/lib/couchbase/analytics_options.rb +18 -4
- data/lib/couchbase/binary_collection.rb +2 -2
- data/lib/couchbase/binary_collection_options.rb +2 -2
- data/lib/couchbase/bucket.rb +4 -4
- data/lib/couchbase/cluster.rb +60 -46
- data/lib/couchbase/collection.rb +13 -13
- data/lib/couchbase/collection_options.rb +15 -9
- data/{bin/console → lib/couchbase/datastructures.rb} +4 -7
- data/lib/couchbase/datastructures/couchbase_list.rb +171 -0
- data/lib/couchbase/datastructures/couchbase_map.rb +205 -0
- data/lib/couchbase/datastructures/couchbase_queue.rb +145 -0
- data/lib/couchbase/datastructures/couchbase_set.rb +138 -0
- data/lib/couchbase/errors.rb +66 -63
- data/lib/couchbase/libcouchbase.bundle +0 -0
- data/lib/couchbase/management/user_manager.rb +1 -1
- data/lib/couchbase/mutation_state.rb +1 -0
- data/lib/couchbase/query_options.rb +25 -2
- data/lib/couchbase/scope.rb +0 -7
- data/lib/couchbase/search_options.rb +7 -0
- data/lib/couchbase/version.rb +1 -1
- data/lib/couchbase/view_options.rb +4 -3
- metadata +20 -82
- data/.github/workflows/tests-6.0.3.yml +0 -52
- data/.github/workflows/tests-dev-preview.yml +0 -55
- data/.github/workflows/tests.yml +0 -50
- data/.gitignore +0 -20
- data/.gitmodules +0 -21
- data/.idea/.gitignore +0 -5
- data/.idea/dictionaries/gem_terms.xml +0 -18
- data/.idea/inspectionProfiles/Project_Default.xml +0 -8
- data/.idea/vcs.xml +0 -13
- data/bin/check-cluster +0 -31
- data/bin/fetch-stats +0 -19
- data/bin/init-cluster +0 -82
- data/bin/jenkins/build-extension +0 -35
- data/bin/jenkins/install-dependencies +0 -47
- data/bin/jenkins/test-with-cbdyncluster +0 -58
- data/bin/setup +0 -24
- data/ext/couchbase/configuration_monitor.hxx +0 -93
- data/ext/couchbase/operations/command.hxx +0 -163
- data/rbi/couchbase.rbi +0 -79
data/ext/test/main.cxx
CHANGED
@@ -22,11 +22,11 @@
|
|
22
22
|
#include <ruby.h>
|
23
23
|
|
24
24
|
void
|
25
|
-
run_script(const
|
25
|
+
run_script(const std::string & script)
|
26
26
|
{
|
27
27
|
spdlog::info("run script:\n----------------------------------------{}---------------------------------------\n", script);
|
28
28
|
int status = 0;
|
29
|
-
rb_eval_string_protect(script, &status);
|
29
|
+
rb_eval_string_protect(script.c_str(), &status);
|
30
30
|
if (status != 0) {
|
31
31
|
VALUE rbError = rb_funcall(rb_gv_get("$!"), rb_intern("message"), 0);
|
32
32
|
spdlog::critical("ruby execution failure: {}", StringValuePtr(rbError));
|
@@ -34,25 +34,103 @@ run_script(const char* script)
|
|
34
34
|
}
|
35
35
|
}
|
36
36
|
|
37
|
+
extern "C" {
|
38
|
+
void rb_encdb_declare(const char *name);
|
39
|
+
int rb_encdb_alias(const char *alias, const char *orig);
|
40
|
+
}
|
41
|
+
|
37
42
|
int
|
38
|
-
main()
|
43
|
+
main(int argc, char **argv)
|
39
44
|
{
|
40
|
-
|
41
|
-
|
45
|
+
ruby_sysinit(&argc, &argv);
|
46
|
+
{
|
47
|
+
RUBY_INIT_STACK;
|
48
|
+
|
49
|
+
ruby_init();
|
50
|
+
ruby_init_loadpath();
|
42
51
|
|
43
|
-
|
44
|
-
|
45
|
-
|
52
|
+
rb_encdb_declare("ASCII-8BIT");
|
53
|
+
rb_encdb_declare("US-ASCII");
|
54
|
+
rb_encdb_declare("UTF-8");
|
55
|
+
rb_encdb_alias("BINARY", "ASCII-8BIT");
|
56
|
+
rb_encdb_alias("ASCII", "US-ASCII");
|
57
|
+
|
58
|
+
|
59
|
+
rb_require(LIBCOUCHBASE_EXT_PATH);
|
60
|
+
run_script(R"(
|
61
|
+
require "rubygems"
|
62
|
+
require "json"
|
46
63
|
p Couchbase::VERSION
|
47
|
-
|
48
|
-
B.open("localhost", "Administrator", "password")
|
64
|
+
include Couchbase
|
49
65
|
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
66
|
+
# begin
|
67
|
+
# load "/home/avsej/code/couchbase-ruby-client/test/query_test.rb"
|
68
|
+
# rescue => ex
|
69
|
+
# p ex
|
70
|
+
# puts ex.backtrace
|
71
|
+
# raise
|
72
|
+
# end
|
54
73
|
|
74
|
+
backend = Backend.new
|
75
|
+
begin
|
76
|
+
options = {
|
77
|
+
}
|
78
|
+
connstr = "couchbases://192.168.42.101?trust_certificate=/tmp/couchbase-ssl-certificate.pem"
|
79
|
+
# curl http://localhost:8091/pools/default/certificate > /tmp/couchbase-ssl-certificate.pem
|
80
|
+
connstr = "couchbases://localhost.avsej.net?trust_certificate=/tmp/couchbase-ssl-certificate.pem"
|
81
|
+
connstr = "couchbases://mars.local?trust_certificate=/tmp/couchbase-ssl-certificate.pem"
|
82
|
+
p open: backend.open(connstr, "Administrator", "password", options)
|
83
|
+
rescue => ex
|
84
|
+
p err: ex
|
85
|
+
puts ex.backtrace
|
86
|
+
end
|
87
|
+
# p bucket: backend.open_bucket("default", true)
|
88
|
+
# ('aaa'..'zzz').to_a.sample(10).each do |key|
|
89
|
+
# p set: backend.document_upsert("default", "_default._default", key, 10_000, JSON.generate(foo: "bar"), 0, {})
|
90
|
+
# p get: backend.document_get("default", "_default._default", key, nil)
|
91
|
+
# end
|
92
|
+
p query: backend.document_query('select "ruby rules" as greeting', {})
|
93
|
+
p close: backend.close
|
55
94
|
|
56
|
-
|
95
|
+
# backend = Backend.new
|
96
|
+
# begin
|
97
|
+
# p open: backend.open("couchbase://localhost", "Administrator", "password")
|
98
|
+
# rescue => ex
|
99
|
+
# p err: ex
|
100
|
+
# puts ex.backtrace
|
101
|
+
# end
|
102
|
+
# backend.close
|
103
|
+
|
104
|
+
# 100.times do |idx|
|
105
|
+
# puts "------ #{idx} -----"
|
106
|
+
# backend = Backend.new
|
107
|
+
# p open: backend.open("couchbase://192.168.42.101", "Administrator", "password")
|
108
|
+
# p bucket: backend.open_bucket("default", false)
|
109
|
+
# p set: backend.document_upsert("default", "_default._default", "hello", 10_000, JSON.generate(foo: "bar"), 0, {})
|
110
|
+
# p get: backend.document_get("default", "_default._default", "hello", nil)
|
111
|
+
# p close: backend.close
|
112
|
+
# end
|
113
|
+
|
114
|
+
# backend = Backend.new
|
115
|
+
# p open: backend.open("couchbase://localhost", "Administrator", "password")
|
116
|
+
# p query1: (begin; backend.document_query('select curl("https://rubygems.org/api/v1/versions/couchbase.json")', {timeout: 100})[:meta]; rescue => ex; ex; end)
|
117
|
+
# p query2: backend.document_query('select curl("https://rubygems.org/api/v1/versions/couchbase.json")', {})[:meta]
|
118
|
+
# p query3: backend.document_query('select curl("https://rubygems.org/api/v1/versions/couchbase.json")', {})[:meta]
|
119
|
+
# p close: backend.close
|
120
|
+
|
121
|
+
# 100.times do
|
122
|
+
# %w[query crud subdoc].each do |suite|
|
123
|
+
# begin
|
124
|
+
# load "/home/avsej/code/couchbase-ruby-client/test/#{suite}_test.rb"
|
125
|
+
# rescue => ex
|
126
|
+
# p ex
|
127
|
+
# puts ex.backtrace
|
128
|
+
# end
|
129
|
+
# end
|
130
|
+
# end
|
131
|
+
)");
|
132
|
+
|
133
|
+
ruby_finalize();
|
134
|
+
}
|
57
135
|
return 0;
|
58
136
|
}
|
@@ -0,0 +1,160 @@
|
|
1
|
+
# Copyright Joyent, Inc. and other Node contributors. All rights reserved.
|
2
|
+
#
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
+
# of this software and associated documentation files (the "Software"), to
|
5
|
+
# deal in the Software without restriction, including without limitation the
|
6
|
+
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
7
|
+
# sell copies of the Software, and to permit persons to whom the Software is
|
8
|
+
# furnished to do so, subject to the following conditions:
|
9
|
+
#
|
10
|
+
# The above copyright notice and this permission notice shall be included in
|
11
|
+
# all copies or substantial portions of the Software.
|
12
|
+
#
|
13
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
18
|
+
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
19
|
+
# IN THE SOFTWARE.
|
20
|
+
|
21
|
+
PLATFORM ?= $(shell sh -c 'uname -s | tr "[A-Z]" "[a-z]"')
|
22
|
+
HELPER ?=
|
23
|
+
BINEXT ?=
|
24
|
+
SOLIBNAME = libhttp_parser
|
25
|
+
SOMAJOR = 2
|
26
|
+
SOMINOR = 9
|
27
|
+
SOREV = 4
|
28
|
+
ifeq (darwin,$(PLATFORM))
|
29
|
+
SOEXT ?= dylib
|
30
|
+
SONAME ?= $(SOLIBNAME).$(SOMAJOR).$(SOMINOR).$(SOEXT)
|
31
|
+
LIBNAME ?= $(SOLIBNAME).$(SOMAJOR).$(SOMINOR).$(SOREV).$(SOEXT)
|
32
|
+
else ifeq (wine,$(PLATFORM))
|
33
|
+
CC = winegcc
|
34
|
+
BINEXT = .exe.so
|
35
|
+
HELPER = wine
|
36
|
+
else
|
37
|
+
SOEXT ?= so
|
38
|
+
SONAME ?= $(SOLIBNAME).$(SOEXT).$(SOMAJOR).$(SOMINOR)
|
39
|
+
LIBNAME ?= $(SOLIBNAME).$(SOEXT).$(SOMAJOR).$(SOMINOR).$(SOREV)
|
40
|
+
endif
|
41
|
+
|
42
|
+
CC?=gcc
|
43
|
+
AR?=ar
|
44
|
+
|
45
|
+
CPPFLAGS ?=
|
46
|
+
LDFLAGS ?=
|
47
|
+
|
48
|
+
CPPFLAGS += -I.
|
49
|
+
CPPFLAGS_DEBUG = $(CPPFLAGS) -DHTTP_PARSER_STRICT=1
|
50
|
+
CPPFLAGS_DEBUG += $(CPPFLAGS_DEBUG_EXTRA)
|
51
|
+
CPPFLAGS_FAST = $(CPPFLAGS) -DHTTP_PARSER_STRICT=0
|
52
|
+
CPPFLAGS_FAST += $(CPPFLAGS_FAST_EXTRA)
|
53
|
+
CPPFLAGS_BENCH = $(CPPFLAGS_FAST)
|
54
|
+
|
55
|
+
CFLAGS += -Wall -Wextra -Werror
|
56
|
+
CFLAGS_DEBUG = $(CFLAGS) -O0 -g $(CFLAGS_DEBUG_EXTRA)
|
57
|
+
CFLAGS_FAST = $(CFLAGS) -O3 $(CFLAGS_FAST_EXTRA)
|
58
|
+
CFLAGS_BENCH = $(CFLAGS_FAST) -Wno-unused-parameter
|
59
|
+
CFLAGS_LIB = $(CFLAGS_FAST) -fPIC
|
60
|
+
|
61
|
+
LDFLAGS_LIB = $(LDFLAGS) -shared
|
62
|
+
|
63
|
+
INSTALL ?= install
|
64
|
+
PREFIX ?= /usr/local
|
65
|
+
LIBDIR = $(PREFIX)/lib
|
66
|
+
INCLUDEDIR = $(PREFIX)/include
|
67
|
+
|
68
|
+
ifeq (darwin,$(PLATFORM))
|
69
|
+
LDFLAGS_LIB += -Wl,-install_name,$(LIBDIR)/$(SONAME)
|
70
|
+
else
|
71
|
+
# TODO(bnoordhuis) The native SunOS linker expects -h rather than -soname...
|
72
|
+
LDFLAGS_LIB += -Wl,-soname=$(SONAME)
|
73
|
+
endif
|
74
|
+
|
75
|
+
test: test_g test_fast
|
76
|
+
$(HELPER) ./test_g$(BINEXT)
|
77
|
+
$(HELPER) ./test_fast$(BINEXT)
|
78
|
+
|
79
|
+
test_g: http_parser_g.o test_g.o
|
80
|
+
$(CC) $(CFLAGS_DEBUG) $(LDFLAGS) http_parser_g.o test_g.o -o $@
|
81
|
+
|
82
|
+
test_g.o: test.c http_parser.h Makefile
|
83
|
+
$(CC) $(CPPFLAGS_DEBUG) $(CFLAGS_DEBUG) -c test.c -o $@
|
84
|
+
|
85
|
+
http_parser_g.o: http_parser.c http_parser.h Makefile
|
86
|
+
$(CC) $(CPPFLAGS_DEBUG) $(CFLAGS_DEBUG) -c http_parser.c -o $@
|
87
|
+
|
88
|
+
test_fast: http_parser.o test.o http_parser.h
|
89
|
+
$(CC) $(CFLAGS_FAST) $(LDFLAGS) http_parser.o test.o -o $@
|
90
|
+
|
91
|
+
test.o: test.c http_parser.h Makefile
|
92
|
+
$(CC) $(CPPFLAGS_FAST) $(CFLAGS_FAST) -c test.c -o $@
|
93
|
+
|
94
|
+
bench: http_parser.o bench.o
|
95
|
+
$(CC) $(CFLAGS_BENCH) $(LDFLAGS) http_parser.o bench.o -o $@
|
96
|
+
|
97
|
+
bench.o: bench.c http_parser.h Makefile
|
98
|
+
$(CC) $(CPPFLAGS_BENCH) $(CFLAGS_BENCH) -c bench.c -o $@
|
99
|
+
|
100
|
+
http_parser.o: http_parser.c http_parser.h Makefile
|
101
|
+
$(CC) $(CPPFLAGS_FAST) $(CFLAGS_FAST) -c http_parser.c
|
102
|
+
|
103
|
+
test-run-timed: test_fast
|
104
|
+
while(true) do time $(HELPER) ./test_fast$(BINEXT) > /dev/null; done
|
105
|
+
|
106
|
+
test-valgrind: test_g
|
107
|
+
valgrind ./test_g
|
108
|
+
|
109
|
+
libhttp_parser.o: http_parser.c http_parser.h Makefile
|
110
|
+
$(CC) $(CPPFLAGS_FAST) $(CFLAGS_LIB) -c http_parser.c -o libhttp_parser.o
|
111
|
+
|
112
|
+
library: libhttp_parser.o
|
113
|
+
$(CC) $(LDFLAGS_LIB) -o $(LIBNAME) $<
|
114
|
+
|
115
|
+
package: http_parser.o
|
116
|
+
$(AR) rcs libhttp_parser.a http_parser.o
|
117
|
+
|
118
|
+
url_parser: http_parser.o contrib/url_parser.c
|
119
|
+
$(CC) $(CPPFLAGS_FAST) $(CFLAGS_FAST) $^ -o $@
|
120
|
+
|
121
|
+
url_parser_g: http_parser_g.o contrib/url_parser.c
|
122
|
+
$(CC) $(CPPFLAGS_DEBUG) $(CFLAGS_DEBUG) $^ -o $@
|
123
|
+
|
124
|
+
parsertrace: http_parser.o contrib/parsertrace.c
|
125
|
+
$(CC) $(CPPFLAGS_FAST) $(CFLAGS_FAST) $^ -o parsertrace$(BINEXT)
|
126
|
+
|
127
|
+
parsertrace_g: http_parser_g.o contrib/parsertrace.c
|
128
|
+
$(CC) $(CPPFLAGS_DEBUG) $(CFLAGS_DEBUG) $^ -o parsertrace_g$(BINEXT)
|
129
|
+
|
130
|
+
tags: http_parser.c http_parser.h test.c
|
131
|
+
ctags $^
|
132
|
+
|
133
|
+
install: library
|
134
|
+
$(INSTALL) -D http_parser.h $(DESTDIR)$(INCLUDEDIR)/http_parser.h
|
135
|
+
$(INSTALL) -D $(LIBNAME) $(DESTDIR)$(LIBDIR)/$(LIBNAME)
|
136
|
+
ln -sf $(LIBNAME) $(DESTDIR)$(LIBDIR)/$(SONAME)
|
137
|
+
ln -sf $(LIBNAME) $(DESTDIR)$(LIBDIR)/$(SOLIBNAME).$(SOEXT)
|
138
|
+
|
139
|
+
install-strip: library
|
140
|
+
$(INSTALL) -D http_parser.h $(DESTDIR)$(INCLUDEDIR)/http_parser.h
|
141
|
+
$(INSTALL) -D -s $(LIBNAME) $(DESTDIR)$(LIBDIR)/$(LIBNAME)
|
142
|
+
ln -sf $(LIBNAME) $(DESTDIR)$(LIBDIR)/$(SONAME)
|
143
|
+
ln -sf $(LIBNAME) $(DESTDIR)$(LIBDIR)/$(SOLIBNAME).$(SOEXT)
|
144
|
+
|
145
|
+
uninstall:
|
146
|
+
rm $(DESTDIR)$(INCLUDEDIR)/http_parser.h
|
147
|
+
rm $(DESTDIR)$(LIBDIR)/$(SOLIBNAME).$(SOEXT)
|
148
|
+
rm $(DESTDIR)$(LIBDIR)/$(SONAME)
|
149
|
+
rm $(DESTDIR)$(LIBDIR)/$(LIBNAME)
|
150
|
+
|
151
|
+
clean:
|
152
|
+
rm -f *.o *.a tags test test_fast test_g \
|
153
|
+
http_parser.tar libhttp_parser.so.* \
|
154
|
+
url_parser url_parser_g parsertrace parsertrace_g \
|
155
|
+
*.exe *.exe.so
|
156
|
+
|
157
|
+
contrib/url_parser.c: http_parser.h
|
158
|
+
contrib/parsertrace.c: http_parser.h
|
159
|
+
|
160
|
+
.PHONY: clean package test-run test-run-timed test-valgrind install install-strip uninstall
|
@@ -0,0 +1,77 @@
|
|
1
|
+
# The Art of C++
|
2
|
+
# Copyright (c) 2015-2020 Dr. Colin Hirsch and Daniel Frey
|
3
|
+
# Please see LICENSE for license or visit https://github.com/taocpp/json
|
4
|
+
|
5
|
+
.SUFFIXES:
|
6
|
+
.SECONDARY:
|
7
|
+
|
8
|
+
ifeq ($(OS),Windows_NT)
|
9
|
+
UNAME_S := $(OS)
|
10
|
+
ifeq ($(shell gcc -dumpmachine),mingw32)
|
11
|
+
MINGW_CXXFLAGS = -U__STRICT_ANSI__
|
12
|
+
endif
|
13
|
+
else
|
14
|
+
UNAME_S := $(shell uname -s)
|
15
|
+
endif
|
16
|
+
|
17
|
+
# For Darwin (Mac OS X / macOS) we assume that the default compiler
|
18
|
+
# clang++ is used; when $(CXX) is some version of g++, then
|
19
|
+
# $(CXXSTD) has to be set to -std=c++17 (or newer) so
|
20
|
+
# that -stdlib=libc++ is not automatically added.
|
21
|
+
|
22
|
+
ifeq ($(CXXSTD),)
|
23
|
+
CXXSTD := -std=c++17
|
24
|
+
ifeq ($(UNAME_S),Darwin)
|
25
|
+
CXXSTD += -stdlib=libc++
|
26
|
+
endif
|
27
|
+
endif
|
28
|
+
|
29
|
+
# Ensure strict standard compliance and no warnings, can be
|
30
|
+
# changed if desired.
|
31
|
+
|
32
|
+
CPPFLAGS ?= -pedantic
|
33
|
+
CXXFLAGS ?= -Wall -Wextra -Wshadow -Werror -O3 $(MINGW_CXXFLAGS)
|
34
|
+
|
35
|
+
CLANG_TIDY ?= clang-tidy
|
36
|
+
|
37
|
+
HEADERS := $(filter-out include/tao/json/external/% include/tao/json/internal/endian_win.hpp,$(shell find include -name '*.hpp')) $(filter-out src/test/json/main.hpp,$(shell find src -name '*.hpp'))
|
38
|
+
SOURCES := $(shell find src -name '*.cpp')
|
39
|
+
DEPENDS := $(SOURCES:%.cpp=build/%.d)
|
40
|
+
BINARIES := $(SOURCES:%.cpp=build/%)
|
41
|
+
|
42
|
+
UNIT_TESTS := $(filter build/src/test/%,$(BINARIES))
|
43
|
+
|
44
|
+
.PHONY: all
|
45
|
+
all: compile check
|
46
|
+
|
47
|
+
.PHONY: compile
|
48
|
+
compile: $(BINARIES)
|
49
|
+
|
50
|
+
.PHONY: check
|
51
|
+
check: $(UNIT_TESTS)
|
52
|
+
@set -e; for T in $(UNIT_TESTS); do echo $$T; $$T > /dev/null; done
|
53
|
+
|
54
|
+
.PHONY: clean
|
55
|
+
clean:
|
56
|
+
@rm -rf build/src
|
57
|
+
@find . -name '*~' -delete
|
58
|
+
|
59
|
+
build/%.d: %.cpp Makefile
|
60
|
+
@mkdir -p $(@D)
|
61
|
+
$(CXX) $(CXXSTD) -Iinclude $(CPPFLAGS) -MM -MQ $@ $< -o $@
|
62
|
+
|
63
|
+
build/%: %.cpp build/%.d
|
64
|
+
$(CXX) $(CXXSTD) -Iinclude $(CPPFLAGS) $(CXXFLAGS) $< -o $@
|
65
|
+
|
66
|
+
build/%.clang-tidy: %
|
67
|
+
$(CLANG_TIDY) -extra-arg "-Iinclude" -extra-arg "-std=c++17" -checks=*,-fuchsia-*,-google-runtime-references,-google-runtime-int,-google-readability-todo,-cppcoreguidelines-pro-bounds-pointer-arithmetic,-cppcoreguidelines-pro-bounds-array-to-pointer-decay,-*-avoid-c-arrays,-*-magic-numbers,-cppcoreguidelines-non-private-member-variables-in-classes,-cppcoreguidelines-macro-usage,-hicpp-no-array-decay,-hicpp-signed-bitwise,-modernize-raw-string-literal,-misc-sizeof-expression,-misc-non-private-member-variables-in-classes,-bugprone-sizeof-expression,-bugprone-exception-escape -warnings-as-errors=* $< 2>/dev/null
|
68
|
+
@mkdir -p $(@D)
|
69
|
+
@touch $@
|
70
|
+
|
71
|
+
.PHONY: clang-tidy
|
72
|
+
clang-tidy: $(HEADERS:%=build/%.clang-tidy) $(SOURCES:%=build/%.clang-tidy)
|
73
|
+
@echo "All $(words $(HEADERS) $(SOURCES)) clang-tidy tests passed."
|
74
|
+
|
75
|
+
ifeq ($(findstring $(MAKECMDGOALS),clean),)
|
76
|
+
-include $(DEPENDS)
|
77
|
+
endif
|
@@ -26,10 +26,7 @@ module Couchbase
|
|
26
26
|
# @return [:not_bounded, :request_plus] specifies level of consistency for the query
|
27
27
|
attr_accessor :scan_consistency
|
28
28
|
|
29
|
-
# @return [
|
30
|
-
attr_accessor :scan_wait
|
31
|
-
|
32
|
-
# @return [Boolean] Allows explicitly marking a query as being readonly and not mutating and documents on the server side.
|
29
|
+
# @return [Boolean] Allows explicitly marking a query as being readonly and not mutating any documents on the server side.
|
33
30
|
attr_accessor :readonly
|
34
31
|
|
35
32
|
# @return [Boolean] Allows to give certain requests higher priority than others
|
@@ -38,6 +35,10 @@ module Couchbase
|
|
38
35
|
# @return [JsonTranscoder] transcoder to use on rows
|
39
36
|
attr_accessor :transcoder
|
40
37
|
|
38
|
+
# @api private
|
39
|
+
# @return [Hash<String => #to_json>]
|
40
|
+
attr_reader :raw_parameters
|
41
|
+
|
41
42
|
# @yieldparam [AnalyticsOptions] self
|
42
43
|
def initialize
|
43
44
|
@transcoder = JsonTranscoder.new
|
@@ -56,6 +57,13 @@ module Couchbase
|
|
56
57
|
@named_parameters = nil
|
57
58
|
end
|
58
59
|
|
60
|
+
# @api private
|
61
|
+
# @return [Array<String>, nil]
|
62
|
+
def export_positional_parameters
|
63
|
+
@positional_parameters.map { |p| JSON.dump(p) } if @positional_parameters
|
64
|
+
end
|
65
|
+
|
66
|
+
|
59
67
|
# Sets named parameters for the query
|
60
68
|
#
|
61
69
|
# @param [Hash] named the key/value map of the parameters to substitute in the statement
|
@@ -71,6 +79,12 @@ module Couchbase
|
|
71
79
|
def raw(key, value)
|
72
80
|
@raw_parameters[key] = JSON.generate(value)
|
73
81
|
end
|
82
|
+
|
83
|
+
# @api private
|
84
|
+
# @return [Hash<String => String>, nil]
|
85
|
+
def export_named_parameters
|
86
|
+
@named_parameters.each_with_object({}) { |(n, v), o| o[n.to_s] = JSON.dump(v) } if @named_parameters
|
87
|
+
end
|
74
88
|
end
|
75
89
|
|
76
90
|
class AnalyticsWarning
|
@@ -54,7 +54,7 @@ module Couchbase
|
|
54
54
|
{
|
55
55
|
delta: options.delta,
|
56
56
|
initial_value: options.initial,
|
57
|
-
|
57
|
+
expiry: options.expiry,
|
58
58
|
durability_level: options.durability_level,
|
59
59
|
})
|
60
60
|
CounterResult.new do |res|
|
@@ -76,7 +76,7 @@ module Couchbase
|
|
76
76
|
{
|
77
77
|
delta: options.delta,
|
78
78
|
initial_value: options.initial,
|
79
|
-
|
79
|
+
expiry: options.expiry,
|
80
80
|
durability_level: options.durability_level,
|
81
81
|
})
|
82
82
|
CounterResult.new do |res|
|
@@ -44,7 +44,7 @@ module Couchbase
|
|
44
44
|
attr_accessor :initial
|
45
45
|
|
46
46
|
# @return [Integer] if set, holds the expiration for the operation
|
47
|
-
attr_accessor :
|
47
|
+
attr_accessor :expiry
|
48
48
|
|
49
49
|
# @return [:none, :majority, :majority_and_persist_to_active, :persist_to_majority] level of durability
|
50
50
|
attr_accessor :durability_level
|
@@ -71,7 +71,7 @@ module Couchbase
|
|
71
71
|
attr_accessor :initial
|
72
72
|
|
73
73
|
# @return [Integer] if set, holds the expiration for the operation
|
74
|
-
attr_accessor :
|
74
|
+
attr_accessor :expiry
|
75
75
|
|
76
76
|
# @return [:none, :majority, :majority_and_persist_to_active, :persist_to_majority] level of durability
|
77
77
|
attr_accessor :durability_level
|