libcouchbase 1.2.3 → 1.2.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -0
- data/README.md +1 -1
- data/Rakefile +3 -2
- data/ext/Rakefile +1 -2
- data/lib/libcouchbase/connection.rb +6 -14
- data/lib/libcouchbase/ext/libcouchbase.rb +3 -3
- data/lib/libcouchbase/ext/libcouchbase_libuv.rb +5 -1
- data/lib/libcouchbase/ext/tasks.rb +18 -70
- data/lib/libcouchbase/version.rb +1 -1
- data/libcouchbase.gemspec +7 -0
- data/windows_build.md +36 -0
- metadata +5 -4
- data/ext/libcouchbase/configure.pl +0 -1
- data/lib/libcouchbase/ext/libcouchbase_iocp.rb +0 -26
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2e0fecefcadf6aba5e497d297195f7c75a8ac93d
|
4
|
+
data.tar.gz: 68a30faba8a468ab280aac7c8a7e387a0b59fbb1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 362de9a1a26005ab3b5e0cc43afb28245a45a2f12f659c8cbd2c7f6e76cd14c2d4ec43abd6de670545411ccf84e14ed6ebe6124662faab5de2a6e088aa7b6725
|
7
|
+
data.tar.gz: be6115fcb1f03c7a8f55dffe186d6d74c564c6197d2228f72398592532b5bb982afc2c645b17595eeeadc7de152c937cd7dc0f2770bf4324f27d5dd7f67eb6a0
|
data/.gitignore
CHANGED
data/README.md
CHANGED
data/Rakefile
CHANGED
@@ -27,8 +27,9 @@ end
|
|
27
27
|
|
28
28
|
desc 'Compile libcouchbase from submodule'
|
29
29
|
if FFI::Platform.windows?
|
30
|
-
task :compile
|
31
|
-
|
30
|
+
task :compile do
|
31
|
+
puts "See windows_build.md for build instructions"
|
32
|
+
end
|
32
33
|
else
|
33
34
|
task :compile => ["ext/libcouchbase/build/lib/libcouchbase_libuv.#{FFI::Platform::LIBSUFFIX}"]
|
34
35
|
CLOBBER.include("ext/libcouchbase/build/lib/libcouchbase_libuv.#{FFI::Platform::LIBSUFFIX}")
|
data/ext/Rakefile
CHANGED
@@ -12,8 +12,7 @@ task :default => :libcouchbase
|
|
12
12
|
|
13
13
|
desc "Compile libcouchbase from submodule"
|
14
14
|
if FFI::Platform.windows?
|
15
|
-
task :libcouchbase
|
16
|
-
CLOBBER.include("ext/bin/libcouchbase.#{FFI::Platform::LIBSUFFIX}")
|
15
|
+
task :libcouchbase do; end
|
17
16
|
else
|
18
17
|
task :libcouchbase => ["ext/libcouchbase/build/lib/libcouchbase_libuv.#{FFI::Platform::LIBSUFFIX}"]
|
19
18
|
CLOBBER.include("ext/libcouchbase/build/lib/libcouchbase_libuv.#{FFI::Platform::LIBSUFFIX}")
|
@@ -74,21 +74,13 @@ module Libcouchbase
|
|
74
74
|
@reactor.on_program_interrupt { destroy }
|
75
75
|
@io_ptr = FFI::MemoryPointer.new :pointer, 1
|
76
76
|
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
err = Ext.create_io_ops(@io_ptr, @io_opts)
|
83
|
-
else
|
84
|
-
@io_opts = Ext::Libuv::UVOptions.new
|
85
|
-
@io_opts[:version] = 0
|
86
|
-
@io_opts[:loop] = @reactor.handle
|
87
|
-
@io_opts[:start_stop_noop] = 1 # We want to control the start and stopping of the loop
|
88
|
-
|
89
|
-
err = Ext::Libuv.create_libuv_io_opts(0, @io_ptr, @io_opts)
|
90
|
-
end
|
77
|
+
# Configure Libuv plugin
|
78
|
+
@io_opts = Ext::Libuv::UVOptions.new
|
79
|
+
@io_opts[:version] = 0
|
80
|
+
@io_opts[:loop] = @reactor.handle
|
81
|
+
@io_opts[:start_stop_noop] = 1 # We want to control the start and stopping of the loop
|
91
82
|
|
83
|
+
err = Ext::Libuv.create_libuv_io_opts(0, @io_ptr, @io_opts)
|
92
84
|
if err != :success
|
93
85
|
raise Error.lookup(err), 'failed to allocate IO plugin'
|
94
86
|
end
|
@@ -4,13 +4,13 @@ require 'libcouchbase/ext/libcouchbase/enums'
|
|
4
4
|
module Libcouchbase::Ext
|
5
5
|
extend FFI::Library
|
6
6
|
if FFI::Platform.windows?
|
7
|
-
ffi_lib ::File.expand_path("../../../../ext/
|
8
|
-
require 'libcouchbase/ext/libcouchbase_iocp'
|
7
|
+
ffi_lib ::File.expand_path("../../../../ext/libcouchbase.dll", __FILE__)
|
9
8
|
else
|
10
9
|
ffi_lib ::File.expand_path("../../../../ext/libcouchbase/build/lib/libcouchbase.#{FFI::Platform::LIBSUFFIX}", __FILE__)
|
11
|
-
require 'libcouchbase/ext/libcouchbase_libuv'
|
12
10
|
end
|
13
11
|
|
12
|
+
require 'libcouchbase/ext/libcouchbase_libuv'
|
13
|
+
|
14
14
|
autoload :T, 'libcouchbase/ext/libcouchbase/t'
|
15
15
|
autoload :HttpRequestT, 'libcouchbase/ext/libcouchbase/http_request_t'
|
16
16
|
autoload :CONTIGBUF, 'libcouchbase/ext/libcouchbase/contigbuf'
|
@@ -4,7 +4,11 @@
|
|
4
4
|
|
5
5
|
module Libcouchbase::Ext::Libuv
|
6
6
|
extend FFI::Library
|
7
|
-
|
7
|
+
if FFI::Platform.windows?
|
8
|
+
ffi_lib ::File.expand_path("../../../../ext/libcouchbase_libuv.dll", __FILE__)
|
9
|
+
else
|
10
|
+
ffi_lib ::File.expand_path("../../../../ext/libcouchbase/build/lib/libcouchbase_libuv.#{FFI::Platform::LIBSUFFIX}", __FILE__)
|
11
|
+
end
|
8
12
|
|
9
13
|
# ref: http://docs.couchbase.com/sdk-api/couchbase-c-client-2.4.8/group__lcb-libuv.html
|
10
14
|
class UVOptions < FFI::Struct
|
@@ -13,79 +13,27 @@ module FFI::Platform
|
|
13
13
|
end
|
14
14
|
end
|
15
15
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
url = if FFI::Platform.x64?
|
21
|
-
"http://packages.couchbase.com/clients/c/libcouchbase-2.6.3_amd64_vc14.zip"
|
22
|
-
else
|
23
|
-
"http://packages.couchbase.com/clients/c/libcouchbase-2.6.3_x86_vc14.zip"
|
24
|
-
end
|
25
|
-
zip_file = File.expand_path("../../../../ext/libcouchbase.zip", __FILE__)
|
26
|
-
|
27
|
-
file zip_file do
|
28
|
-
print "downloading #{url}"
|
29
|
-
uri = URI(url)
|
30
|
-
Net::HTTP.start(uri.host, uri.port) do |http|
|
31
|
-
request = Net::HTTP::Get.new uri
|
32
|
-
|
33
|
-
http.request request do |response|
|
34
|
-
open File.expand_path("../../../../ext/libcouchbase.zip", __FILE__), 'wb' do |io|
|
35
|
-
response.read_body do |chunk|
|
36
|
-
io.write chunk
|
37
|
-
print '.'
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
# Extract the files
|
45
|
-
file 'ext/tmp' => zip_file do
|
46
|
-
begin
|
47
|
-
puts "\nextracting files..."
|
48
|
-
raise 'error extracting files' unless system(File.expand_path("../../../../ext/win-extract.bat", __FILE__))
|
49
|
-
ensure
|
50
|
-
# TODO:: remove dir
|
51
|
-
end
|
52
|
-
end
|
53
|
-
|
54
|
-
# Copy binary files to bin dir
|
55
|
-
file "ext/bin/libcouchbase.#{FFI::Platform::LIBSUFFIX}" => 'ext/tmp' do
|
56
|
-
Dir.chdir('ext/tmp') do |path|
|
57
|
-
dir = File.expand_path("../", Dir["**/libcouchbase.#{FFI::Platform::LIBSUFFIX}"].first)
|
58
|
-
FileUtils.mv dir, File.expand_path("../../../../ext/bin", __FILE__)
|
59
|
-
end
|
60
|
-
FileUtils.rm_rf(File.expand_path("../../../../ext/tmp", __FILE__))
|
61
|
-
end
|
62
|
-
else
|
63
|
-
# -----------
|
64
|
-
# UNIX BUILD
|
65
|
-
# -----------
|
66
|
-
|
67
|
-
# Ensure the submodule is cloned
|
68
|
-
file 'ext/libcouchbase/include' do
|
69
|
-
system 'git', 'submodule', 'update', '--init'
|
70
|
-
end
|
16
|
+
# Ensure the submodule is cloned
|
17
|
+
file 'ext/libcouchbase/include' do
|
18
|
+
system 'git', 'submodule', 'update', '--init'
|
19
|
+
end
|
71
20
|
|
72
|
-
|
73
|
-
|
74
|
-
|
21
|
+
file 'ext/libcouchbase/build' => 'ext/libcouchbase/include' do
|
22
|
+
FileUtils.mkdir('ext/libcouchbase/build')
|
23
|
+
end
|
75
24
|
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
end
|
81
|
-
raise 'could not find cmake on path' unless result
|
25
|
+
file 'ext/libcouchbase/build/makefile' => 'ext/libcouchbase/build' do
|
26
|
+
result = nil
|
27
|
+
Dir.chdir("ext/libcouchbase") do |path|
|
28
|
+
result = system './cmake/configure', '-with-libuv', ::File.expand_path('../../', ::Libuv::Ext.path_to_internal_libuv)
|
82
29
|
end
|
30
|
+
raise 'could not find cmake on path' unless result
|
31
|
+
end
|
83
32
|
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
end
|
89
|
-
raise 'make failed' unless result
|
33
|
+
file "ext/libcouchbase/build/lib/libcouchbase_libuv.#{FFI::Platform::LIBSUFFIX}" => 'ext/libcouchbase/build/makefile' do
|
34
|
+
result = nil
|
35
|
+
Dir.chdir('ext/libcouchbase/build') do |path|
|
36
|
+
result = system 'make'
|
90
37
|
end
|
38
|
+
raise 'make failed' unless result
|
91
39
|
end
|
data/lib/libcouchbase/version.rb
CHANGED
data/libcouchbase.gemspec
CHANGED
@@ -31,6 +31,10 @@ Gem::Specification.new do |gem|
|
|
31
31
|
gem.files = `git ls-files`.split("\n")
|
32
32
|
gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
33
33
|
|
34
|
+
if File.exist? 'ext/libcouchbase.dll'
|
35
|
+
gem.files += ['ext/libcouchbase.dll', 'ext/libcouchbase_libuv.dll']
|
36
|
+
end
|
37
|
+
|
34
38
|
# Add the submodule to the gem
|
35
39
|
relative_path = File.expand_path("../", __FILE__) + '/'
|
36
40
|
`git submodule --quiet foreach pwd`.split($\).each do |submodule_path|
|
@@ -58,4 +62,7 @@ Gem::Specification.new do |gem|
|
|
58
62
|
gem.files += submodule_files_paths
|
59
63
|
end
|
60
64
|
end
|
65
|
+
|
66
|
+
# Remove sym link (blows up on windows)
|
67
|
+
gem.files.delete('ext/libcouchbase/configure.pl')
|
61
68
|
end
|
data/windows_build.md
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
# Building libcouchbase on Windows
|
2
|
+
|
3
|
+
NOTE:: we are currently not supporting 32bit Windows installations
|
4
|
+
|
5
|
+
1. Install [Python 2.7 x64](https://www.python.org/downloads/)
|
6
|
+
1. Install [cmake](https://cmake.org/download/)
|
7
|
+
1. Install [OpenSSL x64 Dev](https://slproweb.com/products/Win32OpenSSL.html)
|
8
|
+
1. Install [git](https://git-scm.com/downloads)
|
9
|
+
1. `git clone https://github.com/libuv/libuv.git`
|
10
|
+
1. Add libuv, openssl, cmake and python to Path ENV VAR
|
11
|
+
1. Install [Build Tools for Visual Studio 2017](https://www.visualstudio.com/downloads/)
|
12
|
+
* Windows 10 SDK
|
13
|
+
* Visual C++ tools for cmake
|
14
|
+
* C++/CLI support
|
15
|
+
1. Build libuv (or use `gem install libuv` to automate)
|
16
|
+
* `git clone https://chromium.googlesource.com/external/gyp build/gyp`
|
17
|
+
* `vcbuild.bat vs2017 shared debug x64` -- libcouchbase looks for a debug build
|
18
|
+
* `vcbuild.bat vs2017 shared release x64`
|
19
|
+
1. `git clone https://github.com/couchbase/libcouchbase.git`
|
20
|
+
* `mkdir lcb-build`
|
21
|
+
* `cd lcb-build`
|
22
|
+
* `cmake -G "Visual Studio 15 Win64" ..\libcouchbase` (should include libuv + openssl)
|
23
|
+
* `cmake --build .`
|
24
|
+
|
25
|
+
Seems to also support: https://github.com/google/snappy
|
26
|
+
|
27
|
+
* `mkdir snappybuild && cd snappybuild && cmake -G "Visual Studio 15 Win64" ..\snappy`
|
28
|
+
* I couldn't work out how to have libcouchbase include this in the build.
|
29
|
+
|
30
|
+
I also had to modify `plugin-libuv.c` before this would compile on Windows
|
31
|
+
|
32
|
+
* Installed the Visual Studio GUI using VS Installer
|
33
|
+
* `#include "libcouchbase\plugins\io\bsdio-inl.c"`
|
34
|
+
* The linker has some dependencies that need to be removed such as: `OPTIMIZED.lib`
|
35
|
+
|
36
|
+
A pre-compiled version of libcouchbase.dll is shipped with the GEM
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: libcouchbase
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stephen von Takach
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-11-
|
11
|
+
date: 2017-11-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ffi
|
@@ -146,6 +146,7 @@ files:
|
|
146
146
|
- Rakefile
|
147
147
|
- ext/README.md
|
148
148
|
- ext/Rakefile
|
149
|
+
- ext/libcouchbase.dll
|
149
150
|
- ext/libcouchbase/.gitignore
|
150
151
|
- ext/libcouchbase/CMakeLists.txt
|
151
152
|
- ext/libcouchbase/CONTRIBUTING.md
|
@@ -170,7 +171,6 @@ files:
|
|
170
171
|
- ext/libcouchbase/cmake/defs.mk.in
|
171
172
|
- ext/libcouchbase/cmake/dtrace-instr-link.pl
|
172
173
|
- ext/libcouchbase/cmake/source_files.cmake
|
173
|
-
- ext/libcouchbase/configure.pl
|
174
174
|
- ext/libcouchbase/contrib/cJSON/cJSON.c
|
175
175
|
- ext/libcouchbase/contrib/cJSON/cJSON.h
|
176
176
|
- ext/libcouchbase/contrib/cbsasl/CMakeLists.txt
|
@@ -659,6 +659,7 @@ files:
|
|
659
659
|
- ext/libcouchbase/tools/docgen/seqgen.h
|
660
660
|
- ext/libcouchbase/tools/linenoise/linenoise.c
|
661
661
|
- ext/libcouchbase/tools/linenoise/linenoise.h
|
662
|
+
- ext/libcouchbase_libuv.dll
|
662
663
|
- lib/libcouchbase.rb
|
663
664
|
- lib/libcouchbase/bucket.rb
|
664
665
|
- lib/libcouchbase/callbacks.rb
|
@@ -723,7 +724,6 @@ files:
|
|
723
724
|
- lib/libcouchbase/ext/libcouchbase/valbuf.rb
|
724
725
|
- lib/libcouchbase/ext/libcouchbase/valbuf_u_buf.rb
|
725
726
|
- lib/libcouchbase/ext/libcouchbase/viewhandle.rb
|
726
|
-
- lib/libcouchbase/ext/libcouchbase_iocp.rb
|
727
727
|
- lib/libcouchbase/ext/libcouchbase_libuv.rb
|
728
728
|
- lib/libcouchbase/ext/tasks.rb
|
729
729
|
- lib/libcouchbase/n1ql.rb
|
@@ -751,6 +751,7 @@ files:
|
|
751
751
|
- spec/seed/2016-10-25T043505Z/2016-10-25T043505Z-full/bucket-default/node-127.0.0.1%3A8091/snapshot_markers.json
|
752
752
|
- spec/subdoc_spec.rb
|
753
753
|
- spec/view_spec.rb
|
754
|
+
- windows_build.md
|
754
755
|
homepage: https://github.com/cotag/libcouchbase
|
755
756
|
licenses:
|
756
757
|
- MIT
|
@@ -1 +0,0 @@
|
|
1
|
-
ext/libcouchbase/cmake/configure
|
@@ -1,26 +0,0 @@
|
|
1
|
-
|
2
|
-
# This file contains the structures required to configure libcouchbase to use
|
3
|
-
# windows IOCP for event IO
|
4
|
-
|
5
|
-
module Libcouchbase::Ext
|
6
|
-
|
7
|
-
# ref: http://docs.couchbase.com/sdk-api/couchbase-c-client-2.6.2/group__lcb-io-plugin-api.html
|
8
|
-
|
9
|
-
IOType = enum [
|
10
|
-
:IO_libevent, 0x02,
|
11
|
-
:IO_winsock, 0x03,
|
12
|
-
:IO_libev, 0x04,
|
13
|
-
:IO_select, 0x05,
|
14
|
-
:IO_winIOCP, 0x06,
|
15
|
-
:IO_libuv, 0x07
|
16
|
-
]
|
17
|
-
|
18
|
-
class IOOptions < FFI::Struct
|
19
|
-
layout :version, :int, # Always 0
|
20
|
-
:type, IOType, # Always IO_winIOCP
|
21
|
-
:cookie, :pointer
|
22
|
-
end
|
23
|
-
|
24
|
-
# pointer param returns IO opts structure
|
25
|
-
attach_function :create_io_ops, :lcb_create_io_ops, [:pointer, IOOptions.by_ref], ErrorT
|
26
|
-
end
|