couchbase 1.3.10 → 1.3.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.markdown +3 -105
- data/RELEASE_NOTES.markdown +7 -0
- data/ext/couchbase_ext/arguments.c +22 -0
- data/ext/couchbase_ext/eventmachine_plugin.c +9 -3
- data/ext/couchbase_ext/extconf.rb +40 -42
- data/ext/couchbase_ext/multithread_plugin.c +10 -3
- data/lib/couchbase/version.rb +1 -1
- data/tasks/compile.rake +36 -41
- metadata +2 -3
- data/ext/couchbase_ext/libcouchbase/bsdio-inl.c +0 -223
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d306fbc4b3da87a77da5ba54614b55a6c461c489
|
4
|
+
data.tar.gz: 8b34013f1f1cab6e859a84c5dbfe9a9cab26515f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0f404b5867f6a47fc00c651d0744edfabaa6ba824646d26b6a7e48e72e3da235099ed51f66541e5a0d2abf4a24acda6de2a1e3066098f3366d158a975b312992
|
7
|
+
data.tar.gz: 2e9dca46a279117f96abf83a0a9c6914db91b99e136e27787270508780efde09436b461da3bf7481c5d39f2ed292faefce6a65d219f7b239e1fe613efd1f6a97
|
data/README.markdown
CHANGED
@@ -17,110 +17,8 @@ documentation][api].
|
|
17
17
|
## INSTALL
|
18
18
|
|
19
19
|
This gem depends [libcouchbase][3]. In most cases installing
|
20
|
-
libcouchbase doesn't take much effort.
|
21
|
-
|
22
|
-
### MacOS (Homebrew)
|
23
|
-
|
24
|
-
$ brew install libcouchbase
|
25
|
-
|
26
|
-
The official homebrew repository contains only stable versions of
|
27
|
-
libvbucket and libcouchbase, if you need preview, take a look at
|
28
|
-
Couchbase's fork: https://github.com/couchbase/homebrew
|
29
|
-
|
30
|
-
$ brew install https://raw.github.com/couchbase/homebrew/preview/Library/Formula/libcouchbase.rb
|
31
|
-
|
32
|
-
If you are experiencing issues with installing using the OS included
|
33
|
-
ruby, the most likely reason is that architecture of libcouchbase and
|
34
|
-
your ruby do not match (e.g. one component is fat binary while another
|
35
|
-
is not). The best fix depends on the details of the components. If you
|
36
|
-
are using the system ruby on Mac OS X (which contains both 32-bit and
|
37
|
-
64-bit code), you need to install libcouchbase using the `--universal`
|
38
|
-
option:
|
39
|
-
|
40
|
-
$ brew install --universal libcouchbase
|
41
|
-
|
42
|
-
Another approach might be to try to use [rbenv][rbenv], install 64-bit
|
43
|
-
only ruby and compile couchbase ruby gem there there. Here are the
|
44
|
-
steps:
|
45
|
-
|
46
|
-
$ brew install rbenv ruby-build
|
47
|
-
|
48
|
-
Add the following line to the end of your .bashrc:
|
49
|
-
|
50
|
-
if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi
|
51
|
-
|
52
|
-
Then install ruby and make it global:
|
53
|
-
|
54
|
-
$ rbenv install 2.1.2
|
55
|
-
$ rbenv global 2.1.2
|
56
|
-
|
57
|
-
Now you are ready to install and use the couchbase ruby gem:
|
58
|
-
|
59
|
-
$ gem install couchbase
|
60
|
-
|
61
|
-
### Debian (Ubuntu)
|
62
|
-
|
63
|
-
Add the appropriate line to `/etc/apt/sources.list.d/couchbase.list` for
|
64
|
-
your OS release:
|
65
|
-
|
66
|
-
# Ubuntu 11.10 Oneiric Ocelot (Debian unstable)
|
67
|
-
deb http://packages.couchbase.com/ubuntu oneiric oneiric/main
|
68
|
-
|
69
|
-
# Ubuntu 10.04 Lucid Lynx (Debian stable or testing)
|
70
|
-
deb http://packages.couchbase.com/ubuntu lucid lucid/main
|
71
|
-
|
72
|
-
Import the Couchbase PGP key:
|
73
|
-
|
74
|
-
wget -O- http://packages.couchbase.com/ubuntu/couchbase.key | sudo apt-key add -
|
75
|
-
|
76
|
-
Then install them
|
77
|
-
|
78
|
-
$ sudo apt-get update && sudo apt-get install libcouchbase-dev
|
79
|
-
|
80
|
-
Again, if you need a preview of a future version, just use another repository in
|
81
|
-
your `couchbase.list`
|
82
|
-
|
83
|
-
# Ubuntu 11.10 Oneiric Ocelot (Debian unstable)
|
84
|
-
deb http://packages.couchbase.com/preview/ubuntu oneiric oneiric/main
|
85
|
-
|
86
|
-
# Ubuntu 10.04 Lucid Lynx (Debian stable or testing)
|
87
|
-
deb http://packages.couchbase.com/preview/ubuntu lucid lucid/main
|
88
|
-
|
89
|
-
### Centos (Redhat and rpm-based systems)
|
90
|
-
|
91
|
-
Add these lines to /etc/yum.repos.d/couchbase.repo using the correct architecture
|
92
|
-
|
93
|
-
[couchbase]
|
94
|
-
name = Couchbase package repository
|
95
|
-
baseurl = http://packages.couchbase.com/rpm/5.5/i386
|
96
|
-
|
97
|
-
[couchbase]
|
98
|
-
name = Couchbase package repository
|
99
|
-
baseurl = http://packages.couchbase.com/rpm/5.5/x86_64
|
100
|
-
|
101
|
-
Then to install libcouchbase itself, run:
|
102
|
-
|
103
|
-
$ sudo yum update && sudo yum install libcouchbase-devel
|
104
|
-
|
105
|
-
We have preview repositories for RPMs too, use them if you want to try
|
106
|
-
the latest version of libcouchbase:
|
107
|
-
|
108
|
-
[couchbase]
|
109
|
-
name = Couchbase package repository
|
110
|
-
baseurl = http://packages.couchbase.com/preview/rpm/5.5/i386
|
111
|
-
|
112
|
-
[couchbase]
|
113
|
-
name = Couchbase package repository
|
114
|
-
baseurl = http://packages.couchbase.com/preview/rpm/5.5/x86_64
|
115
|
-
|
116
|
-
### Windows
|
117
|
-
|
118
|
-
There are no additional dependencies for Windows systems. The gem carries
|
119
|
-
a prebuilt binary for it.
|
120
|
-
|
121
|
-
### Couchbase gem
|
122
|
-
|
123
|
-
Now install the couchbase gem itself
|
20
|
+
libcouchbase doesn't take much effort. After that you can install the
|
21
|
+
couchbase gem itself:
|
124
22
|
|
125
23
|
$ gem install couchbase
|
126
24
|
|
@@ -682,7 +580,7 @@ task and you will find all artifacts in `pkg/` directory:
|
|
682
580
|
[overview]: http://docs.couchbase.com/couchbase-sdk-ruby-1.3/index.html
|
683
581
|
[1]: http://couchbase.com/issues/browse/RCBC
|
684
582
|
[2]: http://freenode.net/irc_servers.shtml
|
685
|
-
[3]: http://
|
583
|
+
[3]: http://docs.couchbase.com/developer/c-2.4/download-install.html
|
686
584
|
[4]: https://github.com/mxcl/homebrew/pulls/avsej
|
687
585
|
[5]: http://code.google.com/p/memcached/wiki/BinaryProtocolRevamped
|
688
586
|
[6]: https://rubygems.org/gems/couchbase-model
|
data/RELEASE_NOTES.markdown
CHANGED
@@ -3,6 +3,13 @@
|
|
3
3
|
This document is a list of user visible feature changes and important
|
4
4
|
bugfixes. Do not forget to update this doc in every important patch.
|
5
5
|
|
6
|
+
## 1.3.11 (2015-01-08)
|
7
|
+
|
8
|
+
* [minor] Update crossbuild system to use cmake for libcouchbase
|
9
|
+
|
10
|
+
* [minor] Update to libcouchbase 2.4.5 and wire IO functions at
|
11
|
+
runtime
|
12
|
+
|
6
13
|
## 1.3.10 (2014-09-30)
|
7
14
|
|
8
15
|
* [major] Updates regarding libcouchbase 2.4.2. Bundle "bsdio-inl.c"
|
@@ -285,6 +285,17 @@ cb_params_store_init_item(struct cb_params_st *params, lcb_size_t idx,
|
|
285
285
|
params->cmd.store.items[idx].v.v0.cas = cas;
|
286
286
|
params->cmd.store.items[idx].v.v0.exptime = exptime;
|
287
287
|
params->npayload += RSTRING_LEN(key_obj) + RSTRING_LEN(value_obj) + sizeof(flags) + sizeof(exptime);
|
288
|
+
switch (params->cmd.store.operation) {
|
289
|
+
case LCB_ADD:
|
290
|
+
params->cmd.store.items[idx].v.v0.cas = 0;
|
291
|
+
break;
|
292
|
+
case LCB_PREPEND:
|
293
|
+
case LCB_APPEND:
|
294
|
+
params->cmd.store.items[idx].v.v0.flags = 0;
|
295
|
+
break;
|
296
|
+
default:
|
297
|
+
break;
|
298
|
+
}
|
288
299
|
}
|
289
300
|
|
290
301
|
static int
|
@@ -890,6 +901,17 @@ do_params_build(VALUE ptr)
|
|
890
901
|
params->cmd.store.transcoder_opts = rb_hash_new();
|
891
902
|
cb_params_store_parse_options(params, opts);
|
892
903
|
cb_params_store_parse_arguments(params, argc, argv);
|
904
|
+
switch (params->cmd.store.operation) {
|
905
|
+
case LCB_ADD:
|
906
|
+
params->cmd.store.cas = 0;
|
907
|
+
break;
|
908
|
+
case LCB_PREPEND:
|
909
|
+
case LCB_APPEND:
|
910
|
+
params->cmd.store.flags = 0;
|
911
|
+
break;
|
912
|
+
default:
|
913
|
+
break;
|
914
|
+
}
|
893
915
|
break;
|
894
916
|
case cb_cmd_get:
|
895
917
|
params->cmd.get.quiet = params->bucket->quiet;
|
@@ -20,8 +20,6 @@
|
|
20
20
|
#ifndef _WIN32
|
21
21
|
#ifdef BUILD_EVENTMACHINE_PLUGIN
|
22
22
|
|
23
|
-
#include "libcouchbase/bsdio-inl.c"
|
24
|
-
|
25
23
|
VALUE cb_mEm;
|
26
24
|
VALUE cb_cEmSocket;
|
27
25
|
VALUE em_cPeriodicTimer;
|
@@ -411,6 +409,7 @@ lcb_destroy_io_opts(struct lcb_io_opt_st *iops)
|
|
411
409
|
LIBCOUCHBASE_API lcb_error_t
|
412
410
|
cb_create_ruby_em_io_opts(int version, lcb_io_opt_t *io, void *arg)
|
413
411
|
{
|
412
|
+
lcb_bsd_procs procs;
|
414
413
|
struct lcb_io_opt_st *ret;
|
415
414
|
rb_em_loop *loop;
|
416
415
|
struct cb_bucket_st *bucket = arg;
|
@@ -433,7 +432,14 @@ cb_create_ruby_em_io_opts(int version, lcb_io_opt_t *io, void *arg)
|
|
433
432
|
/* consider that struct isn't allocated by the library,
|
434
433
|
* `need_cleanup' flag might be set in lcb_create() */
|
435
434
|
ret->v.v0.need_cleanup = 0;
|
436
|
-
|
435
|
+
lcb_iops_wire_bsd_impl2(&procs, 0);
|
436
|
+
ret->v.v0.recv = procs.recv;
|
437
|
+
ret->v.v0.recvv = procs.recvv;
|
438
|
+
ret->v.v0.send = procs.send;
|
439
|
+
ret->v.v0.sendv = procs.sendv;
|
440
|
+
ret->v.v0.socket = procs.socket0;
|
441
|
+
ret->v.v0.connect = procs.connect0;
|
442
|
+
ret->v.v0.close = procs.close;
|
437
443
|
ret->v.v0.delete_event = lcb_io_delete_event;
|
438
444
|
ret->v.v0.destroy_event = lcb_io_destroy_event;
|
439
445
|
ret->v.v0.create_event = lcb_io_create_event;
|
@@ -22,11 +22,11 @@ require 'rbconfig'
|
|
22
22
|
# RC_ARCHS doesn't work under bundler on MacOS.
|
23
23
|
if RUBY_PLATFORM =~ /darwin/ && defined?(RbConfig::ARCHFLAGS)
|
24
24
|
[RbConfig::CONFIG, RbConfig::MAKEFILE_CONFIG].each do |cfg|
|
25
|
-
cfg[
|
26
|
-
cfg[
|
27
|
-
cfg[
|
28
|
-
cfg[
|
29
|
-
cfg[
|
25
|
+
cfg['CFLAGS'].gsub!(RbConfig::ARCHFLAGS, '')
|
26
|
+
cfg['LDFLAGS'].gsub!(RbConfig::ARCHFLAGS, '')
|
27
|
+
cfg['LDSHARED'].gsub!(RbConfig::ARCHFLAGS, '')
|
28
|
+
cfg['LIBRUBY_LDSHARED'].gsub!(RbConfig::ARCHFLAGS, '')
|
29
|
+
cfg['configure_args'].gsub!(RbConfig::ARCHFLAGS, '')
|
30
30
|
end
|
31
31
|
end
|
32
32
|
|
@@ -39,9 +39,9 @@ def define(macro, value = nil)
|
|
39
39
|
$defs.push("-D #{[macro.upcase, value].compact.join('=')}")
|
40
40
|
end
|
41
41
|
|
42
|
-
($CFLAGS ||=
|
43
|
-
($LDFLAGS ||=
|
44
|
-
($LIBS ||=
|
42
|
+
($CFLAGS ||= '') << " #{ENV['CFLAGS']}"
|
43
|
+
($LDFLAGS ||= '') << " #{ENV['LDFLAGS']}"
|
44
|
+
($LIBS ||= '') << " #{ENV['LIBS']}"
|
45
45
|
|
46
46
|
$CFLAGS << ' -std=c99 -Wall -Wextra '
|
47
47
|
if ENV['DEBUG']
|
@@ -51,10 +51,9 @@ else
|
|
51
51
|
$LDFLAGS << ' -Wl,--strip-debug' if RbConfig::CONFIG['target_os'] =~ /mingw32/
|
52
52
|
end
|
53
53
|
|
54
|
-
|
55
54
|
if RbConfig::CONFIG['target_os'] =~ /mingw32/
|
56
55
|
$LDFLAGS << ' -static-libgcc'
|
57
|
-
dir_config(
|
56
|
+
dir_config('libcouchbase')
|
58
57
|
else
|
59
58
|
LIBDIR = RbConfig::CONFIG['libdir']
|
60
59
|
INCLUDEDIR = RbConfig::CONFIG['includedir']
|
@@ -88,8 +87,8 @@ else
|
|
88
87
|
HEADER_DIRS.unshift File.join(brew_prefix, 'include')
|
89
88
|
end
|
90
89
|
|
91
|
-
HEADER_DIRS.delete_if{|d| !File.
|
92
|
-
LIB_DIRS.delete_if{|d| !File.
|
90
|
+
HEADER_DIRS.delete_if { |d| !File.exist?(d) }
|
91
|
+
LIB_DIRS.delete_if { |d| !File.exist?(d) }
|
93
92
|
|
94
93
|
# it will find the libcouchbase likely. you can specify its path otherwise
|
95
94
|
#
|
@@ -99,12 +98,11 @@ else
|
|
99
98
|
#
|
100
99
|
# ruby extconf.rb [--with-libcouchbase-dir=<dir>]
|
101
100
|
#
|
102
|
-
dir_config(
|
101
|
+
dir_config('libcouchbase', HEADER_DIRS, LIB_DIRS)
|
103
102
|
end
|
104
103
|
|
105
|
-
|
106
104
|
if COMMON_HEADERS !~ /"ruby\.h"/
|
107
|
-
(COMMON_HEADERS ||=
|
105
|
+
(COMMON_HEADERS ||= '') << %(\n#include "ruby.h"\n)
|
108
106
|
end
|
109
107
|
|
110
108
|
if try_compile(<<-SRC)
|
@@ -122,13 +120,13 @@ if try_compile(<<-SRC)
|
|
122
120
|
return 0;
|
123
121
|
}
|
124
122
|
SRC
|
125
|
-
define(
|
123
|
+
define('HAVE_STDARG_PROTOTYPES')
|
126
124
|
end
|
127
125
|
|
128
126
|
def die(message)
|
129
|
-
STDERR.puts "\n#{
|
130
|
-
STDERR.puts "#{message.gsub(/^/,
|
131
|
-
STDERR.puts "#{
|
127
|
+
STDERR.puts "\n#{'*' * 70}"
|
128
|
+
STDERR.puts "#{message.gsub(/^/, '* ')}"
|
129
|
+
STDERR.puts "#{'*' * 70}\n\n"
|
132
130
|
abort
|
133
131
|
end
|
134
132
|
|
@@ -171,26 +169,26 @@ SRC
|
|
171
169
|
end
|
172
170
|
|
173
171
|
# just to add -lcouchbase properly
|
174
|
-
have_library(
|
175
|
-
have_header(
|
176
|
-
have_header(
|
177
|
-
have_header(
|
178
|
-
have_header(
|
179
|
-
have_header(
|
180
|
-
have_header(
|
181
|
-
|
182
|
-
have_type(
|
183
|
-
have_func(
|
184
|
-
have_func(
|
185
|
-
have_func(
|
186
|
-
have_func(
|
187
|
-
have_func(
|
188
|
-
have_func(
|
189
|
-
have_func(
|
190
|
-
have_func(
|
191
|
-
have_func(
|
192
|
-
have_func(
|
193
|
-
have_func(
|
194
|
-
define(
|
195
|
-
create_header(
|
196
|
-
create_makefile(
|
172
|
+
have_library('couchbase', 'lcb_iops_wire_bsd_impl2(NULL, 0)', 'libcouchbase/couchbase.h') || die(install_notice)
|
173
|
+
have_header('mach/mach_time.h')
|
174
|
+
have_header('stdint.h') || die('Failed to locate stdint.h')
|
175
|
+
have_header('sys/time.h')
|
176
|
+
have_header('fcntl.h')
|
177
|
+
have_header('sys/socket.h')
|
178
|
+
have_header('errno.h')
|
179
|
+
|
180
|
+
have_type('st_index_t')
|
181
|
+
have_func('clock_gettime')
|
182
|
+
have_func('gettimeofday')
|
183
|
+
have_func('QueryPerformanceCounter')
|
184
|
+
have_func('gethrtime')
|
185
|
+
have_func('rb_hash_lookup2')
|
186
|
+
have_func('rb_thread_fd_select')
|
187
|
+
have_func('rb_thread_blocking_region')
|
188
|
+
have_func('rb_thread_call_without_gvl')
|
189
|
+
have_func('poll', 'poll.h')
|
190
|
+
have_func('ppoll', 'poll.h')
|
191
|
+
have_func('rb_fiber_yield')
|
192
|
+
define('_GNU_SOURCE')
|
193
|
+
create_header('couchbase_config.h')
|
194
|
+
create_makefile('couchbase_ext')
|
@@ -27,8 +27,6 @@
|
|
27
27
|
#include <poll.h>
|
28
28
|
#endif
|
29
29
|
|
30
|
-
#include "libcouchbase/bsdio-inl.c"
|
31
|
-
|
32
30
|
/* events sorted array */
|
33
31
|
typedef struct rb_mt_event rb_mt_event;
|
34
32
|
struct rb_mt_event {
|
@@ -1041,6 +1039,7 @@ lcb_destroy_io_opts(struct lcb_io_opt_st *iops)
|
|
1041
1039
|
LIBCOUCHBASE_API lcb_error_t
|
1042
1040
|
cb_create_ruby_mt_io_opts(int version, lcb_io_opt_t *io, void *arg)
|
1043
1041
|
{
|
1042
|
+
lcb_bsd_procs procs;
|
1044
1043
|
struct lcb_io_opt_st *ret;
|
1045
1044
|
rb_mt_loop *loop;
|
1046
1045
|
(void)arg;
|
@@ -1059,7 +1058,15 @@ cb_create_ruby_mt_io_opts(int version, lcb_io_opt_t *io, void *arg)
|
|
1059
1058
|
/* consider that struct isn't allocated by the library,
|
1060
1059
|
* `need_cleanup' flag might be set in lcb_create() */
|
1061
1060
|
ret->v.v0.need_cleanup = 0;
|
1062
|
-
|
1061
|
+
lcb_iops_wire_bsd_impl2(&procs, 0);
|
1062
|
+
ret->v.v0.recv = procs.recv;
|
1063
|
+
ret->v.v0.recvv = procs.recvv;
|
1064
|
+
ret->v.v0.send = procs.send;
|
1065
|
+
ret->v.v0.sendv = procs.sendv;
|
1066
|
+
ret->v.v0.socket = procs.socket0;
|
1067
|
+
ret->v.v0.connect = procs.connect0;
|
1068
|
+
ret->v.v0.close = procs.close;
|
1069
|
+
|
1063
1070
|
ret->v.v0.delete_event = lcb_io_delete_event;
|
1064
1071
|
ret->v.v0.destroy_event = lcb_io_destroy_event;
|
1065
1072
|
ret->v.v0.create_event = lcb_io_create_event;
|
data/lib/couchbase/version.rb
CHANGED
data/tasks/compile.rake
CHANGED
@@ -16,7 +16,7 @@
|
|
16
16
|
#
|
17
17
|
|
18
18
|
gem 'rake-compiler', '>= 0.7.5'
|
19
|
-
require
|
19
|
+
require 'rake/extensiontask'
|
20
20
|
|
21
21
|
def gemspec
|
22
22
|
@clean_gemspec ||= eval(File.read(File.expand_path('../../couchbase.gemspec', __FILE__)))
|
@@ -47,17 +47,17 @@ class Platform
|
|
47
47
|
|
48
48
|
def short_versions
|
49
49
|
res = []
|
50
|
-
each_version do |
|
50
|
+
each_version do |_long, short|
|
51
51
|
res << short
|
52
52
|
end
|
53
53
|
res
|
54
54
|
end
|
55
55
|
end
|
56
56
|
|
57
|
-
recent =
|
57
|
+
recent = '2.0.0-p353'
|
58
58
|
CROSS_PLATFORMS = [
|
59
59
|
Platform.new(:name => 'x64-mingw32', :host => 'x86_64-w64-mingw32', :versions => %w(1.9.3-p484 2.0.0-p353 2.1.0)),
|
60
|
-
Platform.new(:name => 'x86-mingw32', :host => 'i686-w64-mingw32', :versions => %w(1.8.7-p374 1.9.3-p484 2.0.0-p353 2.1.0))
|
60
|
+
Platform.new(:name => 'x86-mingw32', :host => 'i686-w64-mingw32', :versions => %w(1.8.7-p374 1.9.3-p484 2.0.0-p353 2.1.0))
|
61
61
|
]
|
62
62
|
|
63
63
|
# Setup compile tasks. Configuration can be passed via ENV.
|
@@ -69,16 +69,16 @@ CROSS_PLATFORMS = [
|
|
69
69
|
#
|
70
70
|
# rake compile with_libcouchbase_dir=/opt/couchbase
|
71
71
|
#
|
72
|
-
Rake::ExtensionTask.new(
|
72
|
+
Rake::ExtensionTask.new('couchbase_ext', gemspec) do |ext|
|
73
73
|
ext.cross_compile = true
|
74
74
|
ext.cross_platform = ENV['TARGET']
|
75
75
|
if ENV['RUBY_CC_VERSION']
|
76
|
-
ext.lib_dir =
|
76
|
+
ext.lib_dir = 'lib/couchbase'
|
77
77
|
end
|
78
78
|
ext.cross_compiling do |spec|
|
79
|
-
spec.files.delete(
|
80
|
-
spec.files.push(
|
81
|
-
spec.files.push(Dir[
|
79
|
+
spec.files.delete('lib/couchbase/couchbase_ext.so')
|
80
|
+
spec.files.push('lib/couchbase_ext.rb', Dir['lib/couchbase/*/couchbase_ext.so'])
|
81
|
+
spec.files.push(Dir['lib/couchbase/*/couchbase_ext.so'])
|
82
82
|
file "#{ext.tmp_dir}/#{ext.cross_platform}/stage/lib/couchbase_ext.rb", &version_router
|
83
83
|
end
|
84
84
|
|
@@ -86,7 +86,7 @@ Rake::ExtensionTask.new("couchbase_ext", gemspec) do |ext|
|
|
86
86
|
|
87
87
|
ENV.each do |key, val|
|
88
88
|
next unless key =~ /\Awith_(\w+)\z/i
|
89
|
-
opt =
|
89
|
+
opt = Regexp.last_match[1].downcase.tr('_', '-')
|
90
90
|
if File.directory?(path = File.expand_path(val))
|
91
91
|
ext.config_options << "--with-#{opt}=#{path}"
|
92
92
|
else
|
@@ -104,30 +104,30 @@ require 'mini_portile'
|
|
104
104
|
require 'rake/extensioncompiler'
|
105
105
|
|
106
106
|
class MiniPortile
|
107
|
-
|
107
|
+
alias_method :cook_without_checkpoint, :cook
|
108
108
|
def cook
|
109
109
|
checkpoint = "ports/.#{name}-#{version}-#{host}.installed"
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
110
|
+
return if File.exist?(checkpoint)
|
111
|
+
cook_without_checkpoint
|
112
|
+
FileUtils.touch(checkpoint)
|
113
|
+
end
|
114
|
+
|
115
|
+
def configure
|
116
|
+
return if configured?
|
117
|
+
|
118
|
+
md5_file = File.join(tmp_path, 'configure.md5')
|
119
|
+
digest = Digest::MD5.hexdigest(computed_options)
|
120
|
+
File.open(md5_file, 'w') { |f| f.write digest }
|
121
|
+
|
122
|
+
execute('configure', %(perl cmake/configure #{computed_options}))
|
114
123
|
end
|
115
124
|
end
|
116
125
|
|
117
|
-
file
|
118
|
-
|
119
|
-
desc
|
120
|
-
task
|
121
|
-
vars =
|
122
|
-
'CC',
|
123
|
-
'CFLAGS',
|
124
|
-
'CPATH',
|
125
|
-
'CPP',
|
126
|
-
'CPPFLAGS',
|
127
|
-
'LDFLAGS',
|
128
|
-
'LIBRARY_PATH',
|
129
|
-
'PATH'
|
130
|
-
].reduce({}) do |h, v|
|
126
|
+
file 'lib/couchbase_ext.rb', &version_router
|
127
|
+
|
128
|
+
desc 'Package gem for windows'
|
129
|
+
task 'package:windows' => ['package', 'lib/couchbase_ext.rb'] do
|
130
|
+
vars = %w(CC CFLAGS CPATH CPP CPPFLAGS LDFLAGS LIBRARY_PATH PATH).each_with_object({}) do |v, h|
|
131
131
|
h[v] = ENV[v]
|
132
132
|
h
|
133
133
|
end
|
@@ -135,19 +135,14 @@ task "package:windows" => ["package", "lib/couchbase_ext.rb"] do
|
|
135
135
|
|
136
136
|
CROSS_PLATFORMS.each do |platform|
|
137
137
|
ENV['TARGET'] = platform.name
|
138
|
-
rm_rf(
|
139
|
-
mkdir_p(
|
140
|
-
recipe = MiniPortile.new(
|
138
|
+
rm_rf('tmp/ ports/')
|
139
|
+
mkdir_p('ports')
|
140
|
+
recipe = MiniPortile.new('libcouchbase', '2.4.5')
|
141
141
|
recipe.host = platform.host
|
142
142
|
recipe.files << "http://packages.couchbase.com/clients/c/libcouchbase-#{recipe.version}.tar.gz"
|
143
|
-
recipe.configure_options.push(
|
144
|
-
|
145
|
-
|
146
|
-
"--enable-ssl=no",
|
147
|
-
"--disable-cxx",
|
148
|
-
"--disable-plugins",
|
149
|
-
"--disable-examples",
|
150
|
-
"--disable-tools")
|
143
|
+
recipe.configure_options.push('--disable-cxx',
|
144
|
+
'--disable-tests',
|
145
|
+
'--enable-static')
|
151
146
|
recipe.cook
|
152
147
|
recipe.activate
|
153
148
|
platform.each_version do |long, short|
|
@@ -156,6 +151,6 @@ task "package:windows" => ["package", "lib/couchbase_ext.rb"] do
|
|
156
151
|
vars.each do |k, v|
|
157
152
|
ENV[k] = v
|
158
153
|
end
|
159
|
-
sh("env RUBY_CC_VERSION=#{platform.short_versions.join(
|
154
|
+
sh("env RUBY_CC_VERSION=#{platform.short_versions.join(':')} RBENV_VERSION=#{recent} rbenv exec rake cross native gem")
|
160
155
|
end
|
161
156
|
end
|
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: 1.3.
|
4
|
+
version: 1.3.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Couchbase
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-01-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: yaji
|
@@ -244,7 +244,6 @@ files:
|
|
244
244
|
- ext/couchbase_ext/get.c
|
245
245
|
- ext/couchbase_ext/gethrtime.c
|
246
246
|
- ext/couchbase_ext/http.c
|
247
|
-
- ext/couchbase_ext/libcouchbase/bsdio-inl.c
|
248
247
|
- ext/couchbase_ext/multithread_plugin.c
|
249
248
|
- ext/couchbase_ext/observe.c
|
250
249
|
- ext/couchbase_ext/result.c
|
@@ -1,223 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* Inline routines for common 'BSD'-style I/O for plugins.
|
3
|
-
*
|
4
|
-
* Include this file in your plugin and then call wire_lcb_bsd_impl on the
|
5
|
-
* plugin instance.
|
6
|
-
*/
|
7
|
-
|
8
|
-
static void
|
9
|
-
wire_lcb_bsd_impl(lcb_io_opt_t io);
|
10
|
-
|
11
|
-
#ifdef _WIN32
|
12
|
-
#include "wsaerr-inl.c"
|
13
|
-
static int
|
14
|
-
get_wserr(lcb_socket_t sock)
|
15
|
-
{
|
16
|
-
DWORD error = WSAGetLastError();
|
17
|
-
int ext = 0;
|
18
|
-
int len = sizeof(ext);
|
19
|
-
|
20
|
-
/* Retrieves extended error status and clear */
|
21
|
-
getsockopt(sock, SOL_SOCKET, SO_ERROR, (char *)&ext, &len);
|
22
|
-
return wsaerr_map_impl(error);
|
23
|
-
}
|
24
|
-
|
25
|
-
static lcb_ssize_t
|
26
|
-
recvv_impl(lcb_io_opt_t iops, lcb_socket_t sock,
|
27
|
-
struct lcb_iovec_st *iov, lcb_size_t niov)
|
28
|
-
{
|
29
|
-
DWORD flags = 0, nr;
|
30
|
-
WSABUF *bufptr = (WSABUF *)iov;
|
31
|
-
|
32
|
-
if (WSARecv(sock, bufptr, niov, &nr, &flags, NULL, NULL) == SOCKET_ERROR) {
|
33
|
-
iops->v.v0.error = get_wserr(sock);
|
34
|
-
if (iops->v.v0.error == ECONNRESET) {
|
35
|
-
return 0;
|
36
|
-
}
|
37
|
-
return -1;
|
38
|
-
}
|
39
|
-
|
40
|
-
(void)iops;
|
41
|
-
return (lcb_ssize_t)nr;
|
42
|
-
}
|
43
|
-
|
44
|
-
static lcb_ssize_t
|
45
|
-
recv_impl(lcb_io_opt_t iops, lcb_socket_t sock, void *buf, lcb_size_t nbuf,
|
46
|
-
int fl_unused)
|
47
|
-
{
|
48
|
-
WSABUF iov;
|
49
|
-
iov.len = nbuf;
|
50
|
-
iov.buf = buf;
|
51
|
-
(void)fl_unused;
|
52
|
-
return recvv_impl(iops, sock, (struct lcb_iovec_st *)&iov, 1);
|
53
|
-
}
|
54
|
-
|
55
|
-
static lcb_ssize_t
|
56
|
-
sendv_impl(lcb_io_opt_t iops, lcb_socket_t sock, struct lcb_iovec_st *iov,
|
57
|
-
lcb_size_t niov)
|
58
|
-
{
|
59
|
-
DWORD nw, fl = 0;
|
60
|
-
WSABUF *bufptr = (WSABUF *)iov;
|
61
|
-
if (WSASend(sock, bufptr, niov, &nw, fl, NULL, NULL) == SOCKET_ERROR) {
|
62
|
-
iops->v.v0.error = get_wserr(sock);
|
63
|
-
return -1;
|
64
|
-
}
|
65
|
-
return (lcb_ssize_t)nw;
|
66
|
-
}
|
67
|
-
|
68
|
-
static lcb_ssize_t
|
69
|
-
send_impl(lcb_io_opt_t iops, lcb_socket_t sock, const void *buf, lcb_size_t nbuf,
|
70
|
-
int flags)
|
71
|
-
{
|
72
|
-
WSABUF iov;
|
73
|
-
iov.buf = (void *)buf;
|
74
|
-
iov.len = nbuf;
|
75
|
-
(void)flags;
|
76
|
-
return sendv_impl(iops, sock, (struct lcb_iovec_st *)&iov, 1);
|
77
|
-
}
|
78
|
-
|
79
|
-
#else
|
80
|
-
static lcb_ssize_t
|
81
|
-
recvv_impl(lcb_io_opt_t iops, lcb_socket_t sock, struct lcb_iovec_st *iov,
|
82
|
-
lcb_size_t niov)
|
83
|
-
{
|
84
|
-
struct msghdr mh;
|
85
|
-
lcb_ssize_t ret;
|
86
|
-
|
87
|
-
memset(&mh, 0, sizeof(mh));
|
88
|
-
mh.msg_iov = (struct iovec *)iov;
|
89
|
-
mh.msg_iovlen = niov;
|
90
|
-
ret = recvmsg(sock, &mh, 0);
|
91
|
-
if (ret < 0) {
|
92
|
-
iops->v.v0.error = errno;
|
93
|
-
}
|
94
|
-
return ret;
|
95
|
-
}
|
96
|
-
|
97
|
-
static lcb_ssize_t
|
98
|
-
recv_impl(lcb_io_opt_t iops, lcb_socket_t sock, void *buf, lcb_size_t nbuf,
|
99
|
-
int flags)
|
100
|
-
{
|
101
|
-
lcb_ssize_t ret = recv(sock, buf, nbuf, flags);
|
102
|
-
if (ret < 0) {
|
103
|
-
iops->v.v0.error = errno;
|
104
|
-
}
|
105
|
-
return ret;
|
106
|
-
}
|
107
|
-
|
108
|
-
static lcb_ssize_t
|
109
|
-
sendv_impl(lcb_io_opt_t iops, lcb_socket_t sock, struct lcb_iovec_st *iov,
|
110
|
-
lcb_size_t niov)
|
111
|
-
{
|
112
|
-
struct msghdr mh;
|
113
|
-
lcb_ssize_t ret;
|
114
|
-
|
115
|
-
memset(&mh, 0, sizeof(mh));
|
116
|
-
mh.msg_iov = (struct iovec *)iov;
|
117
|
-
mh.msg_iovlen = niov;
|
118
|
-
ret = sendmsg(sock, &mh, 0);
|
119
|
-
if (ret < 0) {
|
120
|
-
iops->v.v0.error = errno;
|
121
|
-
}
|
122
|
-
return ret;
|
123
|
-
}
|
124
|
-
|
125
|
-
static lcb_ssize_t
|
126
|
-
send_impl(lcb_io_opt_t iops, lcb_socket_t sock, const void *buf, lcb_size_t nbuf,
|
127
|
-
int flags)
|
128
|
-
{
|
129
|
-
lcb_ssize_t ret = send(sock, buf, nbuf, flags);
|
130
|
-
if (ret < 0) {
|
131
|
-
iops->v.v0.error = errno;
|
132
|
-
}
|
133
|
-
return ret;
|
134
|
-
}
|
135
|
-
|
136
|
-
#endif
|
137
|
-
|
138
|
-
static int make_socket_nonblocking(lcb_socket_t sock)
|
139
|
-
{
|
140
|
-
#ifdef _WIN32
|
141
|
-
u_long nonblocking = 1;
|
142
|
-
if (ioctlsocket(sock, FIONBIO, &nonblocking) == SOCKET_ERROR) {
|
143
|
-
return -1;
|
144
|
-
}
|
145
|
-
#else
|
146
|
-
int flags;
|
147
|
-
if ((flags = fcntl(sock, F_GETFL, NULL)) < 0) {
|
148
|
-
return -1;
|
149
|
-
}
|
150
|
-
if (fcntl(sock, F_SETFL, flags | O_NONBLOCK) == -1) {
|
151
|
-
return -1;
|
152
|
-
}
|
153
|
-
#endif
|
154
|
-
return 0;
|
155
|
-
}
|
156
|
-
|
157
|
-
static lcb_socket_t
|
158
|
-
socket_impl(lcb_io_opt_t iops, int domain, int type, int protocol)
|
159
|
-
{
|
160
|
-
lcb_socket_t sock;
|
161
|
-
#ifdef _WIN32
|
162
|
-
sock = (lcb_socket_t)WSASocket(domain, type, protocol, NULL, 0, 0);
|
163
|
-
#else
|
164
|
-
sock = socket(domain, type, protocol);
|
165
|
-
#endif
|
166
|
-
if (sock == INVALID_SOCKET) {
|
167
|
-
iops->v.v0.error = errno;
|
168
|
-
} else {
|
169
|
-
if (make_socket_nonblocking(sock) != 0) {
|
170
|
-
#ifdef _WIN32
|
171
|
-
iops->v.v0.error = get_wserr(sock);
|
172
|
-
#else
|
173
|
-
iops->v.v0.error = errno;
|
174
|
-
#endif
|
175
|
-
iops->v.v0.close(iops, sock);
|
176
|
-
sock = INVALID_SOCKET;
|
177
|
-
}
|
178
|
-
}
|
179
|
-
return sock;
|
180
|
-
}
|
181
|
-
|
182
|
-
static void
|
183
|
-
close_impl(lcb_io_opt_t iops, lcb_socket_t sock)
|
184
|
-
{
|
185
|
-
(void)iops;
|
186
|
-
#ifdef _WIN32
|
187
|
-
closesocket(sock);
|
188
|
-
#else
|
189
|
-
close(sock);
|
190
|
-
#endif
|
191
|
-
}
|
192
|
-
|
193
|
-
static int
|
194
|
-
connect_impl(lcb_io_opt_t iops, lcb_socket_t sock, const struct sockaddr *name,
|
195
|
-
unsigned int namelen)
|
196
|
-
{
|
197
|
-
int ret;
|
198
|
-
|
199
|
-
#ifdef _WIN32
|
200
|
-
ret = WSAConnect(sock, name, (int)namelen, NULL, NULL, NULL, NULL);
|
201
|
-
if (ret == SOCKET_ERROR) {
|
202
|
-
iops->v.v0.error = get_wserr(sock);
|
203
|
-
}
|
204
|
-
#else
|
205
|
-
ret = connect(sock, name, (socklen_t)namelen);
|
206
|
-
if (ret < 0) {
|
207
|
-
iops->v.v0.error = errno;
|
208
|
-
}
|
209
|
-
#endif
|
210
|
-
return ret;
|
211
|
-
}
|
212
|
-
|
213
|
-
static void
|
214
|
-
wire_lcb_bsd_impl(lcb_io_opt_t io)
|
215
|
-
{
|
216
|
-
io->v.v0.recv = recv_impl;
|
217
|
-
io->v.v0.recvv = recvv_impl;
|
218
|
-
io->v.v0.send = send_impl;
|
219
|
-
io->v.v0.sendv = sendv_impl;
|
220
|
-
io->v.v0.socket = socket_impl;
|
221
|
-
io->v.v0.connect = connect_impl;
|
222
|
-
io->v.v0.close = close_impl;
|
223
|
-
}
|