lwtarantool 0.0.2
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.
- checksums.yaml +7 -0
- data/README.md +84 -0
- data/ext/lwtarantool/conn.c +314 -0
- data/ext/lwtarantool/depend +23 -0
- data/ext/lwtarantool/errors.c +24 -0
- data/ext/lwtarantool/extconf.rb +8 -0
- data/ext/lwtarantool/lwtarantool.c +12 -0
- data/ext/lwtarantool/lwtarantool.h +38 -0
- data/ext/lwtarantool/request.c +124 -0
- data/ext/lwtarantool/vendor/msgpuck/CMakeLists.txt +73 -0
- data/ext/lwtarantool/vendor/msgpuck/hints.c +674 -0
- data/ext/lwtarantool/vendor/msgpuck/msgpuck.c +375 -0
- data/ext/lwtarantool/vendor/msgpuck/msgpuck.h +2195 -0
- data/ext/lwtarantool/vendor/msgpuck/test/CMakeLists.txt +25 -0
- data/ext/lwtarantool/vendor/msgpuck/test/msgpuck.c +1126 -0
- data/ext/lwtarantool/vendor/msgpuck/test/test.c +105 -0
- data/ext/lwtarantool/vendor/msgpuck/test/test.h +123 -0
- data/ext/lwtarantool/vendor/tarantool-c/CMakeLists.txt +89 -0
- data/ext/lwtarantool/vendor/tarantool-c/cmake/FindMsgPuck.cmake +18 -0
- data/ext/lwtarantool/vendor/tarantool-c/cmake/FindSphinx.cmake +10 -0
- data/ext/lwtarantool/vendor/tarantool-c/doc/CMakeLists.txt +15 -0
- data/ext/lwtarantool/vendor/tarantool-c/doc/source/example.c +340 -0
- data/ext/lwtarantool/vendor/tarantool-c/include/CMakeLists.txt +6 -0
- data/ext/lwtarantool/vendor/tarantool-c/include/tarantool/tarantool.h +67 -0
- data/ext/lwtarantool/vendor/tarantool-c/include/tarantool/tnt_auth.h +72 -0
- data/ext/lwtarantool/vendor/tarantool-c/include/tarantool/tnt_buf.h +88 -0
- data/ext/lwtarantool/vendor/tarantool-c/include/tarantool/tnt_call.h +83 -0
- data/ext/lwtarantool/vendor/tarantool-c/include/tarantool/tnt_delete.h +52 -0
- data/ext/lwtarantool/vendor/tarantool-c/include/tarantool/tnt_execute.h +24 -0
- data/ext/lwtarantool/vendor/tarantool-c/include/tarantool/tnt_insert.h +62 -0
- data/ext/lwtarantool/vendor/tarantool-c/include/tarantool/tnt_io.h +67 -0
- data/ext/lwtarantool/vendor/tarantool-c/include/tarantool/tnt_iob.h +62 -0
- data/ext/lwtarantool/vendor/tarantool-c/include/tarantool/tnt_iter.h +301 -0
- data/ext/lwtarantool/vendor/tarantool-c/include/tarantool/tnt_mem.h +102 -0
- data/ext/lwtarantool/vendor/tarantool-c/include/tarantool/tnt_net.h +242 -0
- data/ext/lwtarantool/vendor/tarantool-c/include/tarantool/tnt_object.h +248 -0
- data/ext/lwtarantool/vendor/tarantool-c/include/tarantool/tnt_opt.h +138 -0
- data/ext/lwtarantool/vendor/tarantool-c/include/tarantool/tnt_ping.h +49 -0
- data/ext/lwtarantool/vendor/tarantool-c/include/tarantool/tnt_proto.h +295 -0
- data/ext/lwtarantool/vendor/tarantool-c/include/tarantool/tnt_reply.h +204 -0
- data/ext/lwtarantool/vendor/tarantool-c/include/tarantool/tnt_request.h +377 -0
- data/ext/lwtarantool/vendor/tarantool-c/include/tarantool/tnt_schema.h +165 -0
- data/ext/lwtarantool/vendor/tarantool-c/include/tarantool/tnt_select.h +59 -0
- data/ext/lwtarantool/vendor/tarantool-c/include/tarantool/tnt_stream.h +79 -0
- data/ext/lwtarantool/vendor/tarantool-c/include/tarantool/tnt_update.h +226 -0
- data/ext/lwtarantool/vendor/tarantool-c/include/tp.h +1998 -0
- data/ext/lwtarantool/vendor/tarantool-c/test/CMakeLists.txt +36 -0
- data/ext/lwtarantool/vendor/tarantool-c/test/common.c +233 -0
- data/ext/lwtarantool/vendor/tarantool-c/test/common.h +28 -0
- data/ext/lwtarantool/vendor/tarantool-c/test/plain_test.c +152 -0
- data/ext/lwtarantool/vendor/tarantool-c/test/tarantool_call.c +57 -0
- data/ext/lwtarantool/vendor/tarantool-c/test/tarantool_disconnect.c +31 -0
- data/ext/lwtarantool/vendor/tarantool-c/test/tarantool_tcp.c +840 -0
- data/ext/lwtarantool/vendor/tarantool-c/test/tarantool_unix.c +384 -0
- data/ext/lwtarantool/vendor/tarantool-c/test/test.c +72 -0
- data/ext/lwtarantool/vendor/tarantool-c/test/test.h +94 -0
- data/ext/lwtarantool/vendor/tarantool-c/test/tnt_assoc.c +6 -0
- data/ext/lwtarantool/vendor/tarantool-c/test/tnt_assoc.h +67 -0
- data/ext/lwtarantool/vendor/tarantool-c/third_party/PMurHash.c +317 -0
- data/ext/lwtarantool/vendor/tarantool-c/third_party/PMurHash.h +68 -0
- data/ext/lwtarantool/vendor/tarantool-c/third_party/base64.c +300 -0
- data/ext/lwtarantool/vendor/tarantool-c/third_party/base64.h +91 -0
- data/ext/lwtarantool/vendor/tarantool-c/third_party/mhash.h +589 -0
- data/ext/lwtarantool/vendor/tarantool-c/third_party/sha1.c +219 -0
- data/ext/lwtarantool/vendor/tarantool-c/third_party/sha1.h +24 -0
- data/ext/lwtarantool/vendor/tarantool-c/third_party/uri.c +6528 -0
- data/ext/lwtarantool/vendor/tarantool-c/third_party/uri.h +81 -0
- data/ext/lwtarantool/vendor/tarantool-c/tnt/CMakeLists.txt +83 -0
- data/ext/lwtarantool/vendor/tarantool-c/tnt/pmatomic.h +494 -0
- data/ext/lwtarantool/vendor/tarantool-c/tnt/tnt_assoc.c +9 -0
- data/ext/lwtarantool/vendor/tarantool-c/tnt/tnt_assoc.h +172 -0
- data/ext/lwtarantool/vendor/tarantool-c/tnt/tnt_auth.c +118 -0
- data/ext/lwtarantool/vendor/tarantool-c/tnt/tnt_buf.c +171 -0
- data/ext/lwtarantool/vendor/tarantool-c/tnt/tnt_call.c +79 -0
- data/ext/lwtarantool/vendor/tarantool-c/tnt/tnt_delete.c +52 -0
- data/ext/lwtarantool/vendor/tarantool-c/tnt/tnt_execute.c +60 -0
- data/ext/lwtarantool/vendor/tarantool-c/tnt/tnt_insert.c +60 -0
- data/ext/lwtarantool/vendor/tarantool-c/tnt/tnt_io.c +520 -0
- data/ext/lwtarantool/vendor/tarantool-c/tnt/tnt_iob.c +75 -0
- data/ext/lwtarantool/vendor/tarantool-c/tnt/tnt_iter.c +293 -0
- data/ext/lwtarantool/vendor/tarantool-c/tnt/tnt_mem.c +82 -0
- data/ext/lwtarantool/vendor/tarantool-c/tnt/tnt_net.c +336 -0
- data/ext/lwtarantool/vendor/tarantool-c/tnt/tnt_object.c +476 -0
- data/ext/lwtarantool/vendor/tarantool-c/tnt/tnt_opt.c +117 -0
- data/ext/lwtarantool/vendor/tarantool-c/tnt/tnt_ping.c +38 -0
- data/ext/lwtarantool/vendor/tarantool-c/tnt/tnt_proto_internal.h +43 -0
- data/ext/lwtarantool/vendor/tarantool-c/tnt/tnt_reply.c +300 -0
- data/ext/lwtarantool/vendor/tarantool-c/tnt/tnt_request.c +336 -0
- data/ext/lwtarantool/vendor/tarantool-c/tnt/tnt_schema.c +334 -0
- data/ext/lwtarantool/vendor/tarantool-c/tnt/tnt_select.c +58 -0
- data/ext/lwtarantool/vendor/tarantool-c/tnt/tnt_stream.c +71 -0
- data/ext/lwtarantool/vendor/tarantool-c/tnt/tnt_update.c +247 -0
- data/ext/lwtarantool/vendor/tarantool-c/tntrpl/CMakeLists.txt +69 -0
- data/ext/lwtarantool/vendor/tarantool-c/tntrpl/tnt_dir.c +173 -0
- data/ext/lwtarantool/vendor/tarantool-c/tntrpl/tnt_dir.h +58 -0
- data/ext/lwtarantool/vendor/tarantool-c/tntrpl/tnt_log.c +329 -0
- data/ext/lwtarantool/vendor/tarantool-c/tntrpl/tnt_log.h +119 -0
- data/ext/lwtarantool/vendor/tarantool-c/tntrpl/tnt_rpl.c +189 -0
- data/ext/lwtarantool/vendor/tarantool-c/tntrpl/tnt_rpl.h +47 -0
- data/ext/lwtarantool/vendor/tarantool-c/tntrpl/tnt_snapshot.c +163 -0
- data/ext/lwtarantool/vendor/tarantool-c/tntrpl/tnt_snapshot.h +50 -0
- data/ext/lwtarantool/vendor/tarantool-c/tntrpl/tnt_xlog.c +163 -0
- data/ext/lwtarantool/vendor/tarantool-c/tntrpl/tnt_xlog.h +50 -0
- data/lib/lwtarantool/connection.rb +84 -0
- data/lib/lwtarantool/request.rb +58 -0
- data/lib/lwtarantool.rb +23 -0
- metadata +164 -0
@@ -0,0 +1,226 @@
|
|
1
|
+
#ifndef TNT_UPDATE_H_INCLUDED
|
2
|
+
#define TNT_UPDATE_H_INCLUDED
|
3
|
+
|
4
|
+
/*
|
5
|
+
* Redistribution and use in source and binary forms, with or
|
6
|
+
* without modification, are permitted provided that the following
|
7
|
+
* conditions are met:
|
8
|
+
*
|
9
|
+
* 1. Redistributions of source code must retain the above
|
10
|
+
* copyright notice, this list of conditions and the
|
11
|
+
* following disclaimer.
|
12
|
+
*
|
13
|
+
* 2. Redistributions in binary form must reproduce the above
|
14
|
+
* copyright notice, this list of conditions and the following
|
15
|
+
* disclaimer in the documentation and/or other materials
|
16
|
+
* provided with the distribution.
|
17
|
+
*
|
18
|
+
* THIS SOFTWARE IS PROVIDED BY <COPYRIGHT HOLDER> ``AS IS'' AND
|
19
|
+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
20
|
+
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
21
|
+
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
22
|
+
* <COPYRIGHT HOLDER> OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
23
|
+
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
24
|
+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
25
|
+
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
26
|
+
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
27
|
+
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
28
|
+
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
|
29
|
+
* THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
30
|
+
* SUCH DAMAGE.
|
31
|
+
*/
|
32
|
+
|
33
|
+
#include <tarantool/tnt_stream.h>
|
34
|
+
|
35
|
+
/**
|
36
|
+
* \file tnt_update.h
|
37
|
+
* \brief Update operation
|
38
|
+
*/
|
39
|
+
|
40
|
+
/**
|
41
|
+
* \brief Generate and write update operation with predefined
|
42
|
+
*
|
43
|
+
* \param s stream pointer
|
44
|
+
* \param space space no
|
45
|
+
* \param index index no
|
46
|
+
* \param key key to update
|
47
|
+
* \param ops ops to update (tnt_object)
|
48
|
+
*
|
49
|
+
* \returns count of bytes written
|
50
|
+
* \retval -1 oom
|
51
|
+
* \sa tnt_update_cointainer
|
52
|
+
* \sa tnt_update_cointainer_close
|
53
|
+
*/
|
54
|
+
ssize_t
|
55
|
+
tnt_update(struct tnt_stream *s, uint32_t space, uint32_t index,
|
56
|
+
struct tnt_stream *key, struct tnt_stream *ops);
|
57
|
+
|
58
|
+
/**
|
59
|
+
* \brief Add bit operation for update to tnt_object
|
60
|
+
*
|
61
|
+
* \param ops operation container
|
62
|
+
* \param fieldno field number
|
63
|
+
* \param op operation ('&', '|', '^')
|
64
|
+
* \param value value for update op
|
65
|
+
*
|
66
|
+
* \returns count of bytes written
|
67
|
+
* \retval -1 oom
|
68
|
+
* \sa tnt_update_cointainer
|
69
|
+
* \sa tnt_update_cointainer_close
|
70
|
+
*/
|
71
|
+
ssize_t
|
72
|
+
tnt_update_bit(struct tnt_stream *ops, uint32_t fieldno, char op,
|
73
|
+
uint64_t value);
|
74
|
+
|
75
|
+
/**
|
76
|
+
* \brief Add int arithmetic operation for update to tnt_object
|
77
|
+
*
|
78
|
+
* \param ops operation container
|
79
|
+
* \param fieldno field number
|
80
|
+
* \param op operation ('+', '-')
|
81
|
+
* \param value value for update op
|
82
|
+
*
|
83
|
+
* \returns count of bytes written
|
84
|
+
* \retval -1 oom
|
85
|
+
* \sa tnt_update_cointainer
|
86
|
+
* \sa tnt_update_cointainer_close
|
87
|
+
*/
|
88
|
+
ssize_t
|
89
|
+
tnt_update_arith_int(struct tnt_stream *ops, uint32_t fieldno, char op,
|
90
|
+
int64_t value);
|
91
|
+
|
92
|
+
/**
|
93
|
+
* \brief Add float arithmetic operation for update to tnt_object
|
94
|
+
*
|
95
|
+
* \param ops operation container
|
96
|
+
* \param fieldno field number
|
97
|
+
* \param op operation ('+', '-')
|
98
|
+
* \param value value for update op
|
99
|
+
*
|
100
|
+
* \returns count of bytes written
|
101
|
+
* \retval -1 oom
|
102
|
+
* \sa tnt_update_cointainer
|
103
|
+
* \sa tnt_update_cointainer_close
|
104
|
+
*/
|
105
|
+
ssize_t
|
106
|
+
tnt_update_arith_float(struct tnt_stream *ops, uint32_t fieldno, char op,
|
107
|
+
float value);
|
108
|
+
|
109
|
+
/**
|
110
|
+
* \brief Add double arithmetic operation for update to tnt_object
|
111
|
+
*
|
112
|
+
* \param ops operation container
|
113
|
+
* \param fieldno field number
|
114
|
+
* \param op operation ('+', '-')
|
115
|
+
* \param value value for update op
|
116
|
+
*
|
117
|
+
* \returns count of bytes written
|
118
|
+
* \retval -1 oom
|
119
|
+
* \sa tnt_update_cointainer
|
120
|
+
* \sa tnt_update_cointainer_close
|
121
|
+
*/
|
122
|
+
ssize_t
|
123
|
+
tnt_update_arith_double(struct tnt_stream *ops, uint32_t fieldno, char op,
|
124
|
+
double value);
|
125
|
+
|
126
|
+
/**
|
127
|
+
* \brief Add delete operation for update to tnt_object
|
128
|
+
*
|
129
|
+
* \param ops operation container
|
130
|
+
* \param fieldno field number
|
131
|
+
* \param fieldco field count
|
132
|
+
*
|
133
|
+
* \returns count of bytes written
|
134
|
+
* \retval -1 oom
|
135
|
+
* \sa tnt_update_cointainer
|
136
|
+
* \sa tnt_update_cointainer_close
|
137
|
+
*/
|
138
|
+
ssize_t
|
139
|
+
tnt_update_delete(struct tnt_stream *ops, uint32_t fieldno,
|
140
|
+
uint32_t fieldco);
|
141
|
+
|
142
|
+
/**
|
143
|
+
* \brief Add insert before operation for update to tnt_object
|
144
|
+
*
|
145
|
+
* \param ops operation container
|
146
|
+
* \param fieldno field number
|
147
|
+
* \param val value to insert (tnt_object)
|
148
|
+
*
|
149
|
+
* \returns count of bytes written
|
150
|
+
* \retval -1 oom
|
151
|
+
* \sa tnt_update_cointainer
|
152
|
+
* \sa tnt_update_cointainer_close
|
153
|
+
*/
|
154
|
+
ssize_t
|
155
|
+
tnt_update_insert(struct tnt_stream *ops, uint32_t fieldno,
|
156
|
+
struct tnt_stream *val);
|
157
|
+
|
158
|
+
/**
|
159
|
+
* \brief Add assign operation for update to tnt_object
|
160
|
+
*
|
161
|
+
* \param ops operation container
|
162
|
+
* \param fieldno field number
|
163
|
+
* \param val value to assign (tnt_object)
|
164
|
+
*
|
165
|
+
* \returns count of bytes written
|
166
|
+
* \retval -1 oom
|
167
|
+
* \sa tnt_update_cointainer
|
168
|
+
* \sa tnt_update_cointainer_close
|
169
|
+
*/
|
170
|
+
ssize_t
|
171
|
+
tnt_update_assign(struct tnt_stream *ops, uint32_t fieldno,
|
172
|
+
struct tnt_stream *val);
|
173
|
+
|
174
|
+
/**
|
175
|
+
* \brief Add splice operation for update to tnt_object
|
176
|
+
*
|
177
|
+
* \param ops operation container
|
178
|
+
* \param fieldno field number
|
179
|
+
* \param position cut from
|
180
|
+
* \param offset number of bytes to cut
|
181
|
+
* \param buffer buffer to insert instead
|
182
|
+
* \param buffer_len buffer length
|
183
|
+
*
|
184
|
+
* \returns count of bytes written
|
185
|
+
* \retval -1 oom
|
186
|
+
* \sa tnt_update_cointainer
|
187
|
+
* \sa tnt_update_cointainer_close
|
188
|
+
*/
|
189
|
+
ssize_t
|
190
|
+
tnt_update_splice(struct tnt_stream *ops, uint32_t fieldno,
|
191
|
+
uint32_t position, uint32_t offset,
|
192
|
+
const char *buffer, size_t buffer_len);
|
193
|
+
|
194
|
+
/**
|
195
|
+
* \brief shortcut for tnt_object() with type == TNT_SBO_SPARSE
|
196
|
+
*/
|
197
|
+
struct tnt_stream *tnt_update_container(struct tnt_stream *ops);
|
198
|
+
|
199
|
+
/**
|
200
|
+
* \brief shortcut for tnt_object_container_close()
|
201
|
+
*/
|
202
|
+
struct tnt_stream *
|
203
|
+
tnt_update_container(struct tnt_stream *ops);
|
204
|
+
|
205
|
+
int tnt_update_container_close(struct tnt_stream *ops);
|
206
|
+
|
207
|
+
int tnt_update_container_reset(struct tnt_stream *ops);
|
208
|
+
|
209
|
+
/**
|
210
|
+
* \brief Generate and write upsert operation with predefined
|
211
|
+
*
|
212
|
+
* \param s stream pointer
|
213
|
+
* \param space space no
|
214
|
+
* \param tuple (tnt_object instance) msgpack array with tuple to insert to
|
215
|
+
* \param ops ops to update (tnt_object)
|
216
|
+
*
|
217
|
+
* \returns count of bytes written
|
218
|
+
* \retval -1 oom
|
219
|
+
* \sa tnt_update_cointainer
|
220
|
+
* \sa tnt_update_cointainer_close
|
221
|
+
*/
|
222
|
+
ssize_t
|
223
|
+
tnt_upsert(struct tnt_stream *s, uint32_t space,
|
224
|
+
struct tnt_stream *tuple, struct tnt_stream *ops);
|
225
|
+
|
226
|
+
#endif /* TNT_UPDATE_H_INCLUDED */
|