libcouchbase-mapo 1.4.1

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 (104) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +20 -0
  3. data/.gitmodules +3 -0
  4. data/.rspec +1 -0
  5. data/.travis.yml +38 -0
  6. data/Gemfile +4 -0
  7. data/LICENSE +24 -0
  8. data/README.md +445 -0
  9. data/Rakefile +76 -0
  10. data/ext/README.md +6 -0
  11. data/ext/Rakefile +19 -0
  12. data/lib/libcouchbase.rb +40 -0
  13. data/lib/libcouchbase/bucket.rb +825 -0
  14. data/lib/libcouchbase/callbacks.rb +69 -0
  15. data/lib/libcouchbase/connection.rb +886 -0
  16. data/lib/libcouchbase/design_docs.rb +92 -0
  17. data/lib/libcouchbase/error.rb +68 -0
  18. data/lib/libcouchbase/ext/libcouchbase.rb +1175 -0
  19. data/lib/libcouchbase/ext/libcouchbase/cmdbase.rb +23 -0
  20. data/lib/libcouchbase/ext/libcouchbase/cmdcounter.rb +36 -0
  21. data/lib/libcouchbase/ext/libcouchbase/cmdendure.rb +26 -0
  22. data/lib/libcouchbase/ext/libcouchbase/cmdfts.rb +24 -0
  23. data/lib/libcouchbase/ext/libcouchbase/cmdget.rb +30 -0
  24. data/lib/libcouchbase/ext/libcouchbase/cmdgetreplica.rb +49 -0
  25. data/lib/libcouchbase/ext/libcouchbase/cmdhttp.rb +58 -0
  26. data/lib/libcouchbase/ext/libcouchbase/cmdn1ql.rb +40 -0
  27. data/lib/libcouchbase/ext/libcouchbase/cmdobseqno.rb +33 -0
  28. data/lib/libcouchbase/ext/libcouchbase/cmdobserve.rb +30 -0
  29. data/lib/libcouchbase/ext/libcouchbase/cmdstore.rb +40 -0
  30. data/lib/libcouchbase/ext/libcouchbase/cmdstoredur.rb +45 -0
  31. data/lib/libcouchbase/ext/libcouchbase/cmdsubdoc.rb +61 -0
  32. data/lib/libcouchbase/ext/libcouchbase/cmdverbosity.rb +29 -0
  33. data/lib/libcouchbase/ext/libcouchbase/cmdviewquery.rb +61 -0
  34. data/lib/libcouchbase/ext/libcouchbase/contigbuf.rb +14 -0
  35. data/lib/libcouchbase/ext/libcouchbase/create_st.rb +15 -0
  36. data/lib/libcouchbase/ext/libcouchbase/create_st0.rb +23 -0
  37. data/lib/libcouchbase/ext/libcouchbase/create_st1.rb +26 -0
  38. data/lib/libcouchbase/ext/libcouchbase/create_st2.rb +32 -0
  39. data/lib/libcouchbase/ext/libcouchbase/create_st3.rb +26 -0
  40. data/lib/libcouchbase/ext/libcouchbase/crst_u.rb +20 -0
  41. data/lib/libcouchbase/ext/libcouchbase/durability_opts_st_v.rb +11 -0
  42. data/lib/libcouchbase/ext/libcouchbase/durability_opts_t.rb +14 -0
  43. data/lib/libcouchbase/ext/libcouchbase/durabilityopt_sv0.rb +63 -0
  44. data/lib/libcouchbase/ext/libcouchbase/enums.rb +1007 -0
  45. data/lib/libcouchbase/ext/libcouchbase/fragbuf.rb +18 -0
  46. data/lib/libcouchbase/ext/libcouchbase/ftshandle.rb +7 -0
  47. data/lib/libcouchbase/ext/libcouchbase/histogram.rb +34 -0
  48. data/lib/libcouchbase/ext/libcouchbase/http_request_t.rb +7 -0
  49. data/lib/libcouchbase/ext/libcouchbase/keybuf.rb +20 -0
  50. data/lib/libcouchbase/ext/libcouchbase/multicmd_ctx.rb +30 -0
  51. data/lib/libcouchbase/ext/libcouchbase/mutation_token.rb +17 -0
  52. data/lib/libcouchbase/ext/libcouchbase/n1qlhandle.rb +7 -0
  53. data/lib/libcouchbase/ext/libcouchbase/n1qlparams.rb +7 -0
  54. data/lib/libcouchbase/ext/libcouchbase/respbase.rb +29 -0
  55. data/lib/libcouchbase/ext/libcouchbase/respcounter.rb +32 -0
  56. data/lib/libcouchbase/ext/libcouchbase/respendure.rb +49 -0
  57. data/lib/libcouchbase/ext/libcouchbase/respfts.rb +40 -0
  58. data/lib/libcouchbase/ext/libcouchbase/respget.rb +44 -0
  59. data/lib/libcouchbase/ext/libcouchbase/resphttp.rb +48 -0
  60. data/lib/libcouchbase/ext/libcouchbase/respmcversion.rb +38 -0
  61. data/lib/libcouchbase/ext/libcouchbase/respn1ql.rb +41 -0
  62. data/lib/libcouchbase/ext/libcouchbase/respobseqno.rb +52 -0
  63. data/lib/libcouchbase/ext/libcouchbase/respobserve.rb +41 -0
  64. data/lib/libcouchbase/ext/libcouchbase/respserverbase.rb +32 -0
  65. data/lib/libcouchbase/ext/libcouchbase/respstats.rb +38 -0
  66. data/lib/libcouchbase/ext/libcouchbase/respstore.rb +32 -0
  67. data/lib/libcouchbase/ext/libcouchbase/respstoredur.rb +38 -0
  68. data/lib/libcouchbase/ext/libcouchbase/respsubdoc.rb +35 -0
  69. data/lib/libcouchbase/ext/libcouchbase/respviewquery.rb +67 -0
  70. data/lib/libcouchbase/ext/libcouchbase/sdentry.rb +22 -0
  71. data/lib/libcouchbase/ext/libcouchbase/sdspec.rb +31 -0
  72. data/lib/libcouchbase/ext/libcouchbase/t.rb +7 -0
  73. data/lib/libcouchbase/ext/libcouchbase/valbuf.rb +22 -0
  74. data/lib/libcouchbase/ext/libcouchbase/valbuf_u_buf.rb +14 -0
  75. data/lib/libcouchbase/ext/libcouchbase/viewhandle.rb +7 -0
  76. data/lib/libcouchbase/ext/libcouchbase_libuv.rb +22 -0
  77. data/lib/libcouchbase/ext/tasks.rb +39 -0
  78. data/lib/libcouchbase/n1ql.rb +78 -0
  79. data/lib/libcouchbase/query_full_text.rb +147 -0
  80. data/lib/libcouchbase/query_n1ql.rb +123 -0
  81. data/lib/libcouchbase/query_view.rb +135 -0
  82. data/lib/libcouchbase/results_fiber.rb +281 -0
  83. data/lib/libcouchbase/results_native.rb +220 -0
  84. data/lib/libcouchbase/subdoc_request.rb +139 -0
  85. data/lib/libcouchbase/version.rb +5 -0
  86. data/libcouchbase.gemspec +68 -0
  87. data/spec/bucket_spec.rb +290 -0
  88. data/spec/connection_spec.rb +257 -0
  89. data/spec/design_docs_spec.rb +31 -0
  90. data/spec/error_spec.rb +26 -0
  91. data/spec/fts_spec.rb +135 -0
  92. data/spec/n1ql_spec.rb +206 -0
  93. data/spec/results_libuv_spec.rb +244 -0
  94. data/spec/results_native_spec.rb +259 -0
  95. data/spec/seed/2016-10-25T043505Z/2016-10-25T043505Z-full/bucket-default/design.json +1 -0
  96. data/spec/seed/2016-10-25T043505Z/2016-10-25T043505Z-full/bucket-default/node-127.0.0.1%3A8091/data-0000.cbb +0 -0
  97. data/spec/seed/2016-10-25T043505Z/2016-10-25T043505Z-full/bucket-default/node-127.0.0.1%3A8091/failover.json +1 -0
  98. data/spec/seed/2016-10-25T043505Z/2016-10-25T043505Z-full/bucket-default/node-127.0.0.1%3A8091/meta.json +1 -0
  99. data/spec/seed/2016-10-25T043505Z/2016-10-25T043505Z-full/bucket-default/node-127.0.0.1%3A8091/seqno.json +1 -0
  100. data/spec/seed/2016-10-25T043505Z/2016-10-25T043505Z-full/bucket-default/node-127.0.0.1%3A8091/snapshot_markers.json +1 -0
  101. data/spec/subdoc_spec.rb +192 -0
  102. data/spec/view_spec.rb +201 -0
  103. data/windows_build.md +36 -0
  104. metadata +265 -0
@@ -0,0 +1,18 @@
1
+ module Libcouchbase::Ext
2
+ # (Not documented)
3
+ #
4
+ # ## Fields:
5
+ # :iov ::
6
+ # (FFI::Pointer(*IOV)) An IOV array
7
+ # :niov ::
8
+ # (Integer) Number of elements in iov array
9
+ # :total_length ::
10
+ # (Integer) Total length of the items. This should be set, if known, to prevent the
11
+ # library from manually traversing the iov array to calculate the length.
12
+ class FRAGBUF < FFI::Struct
13
+ layout :iov, :pointer,
14
+ :niov, :uint,
15
+ :total_length, :uint
16
+ end
17
+
18
+ end
@@ -0,0 +1,7 @@
1
+ module Libcouchbase::Ext
2
+ # (Not documented)
3
+ class FTSHANDLE < FFI::Struct
4
+ layout :dummy, :char
5
+ end
6
+
7
+ end
@@ -0,0 +1,34 @@
1
+ module Libcouchbase::Ext
2
+ # (Not documented)
3
+ module HISTOGRAMWrappers
4
+ # @return [nil]
5
+ def destroy()
6
+ Libcouchbase::Ext.histogram_destroy(self)
7
+ end
8
+
9
+ # @param [Integer] duration
10
+ # @return [nil]
11
+ def record(duration)
12
+ Libcouchbase::Ext.histogram_record(self, duration)
13
+ end
14
+
15
+ # @param [FFI::Pointer(*Void)] cookie
16
+ # @param [Proc(callback_histogram_callback)] cb
17
+ # @return [nil]
18
+ def read(cookie, cb)
19
+ Libcouchbase::Ext.histogram_read(self, cookie, cb)
20
+ end
21
+
22
+ # @param [FFI::Pointer(*FILE)] stream
23
+ # @return [nil]
24
+ def print(stream)
25
+ Libcouchbase::Ext.histogram_print(self, stream)
26
+ end
27
+ end
28
+
29
+ class HISTOGRAM < FFI::Struct
30
+ include HISTOGRAMWrappers
31
+ layout :dummy, :char
32
+ end
33
+
34
+ end
@@ -0,0 +1,7 @@
1
+ module Libcouchbase::Ext
2
+ # (Not documented)
3
+ class HttpRequestT < FFI::Struct
4
+ layout :dummy, :char
5
+ end
6
+
7
+ end
@@ -0,0 +1,20 @@
1
+ module Libcouchbase::Ext
2
+ # (Not documented)
3
+ #
4
+ # ## Fields:
5
+ # :type ::
6
+ # (KVBUFTYPE) The type of key to provide. This can currently be LCB_KV_COPY (Default)
7
+ # to copy the key into the pipeline buffers, or LCB_KV_HEADER_AND_KEY
8
+ # to provide a buffer with the header storage and the key.
9
+ #
10
+ # TODO:
11
+ # Currently only LCB_KV_COPY should be used. LCB_KV_HEADER_AND_KEY is used
12
+ # internally but may be exposed later on
13
+ # :contig ::
14
+ # (CONTIGBUF)
15
+ class KEYBUF < FFI::Struct
16
+ layout :type, KVBUFTYPE,
17
+ :contig, CONTIGBUF.by_value
18
+ end
19
+
20
+ end
@@ -0,0 +1,30 @@
1
+ module Libcouchbase::Ext
2
+ # (Not documented)
3
+ #
4
+ # ## Fields:
5
+ # :addcmd ::
6
+ # (FFI::Pointer(*)) Add a command to the current context
7
+ # @param ctx the context
8
+ # @param cmd the command to add. Note that `cmd` may be a subclass of lcb_CMDBASE
9
+ # @return LCB_SUCCESS, or failure if a command could not be added.
10
+ # :done ::
11
+ # (FFI::Pointer(*)) Indicate that no more commands are added to this context, and that the
12
+ # context should assemble the packets and place them in the current
13
+ # scheduling context
14
+ # @param ctx The multi context
15
+ # @param cookie The cookie for all commands
16
+ # @return LCB_SUCCESS if scheduled successfully, or an error code if there
17
+ # was a problem constructing the packet(s).
18
+ # :fail ::
19
+ # (FFI::Pointer(*)) Indicate that no more commands should be added to this context, and that
20
+ # the context should not add its contents to the packet queues, but rather
21
+ # release its resources. Called if you don't want to actually perform
22
+ # the operations.
23
+ # @param ctx
24
+ class MULTICMDCTX < FFI::Struct
25
+ layout :addcmd, :pointer,
26
+ :done, :pointer,
27
+ :fail, :pointer
28
+ end
29
+
30
+ end
@@ -0,0 +1,17 @@
1
+ module Libcouchbase::Ext
2
+ # (Not documented)
3
+ #
4
+ # ## Fields:
5
+ # :uuid ::
6
+ # (Integer) < Use LCB_MUTATION_TOKEN_ID()
7
+ # :seqno ::
8
+ # (Integer) < Use LCB_MUTATION_TOKEN_SEQ()
9
+ # :vbid ::
10
+ # (Integer) < Use LCB_MUTATION_TOKEN_VB()
11
+ class MUTATIONTOKEN < FFI::Struct
12
+ layout :uuid, :ulong_long,
13
+ :seqno, :ulong_long,
14
+ :vbid, :ushort
15
+ end
16
+
17
+ end
@@ -0,0 +1,7 @@
1
+ module Libcouchbase::Ext
2
+ # (Not documented)
3
+ class N1QLHANDLE < FFI::Struct
4
+ layout :dummy, :char
5
+ end
6
+
7
+ end
@@ -0,0 +1,7 @@
1
+ module Libcouchbase::Ext
2
+ # (Not documented)
3
+ class N1QLPARAMS < FFI::Struct
4
+ layout :dummy, :char
5
+ end
6
+
7
+ end
@@ -0,0 +1,29 @@
1
+ module Libcouchbase::Ext
2
+ # (Not documented)
3
+ #
4
+ # ## Fields:
5
+ # :cookie ::
6
+ # (FFI::Pointer(*Void))
7
+ # :key ::
8
+ # (FFI::Pointer(*Void))
9
+ # :nkey ::
10
+ # (Integer)
11
+ # :cas ::
12
+ # (Integer)
13
+ # :rc ::
14
+ # (ErrorT)
15
+ # :version ::
16
+ # (Integer)
17
+ # :rflags ::
18
+ # (Integer)
19
+ class RESPBASE < FFI::Struct
20
+ layout :cookie, :pointer,
21
+ :key, :pointer,
22
+ :nkey, :ulong,
23
+ :cas, :ulong_long,
24
+ :rc, ErrorT,
25
+ :version, :ushort,
26
+ :rflags, :ushort
27
+ end
28
+
29
+ end
@@ -0,0 +1,32 @@
1
+ module Libcouchbase::Ext
2
+ # (Not documented)
3
+ #
4
+ # ## Fields:
5
+ # :cookie ::
6
+ # (FFI::Pointer(*Void))
7
+ # :key ::
8
+ # (FFI::Pointer(*Void))
9
+ # :nkey ::
10
+ # (Integer)
11
+ # :cas ::
12
+ # (Integer)
13
+ # :rc ::
14
+ # (ErrorT)
15
+ # :version ::
16
+ # (Integer)
17
+ # :rflags ::
18
+ # (Integer)
19
+ # :value ::
20
+ # (Integer) Contains the _current_ value after the operation was performed
21
+ class RESPCOUNTER < FFI::Struct
22
+ layout :cookie, :pointer,
23
+ :key, :pointer,
24
+ :nkey, :ulong,
25
+ :cas, :ulong_long,
26
+ :rc, ErrorT,
27
+ :version, :ushort,
28
+ :rflags, :ushort,
29
+ :value, :ulong_long
30
+ end
31
+
32
+ end
@@ -0,0 +1,49 @@
1
+ module Libcouchbase::Ext
2
+ # (Not documented)
3
+ #
4
+ # ## Fields:
5
+ # :cookie ::
6
+ # (FFI::Pointer(*Void))
7
+ # :key ::
8
+ # (FFI::Pointer(*Void))
9
+ # :nkey ::
10
+ # (Integer)
11
+ # :cas ::
12
+ # (Integer)
13
+ # :rc ::
14
+ # (ErrorT)
15
+ # :version ::
16
+ # (Integer)
17
+ # :rflags ::
18
+ # (Integer)
19
+ # :nresponses ::
20
+ # (Integer) Total number of polls (i.e. how many packets per server) did this
21
+ # operation require
22
+ # :exists_master ::
23
+ # (Integer) Whether this item exists in the master in its current form. This can be
24
+ # true even if #rc is not successful
25
+ # :persisted_master ::
26
+ # (Integer) True if item was persisted on the master node. This may be true even if
27
+ # #rc is not successful.
28
+ # :npersisted ::
29
+ # (Integer) Total number of nodes (including master) on which this mutation has
30
+ # been persisted. Valid even if #rc is not successful.
31
+ # :nreplicated ::
32
+ # (Integer) Total number of replica nodes to which this mutation has been replicated.
33
+ # Valid even if #rc is not successful.
34
+ class RESPENDURE < FFI::Struct
35
+ layout :cookie, :pointer,
36
+ :key, :pointer,
37
+ :nkey, :ulong,
38
+ :cas, :ulong_long,
39
+ :rc, ErrorT,
40
+ :version, :ushort,
41
+ :rflags, :ushort,
42
+ :nresponses, :ushort,
43
+ :exists_master, :uchar,
44
+ :persisted_master, :uchar,
45
+ :npersisted, :uchar,
46
+ :nreplicated, :uchar
47
+ end
48
+
49
+ end
@@ -0,0 +1,40 @@
1
+ module Libcouchbase::Ext
2
+ # (Not documented)
3
+ #
4
+ # ## Fields:
5
+ # :cookie ::
6
+ # (FFI::Pointer(*Void))
7
+ # :key ::
8
+ # (FFI::Pointer(*Void))
9
+ # :nkey ::
10
+ # (Integer)
11
+ # :cas ::
12
+ # (Integer)
13
+ # :rc ::
14
+ # (ErrorT)
15
+ # :version ::
16
+ # (Integer)
17
+ # :rflags ::
18
+ # (Integer)
19
+ # :row ::
20
+ # (String) A query hit, or response metadta
21
+ # (if #rflags contains @ref LCB_RESP_F_FINAL). The format of the row will
22
+ # be JSON, and should be decoded by a JSON decoded in your application.
23
+ # :nrow ::
24
+ # (Integer) Length of #row
25
+ # :htresp ::
26
+ # (RESPHTTP) Original HTTP response obejct
27
+ class RESPFTS < FFI::Struct
28
+ layout :cookie, :pointer,
29
+ :key, :pointer,
30
+ :nkey, :ulong,
31
+ :cas, :ulong_long,
32
+ :rc, ErrorT,
33
+ :version, :ushort,
34
+ :rflags, :ushort,
35
+ :row, :pointer,
36
+ :nrow, :ulong,
37
+ :htresp, RESPHTTP.by_ref
38
+ end
39
+
40
+ end
@@ -0,0 +1,44 @@
1
+ module Libcouchbase::Ext
2
+ # (Not documented)
3
+ #
4
+ # ## Fields:
5
+ # :cookie ::
6
+ # (FFI::Pointer(*Void))
7
+ # :key ::
8
+ # (FFI::Pointer(*Void))
9
+ # :nkey ::
10
+ # (Integer)
11
+ # :cas ::
12
+ # (Integer)
13
+ # :rc ::
14
+ # (ErrorT)
15
+ # :version ::
16
+ # (Integer)
17
+ # :rflags ::
18
+ # (Integer)
19
+ # :value ::
20
+ # (FFI::Pointer(*Void)) < Value buffer for the item
21
+ # :nvalue ::
22
+ # (Integer) < Length of value
23
+ # :bufh ::
24
+ # (FFI::Pointer(*Void))
25
+ # :datatype ::
26
+ # (Integer) < @private
27
+ # :itmflags ::
28
+ # (Integer) < User-defined flags for the item
29
+ class RESPGET < FFI::Struct
30
+ layout :cookie, :pointer,
31
+ :key, :pointer,
32
+ :nkey, :ulong,
33
+ :cas, :ulong_long,
34
+ :rc, ErrorT,
35
+ :version, :ushort,
36
+ :rflags, :ushort,
37
+ :value, :pointer,
38
+ :nvalue, :ulong,
39
+ :bufh, :pointer,
40
+ :datatype, :uchar,
41
+ :itmflags, :uint
42
+ end
43
+
44
+ end
@@ -0,0 +1,48 @@
1
+ module Libcouchbase::Ext
2
+ # (Not documented)
3
+ #
4
+ # ## Fields:
5
+ # :cookie ::
6
+ # (FFI::Pointer(*Void))
7
+ # :key ::
8
+ # (FFI::Pointer(*Void))
9
+ # :nkey ::
10
+ # (Integer)
11
+ # :cas ::
12
+ # (Integer)
13
+ # :rc ::
14
+ # (ErrorT)
15
+ # :version ::
16
+ # (Integer)
17
+ # :rflags ::
18
+ # (Integer)
19
+ # :htstatus ::
20
+ # (Integer) HTTP status code. The value is only valid if #rc is ::LCB_SUCCESS
21
+ # (if #rc is not LCB_SUCCESS then this field may be 0 as the response may
22
+ # have not been read/sent)
23
+ # :headers ::
24
+ # (FFI::Pointer(**CharS)) List of key-value headers. This field itself may be `NULL`. The list
25
+ # is terminated by a `NULL` pointer to indicate no more headers.
26
+ # :body ::
27
+ # (FFI::Pointer(*Void)) If @ref LCB_CMDHTTP_F_STREAM is true, contains the current chunk
28
+ # of response content. Otherwise, contains the entire response body.
29
+ # :nbody ::
30
+ # (Integer) Length of buffer in #body
31
+ # :htreq ::
32
+ # (HttpRequestT) @private
33
+ class RESPHTTP < FFI::Struct
34
+ layout :cookie, :pointer,
35
+ :key, :pointer,
36
+ :nkey, :ulong,
37
+ :cas, :ulong_long,
38
+ :rc, ErrorT,
39
+ :version, :ushort,
40
+ :rflags, :ushort,
41
+ :htstatus, :short,
42
+ :headers, :pointer,
43
+ :body, :pointer,
44
+ :nbody, :ulong,
45
+ :htreq, HttpRequestT.by_ref
46
+ end
47
+
48
+ end
@@ -0,0 +1,38 @@
1
+ module Libcouchbase::Ext
2
+ # (Not documented)
3
+ #
4
+ # ## Fields:
5
+ # :cookie ::
6
+ # (FFI::Pointer(*Void))
7
+ # :key ::
8
+ # (FFI::Pointer(*Void))
9
+ # :nkey ::
10
+ # (Integer)
11
+ # :cas ::
12
+ # (Integer)
13
+ # :rc ::
14
+ # (ErrorT)
15
+ # :version ::
16
+ # (Integer)
17
+ # :rflags ::
18
+ # (Integer)
19
+ # :server ::
20
+ # (String)
21
+ # :mcversion ::
22
+ # (String) < The version string
23
+ # :nversion ::
24
+ # (Integer) < Length of the version string
25
+ class RESPMCVERSION < FFI::Struct
26
+ layout :cookie, :pointer,
27
+ :key, :pointer,
28
+ :nkey, :ulong,
29
+ :cas, :ulong_long,
30
+ :rc, ErrorT,
31
+ :version, :ushort,
32
+ :rflags, :ushort,
33
+ :server, :string,
34
+ :mcversion, :string,
35
+ :nversion, :ulong
36
+ end
37
+
38
+ end