Tarantool
Get your data in RAM. Get compute close to data. Enjoy the performance.
 
Loading...
Searching...
No Matches
module.h
Go to the documentation of this file.
1#ifndef TARANTOOL_MODULE_H_INCLUDED
2#define TARANTOOL_MODULE_H_INCLUDED
3
4/*
5 * Copyright 2010-2016, Tarantool AUTHORS, please see AUTHORS file.
6 *
7 * Redistribution and use in source and binary forms, with or
8 * without modification, are permitted provided that the following
9 * conditions are met:
10 *
11 * 1. Redistributions of source code must retain the above
12 * copyright notice, this list of conditions and the
13 * following disclaimer.
14 *
15 * 2. Redistributions in binary form must reproduce the above
16 * copyright notice, this list of conditions and the following
17 * disclaimer in the documentation and/or other materials
18 * provided with the distribution.
19 *
20 * THIS SOFTWARE IS PROVIDED BY AUTHORS ``AS IS'' AND
21 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
22 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
24 * <COPYRIGHT HOLDER> OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
25 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
28 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
29 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
31 * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 * SUCH DAMAGE.
33 */
34
39#include <stddef.h>
40#include <stdarg.h> /* va_list */
41#include <errno.h>
42#include <stdint.h>
43#include <stdbool.h>
44#include <stdio.h> /* ssize_t for Apple */
45#include <sys/types.h> /* ssize_t */
46
47#if defined(__cplusplus)
48extern "C" {
49#endif /* defined(__cplusplus) */
50
51#include "lua.h" /* does not have extern C wrappers */
57#define PACKAGE_VERSION_MAJOR 3
61#define PACKAGE_VERSION_MINOR 3
65#define PACKAGE_VERSION_PATCH 0
70#define PACKAGE_VERSION "3.3.0-entrypoint-125-g4a866f64d"
75#define TZDATA_VERSION "2022a"
76
81#define SYSCONF_DIR "etc"
83#define INSTALL_PREFIX "/usr/local"
85#define BUILD_TYPE "Debug"
87#define BUILD_INFO "Linux-x86_64-Debug"
89#define BUILD_OPTIONS "cmake . -DCMAKE_INSTALL_PREFIX=/usr/local -DENABLE_BACKTRACE=TRUE"
91#define COMPILER_INFO "GNU-13.2.0"
93#define TARANTOOL_C_FLAGS " -fexceptions -funwind-tables -fasynchronous-unwind-tables -fno-common -msse2 -Wformat -Wformat-security -Werror=format-security -fstack-protector-strong -fPIC -fmacro-prefix-map=/home/runner/work/tarantool/tarantool=. -std=c11 -Wall -Wextra -Wno-gnu-alignof-expression -fno-gnu89-inline -Wno-cast-function-type -Werror -g -ggdb -O0 "
95#define TARANTOOL_CXX_FLAGS " -fexceptions -funwind-tables -fasynchronous-unwind-tables -fno-common -msse2 -Wformat -Wformat-security -Werror=format-security -fstack-protector-strong -fPIC -fmacro-prefix-map=/home/runner/work/tarantool/tarantool=. -std=c++11 -Wall -Wextra -Wno-invalid-offsetof -Wno-gnu-alignof-expression -Wno-cast-function-type -Werror -g -ggdb -O0 "
96
98#define MODULE_LIBDIR "/usr/local/lib/tarantool"
100#define MODULE_LUADIR "/usr/local/share/tarantool"
102#define MODULE_INCLUDEDIR "/usr/local/include/tarantool"
104#define MODULE_LUAPATH "/usr/local/share/tarantool/?.lua;/usr/local/share/tarantool/?/init.lua;/usr/share/tarantool/?.lua;/usr/share/tarantool/?/init.lua;/usr/local/share/lua/5.1/?.lua;/usr/local/share/lua/5.1/?/init.lua;/usr/share/lua/5.1/?.lua;/usr/share/lua/5.1/?/init.lua"
106#define MODULE_LIBPATH "/usr/local/lib/x86_64-linux-gnu/tarantool/?.so;/usr/local/lib/tarantool/?.so;/usr/lib/x86_64-linux-gnu/lua/luarocks/lib/tarantool/?.so;/usr/lib/x86_64-linux-gnu/tarantool/?.so;/usr/local/lib/x86_64-linux-gnu/lua/5.1/?.so;/usr/local/lib/lua/5.1/?.so;/usr/lib/x86_64-linux-gnu/lua/luarocks/lib/lua/5.1/?.so;/usr/lib/x86_64-linux-gnu/lua/5.1/?.so"
108#define MODULE_LIBSUFFIX ".so"
109
118#ifndef __has_feature
119# define __has_feature(x) 0
120#endif
127#ifndef __has_builtin
128# define __has_builtin(x) 0
129#endif
135#ifndef __has_attribute
136# define __has_attribute(x) 0
137#endif
143#ifndef __has_cpp_attribute
144# define __has_cpp_attribute(x) 0
145#endif
146
159#if __has_builtin(__builtin_expect) || defined(__GNUC__)
160# define likely(x) __builtin_expect(!! (x),1)
161# define unlikely(x) __builtin_expect(!! (x),0)
162#else
163# define likely(x) (x)
170# define unlikely(x) (x)
171#endif
172
193#if __has_builtin(__builtin_prefetch) || defined(__GNUC__)
194# define prefetch(addr, ...) (__builtin_prefetch(addr, __VA_ARGS__))
195#else
196# define prefetch(addr, ...) ((void) addr)
197#endif
198
204#if __has_builtin(__builtin_unreachable) || defined(__GNUC__)
205# define unreachable() (assert(0), __builtin_unreachable())
206#else
207# define unreachable() (assert(0))
208#endif
209
216#ifndef offsetof
217# if __has_builtin(__builtin_offsetof)
218# define offsetof(type, member) __builtin_offsetof(type, member)
219# else
220# define offsetof(type, member) ((size_t)&((type *)0)->member)
221# endif
222#endif /* offsetof */
223
228#ifndef container_of
229#define container_of(ptr, type, member) ({ \
230 const typeof( ((type *)0)->member ) *__mptr = (ptr); \
231 (type *)( (char *)__mptr - offsetof(type,member) );})
232#endif
233
247#if defined(__cplusplus)
248# include <stdalign.h>
249#endif
250#if !defined(alignas) && !defined(__alignas_is_defined)
251# if __has_feature(c_alignas) || (defined(__GNUC__) && __GNUC__ >= 5)
252# include <stdalign.h>
253# elif __has_attribute(aligned) || defined(__GNUC__)
254# define alignas(_n) __attribute__((aligned(_n)))
255# define __alignas_is_defined 1
256# else
257# define alignas(_n)
258# endif
259#endif
260
261#if !defined(alignof) && !defined(__alignof_is_defined)
262# if __has_feature(c_alignof) || (defined(__GNUC__) && __GNUC__ >= 5)
263# include <stdalign.h>
264# elif defined(__GNUC__)
265# define alignof(_T) __alignof(_T)
267# define __alignof_is_defined 1
269# else
275# define alignof(_T) offsetof(struct { char c; _T member; }, member)
277# define __alignof_is_defined 1
279# endif
280#endif
281
306#if defined(__cplusplus) && __has_cpp_attribute(maybe_unused)
307# define MAYBE_UNUSED [[maybe_unused]]
308#elif __has_attribute(unused) || defined(__GNUC__)
309# define MAYBE_UNUSED __attribute__((unused))
310#else
311# define MAYBE_UNUSED
312#endif
313
325#if defined(__cplusplus) && __has_cpp_attribute(nodiscard)
326# define NODISCARD [[nodiscard]]
327#elif __has_attribute(warn_unused_result) || defined(__GNUC__)
328# define NODISCARD __attribute__((warn_unused_result))
329#else
330# define NODISCARD
331#endif
332
343#if __has_attribute(noinline) || defined(__GNUC__)
344# define NOINLINE __attribute__((noinline))
345#else
346# define NOINLINE
347#endif
348
360#if __has_attribute(always_inline) || defined(__GNUC__)
361# define ALWAYS_INLINE inline __attribute__((always_inline))
362#else
363# define ALWAYS_INLINE inline
364#endif
365
377#if defined(__cplusplus) && __has_cpp_attribute(noreturn)
378# define NORETURN [[noreturn]]
379#elif __has_attribute(noreturn) || defined(__GNUC__)
380# define NORETURN __attribute__((noreturn))
381#else
382# define NORETURN
383#endif
384
390#if defined(__cplusplus) && __has_cpp_attribute(deprecated)
391# define DEPRECATED(_msg) [[deprecated(_msg)]]
392#elif __has_attribute(deprecated) || defined(__GNUC__)
393# define DEPREACTED __attribute__((deprecated(_msg)))
394#else
395# define DEPRECATED(_msg)
396#endif
397
401#if defined(__cplusplus) && defined(__GNUC__)
402# define API_EXPORT extern "C" __attribute__ ((nothrow, visibility ("default")))
403#elif defined(__cplusplus)
404# define API_EXPORT extern "C"
405#elif defined(__GNUC__)
406# define API_EXPORT extern __attribute__ ((nothrow, visibility ("default")))
407#else
408# define API_EXPORT extern
409#endif
410
418#if __has_attribute(format) || defined(__GNUC__)
419# define CFORMAT(_archetype, _stringindex, _firsttocheck) \
420 __attribute__((format(_archetype, _stringindex, _firsttocheck)))
421#else
422# define CFORMAT(archetype, stringindex, firsttocheck)
423#endif
424
437#if __has_attribute(packed) || defined(__GNUC__)
438# define PACKED __attribute__((packed))
439#elif defined(__CC_ARM)
440# define PACKED __packed
441#else
442# define PACKED
443#endif
444
450#if __has_feature(address_sanitizer)
451# define NO_SANITIZE_ADDRESS __attribute__((no_sanitize_address))
452#else
453# define NO_SANITIZE_ADDRESS
454#endif
455
471#if defined(__cplusplus) && __has_cpp_attribute(fallthrough)
472# define FALLTHROUGH [[fallthrough]]
473#elif __has_attribute(fallthrough) || (defined(__GNUC__) && __GNUC__ >= 7)
474# define FALLTHROUGH __attribute__((fallthrough))
475#else
476# define FALLTHROUGH
477#endif
478
501API_EXPORT int
502box_on_shutdown(void *arg, int (*new_handler)(void *),
503 int (*old_handler)(void *));
504
510 S_FATAL, /* do not use this value directly */
511 S_SYSERROR,
512 S_ERROR,
513 S_CRIT,
514 S_WARN,
515 S_INFO,
516 S_VERBOSE,
517 S_DEBUG,
518 say_level_MAX
519};
520
523 SF_PLAIN,
524 SF_JSON,
525 say_format_MAX
526};
527
531extern int log_level;
532
537extern void
538(*log_write_flightrec)(int level, const char *filename, int line,
539 const char *error, const char *format, va_list ap);
540
544static inline bool
546{
547 return level <= log_level;
548}
549
552typedef void (*sayfunc_t)(int, const char *, int, const char *,
553 const char *, ...);
554
556CFORMAT(printf, 5, 6) extern sayfunc_t _say;
557
562const char *
563_say_strerror(int errnum);
564
577#define say_file_line(level, file, line, error, format, ...) ({ \
578 if (say_log_level_is_enabled(level)) \
579 _say(level, file, line, error, format, ##__VA_ARGS__); })
580
591#define say(level, error, format, ...) ({ \
592 say_file_line(level, __FILE__, __LINE__, error, format, ##__VA_ARGS__); })
593
606#define say_error(format, ...) say(S_ERROR, NULL, format, ##__VA_ARGS__)
608#define say_crit(format, ...) say(S_CRIT, NULL, format, ##__VA_ARGS__)
610#define say_warn(format, ...) say(S_WARN, NULL, format, ##__VA_ARGS__)
612#define say_info(format, ...) say(S_INFO, NULL, format, ##__VA_ARGS__)
614#define say_verbose(format, ...) say(S_VERBOSE, NULL, format, ##__VA_ARGS__)
616#define say_debug(format, ...) say(S_DEBUG, NULL, format, ##__VA_ARGS__)
618#define say_syserror(format, ...) say(S_SYSERROR, _say_strerror(errno), \
619 format, ##__VA_ARGS__)
626struct fiber_attr;
627
634API_EXPORT struct fiber_attr *
636
643API_EXPORT void
644fiber_attr_delete(struct fiber_attr *fiber_attr);
645
652API_EXPORT int
653fiber_attr_setstacksize(struct fiber_attr *fiber_attr, size_t stack_size);
654
661API_EXPORT size_t
662fiber_attr_getstacksize(struct fiber_attr *fiber_attr);
663
664struct fiber;
669typedef int (*fiber_func)(va_list);
670
674API_EXPORT struct fiber *
676
693API_EXPORT struct fiber *
694fiber_new(const char *name, fiber_func f);
695
712API_EXPORT struct fiber *
713fiber_new_ex(const char *name, const struct fiber_attr *fiber_attr, fiber_func f);
714
723API_EXPORT void
725
734API_EXPORT void
735fiber_start(struct fiber *callee, ...);
736
745API_EXPORT void
746fiber_set_ctx(struct fiber *f, void *f_arg);
747
757API_EXPORT void *
758fiber_get_ctx(struct fiber *f);
759
765API_EXPORT void
766fiber_wakeup(struct fiber *f);
767
781API_EXPORT void
782fiber_cancel(struct fiber *f);
783
789API_EXPORT bool
791
803API_EXPORT void
804fiber_set_joinable(struct fiber *fiber, bool yesno);
805
818API_EXPORT int
819fiber_join(struct fiber *f);
820
836API_EXPORT int
837fiber_join_timeout(struct fiber *f, double timeout);
838
846API_EXPORT void
847fiber_sleep(double s);
848
853API_EXPORT bool
855
860API_EXPORT double
862
867API_EXPORT int64_t
869
874API_EXPORT double
876
881API_EXPORT int64_t
883
887API_EXPORT void
889
896API_EXPORT void
897fiber_set_name_n(struct fiber *fiber, const char *name, uint32_t len);
898
904API_EXPORT const char *
905fiber_name(const struct fiber *fiber);
906
911API_EXPORT uint64_t
912fiber_id(const struct fiber *fiber);
913
918API_EXPORT uint64_t
919fiber_csw(const struct fiber *fiber);
920
930API_EXPORT struct fiber *
931fiber_find(uint64_t fid);
932
979API_EXPORT size_t
981
993API_EXPORT void *
994box_region_alloc(size_t size);
995
1004API_EXPORT void *
1005box_region_aligned_alloc(size_t size, size_t alignment);
1006
1010API_EXPORT void
1012
1026struct fiber_cond;
1027
1034struct fiber_cond *
1036
1041void
1042fiber_cond_delete(struct fiber_cond *cond);
1043
1049void
1050fiber_cond_signal(struct fiber_cond *cond);
1051
1056void
1057fiber_cond_broadcast(struct fiber_cond *cond);
1058
1071int
1072fiber_cond_wait_timeout(struct fiber_cond *cond, double timeout);
1073
1078int
1079fiber_cond_wait(struct fiber_cond *cond);
1080
1084enum {
1089};
1090
1101API_EXPORT int
1102coio_wait(int fd, int event, double timeout);
1103
1108API_EXPORT int
1110
1139ssize_t
1140coio_call(ssize_t (*func)(va_list), ...);
1141
1142struct addrinfo;
1143
1158int
1159coio_getaddrinfo(const char *host, const char *port,
1160 const struct addrinfo *hints, struct addrinfo **res,
1161 double timeout);
1165typedef struct ibuf box_ibuf_t;
1166
1173API_EXPORT void *
1174box_ibuf_reserve(box_ibuf_t *ibuf, size_t size);
1175
1182API_EXPORT void
1183box_ibuf_read_range(box_ibuf_t *ibuf, char ***rpos, char ***wpos);
1184
1191API_EXPORT void
1192box_ibuf_write_range(box_ibuf_t *ibuf, char ***wpos, char ***end);
1193
1214LUA_API int
1215luaL_iscdata(struct lua_State *L, int idx);
1216
1226LUA_API void *
1227luaL_pushcdata(struct lua_State *L, uint32_t ctypeid);
1228
1237LUA_API void *
1238luaL_checkcdata(struct lua_State *L, int idx, uint32_t *ctypeid);
1239
1247LUA_API void
1248luaL_setcdatagc(struct lua_State *L, int idx);
1249
1254size_t
1255luaL_getgctotal(struct lua_State *L);
1256
1265LUA_API uint32_t
1266luaL_ctypeid(struct lua_State *L, const char *ctypename);
1267
1276LUA_API int
1277luaL_cdef(struct lua_State *L, const char *ctypename);
1278
1288LUA_API void
1289luaL_pushuint64(struct lua_State *L, uint64_t val);
1290
1297LUA_API void
1298luaL_pushint64(struct lua_State *L, int64_t val);
1299
1305LUA_API uint64_t
1306luaL_checkuint64(struct lua_State *L, int idx);
1307
1313LUA_API int64_t
1314luaL_checkint64(struct lua_State *L, int idx);
1315
1321LUA_API uint64_t
1322luaL_touint64(struct lua_State *L, int idx);
1323
1329LUA_API int64_t
1330luaL_toint64(struct lua_State *L, int idx);
1331
1336LUA_API int
1337luaT_call(lua_State *L, int nargs, int nreturns);
1338
1346int
1347luaT_dostring(struct lua_State *L, const char *str);
1348
1353LUA_API int
1354luaT_cpcall(lua_State *L, lua_CFunction func, void *ud);
1355
1359LUA_API lua_State *
1361
1365LUA_API const char *
1366luaT_tolstring(lua_State *L, int idx, size_t *ssize);
1367
1375LUA_API int
1376luaL_iscallable(lua_State *L, int idx);
1377
1383LUA_API box_ibuf_t *
1384luaT_toibuf(struct lua_State *L, int idx);
1385
1391LUA_API void
1392luaL_pushnull(struct lua_State *L);
1393
1399LUA_API bool
1400luaL_isnull(struct lua_State *L, int idx);
1401
1404struct error;
1405
1413LUA_API int
1414luaT_error(lua_State *L);
1415
1421int
1422luaT_error_at(lua_State *L, int level);
1423
1430LUA_API int
1432
1439void
1440luaT_pusherror(struct lua_State *L, struct error *e);
1470
1479API_EXPORT int64_t
1481
1487API_EXPORT int
1489
1493API_EXPORT bool
1495
1506API_EXPORT int
1508
1515API_EXPORT int
1517
1523API_EXPORT int
1525
1533API_EXPORT void *
1534box_txn_alloc(size_t size);
1535
1545API_EXPORT int
1546box_txn_set_timeout(double timeout);
1547
1556API_EXPORT int
1558
1562API_EXPORT void
1567typedef struct tuple_format box_tuple_format_t;
1568
1577
1581typedef struct tuple box_tuple_t;
1582
1600int
1602
1609void
1611
1616uint32_t
1618
1623size_t
1625
1636ssize_t
1637box_tuple_to_buf(box_tuple_t *tuple, char *buf, size_t size);
1638
1646
1657const char *
1658box_tuple_field(box_tuple_t *tuple, uint32_t fieldno);
1659
1688API_EXPORT const char *
1689box_tuple_field_by_path(box_tuple_t *tuple, const char *path,
1690 uint32_t path_len, int index_base);
1694typedef struct tuple_iterator box_tuple_iterator_t;
1695
1726
1730void
1732
1743uint32_t
1745
1752void
1754
1767const char *
1769
1781const char *
1783
1796box_tuple_new(box_tuple_format_t *format, const char *data, const char *end);
1797
1814box_tuple_update(box_tuple_t *tuple, const char *expr, const char *expr_end);
1815
1839box_tuple_upsert(box_tuple_t *tuple, const char *expr, const char *expr_end);
1840
1849int
1851
1855typedef struct key_def box_key_def_t;
1856
1858enum {
1859 BOX_KEY_PART_DEF_IS_NULLABLE = 1 << 0,
1860 BOX_KEY_PART_DEF_EXCLUDE_NULL = 1 << 1,
1861 BOX_KEY_PART_DEF_SORT_ORDER_DESC = 1 << 2,
1862};
1863
1890enum {
1893};
1894
1919typedef union PACKED {
1920 struct {
1922 uint32_t fieldno;
1924 uint32_t flags;
1926 const char *field_type;
1928 const char *collation;
1948 const char *path;
1949 };
1956
1970box_key_def_new(uint32_t *fields, uint32_t *types, uint32_t part_count);
1971
2004API_EXPORT void
2006
2020box_key_def_new_v2(box_key_part_def_t *parts, uint32_t part_count);
2021
2030
2036API_EXPORT void
2038
2053box_key_def_dump_parts(const box_key_def_t *key_def, uint32_t *part_count_ptr);
2054
2067API_EXPORT int
2069
2079API_EXPORT int
2081 box_key_def_t *key_def);
2093API_EXPORT int
2094box_tuple_compare_with_key(box_tuple_t *tuple_a, const char *key_b,
2095 box_key_def_t *key_def);
2096
2112box_key_def_merge(const box_key_def_t *first, const box_key_def_t *second);
2113
2133API_EXPORT char *
2135 int multikey_idx, uint32_t *key_size_ptr);
2136
2159API_EXPORT int
2160box_key_def_validate_key(const box_key_def_t *key_def, const char *key,
2161 uint32_t *key_size_ptr);
2162
2184API_EXPORT int
2185box_key_def_validate_full_key(const box_key_def_t *key_def, const char *key,
2186 uint32_t *key_size_ptr);
2187
2191/*
2192 * Possible field data types. Can't use STRS/ENUM macros for them,
2193 * since there is a mismatch between enum name (STRING) and type
2194 * name literal ("STR"). STR is already used as Objective C type.
2195 */
2197 FIELD_TYPE_ANY = 0,
2198 FIELD_TYPE_UNSIGNED,
2199 FIELD_TYPE_STRING,
2200 FIELD_TYPE_NUMBER,
2201 FIELD_TYPE_DOUBLE,
2202 FIELD_TYPE_INTEGER,
2203 FIELD_TYPE_BOOLEAN,
2204 FIELD_TYPE_VARBINARY,
2205 FIELD_TYPE_SCALAR,
2206 FIELD_TYPE_DECIMAL,
2207 FIELD_TYPE_UUID,
2208 FIELD_TYPE_DATETIME,
2209 FIELD_TYPE_INTERVAL,
2210 FIELD_TYPE_ARRAY,
2211 FIELD_TYPE_MAP,
2212 FIELD_TYPE_INT8,
2213 FIELD_TYPE_UINT8,
2214 FIELD_TYPE_INT16,
2215 FIELD_TYPE_UINT16,
2216 FIELD_TYPE_INT32,
2217 FIELD_TYPE_UINT32,
2218 FIELD_TYPE_INT64,
2219 FIELD_TYPE_UINT64,
2220 FIELD_TYPE_FLOAT32,
2221 FIELD_TYPE_FLOAT64,
2222 field_type_MAX
2223};
2224
2229 ON_CONFLICT_ACTION_NONE = 0,
2230 ON_CONFLICT_ACTION_ROLLBACK,
2231 ON_CONFLICT_ACTION_ABORT,
2232 ON_CONFLICT_ACTION_FAIL,
2233 ON_CONFLICT_ACTION_IGNORE,
2234 ON_CONFLICT_ACTION_REPLACE,
2235 ON_CONFLICT_ACTION_DEFAULT,
2236 on_conflict_action_MAX
2237};
2238
2251box_tuple_format_new(struct key_def **keys, uint16_t key_count);
2252
2258void
2260
2266void
2268
2279#define SYSTEM_SPACES(_) /* (name, id, is_sync) */ \
2280 \
2281 _(VINYL_DEFERRED_DELETE, 257, false) \
2282 \
2283 _(SCHEMA, 272, true) \
2284 \
2285 _(COLLATION, 276, true) \
2286 \
2287 _(VCOLLATION, 277, true) \
2288 \
2289 _(SPACE, 280, true) \
2290 \
2291 _(VSPACE, 281, true) \
2292 \
2293 _(SEQUENCE, 284, true) \
2294 \
2295 _(SEQUENCE_DATA, 285, false) \
2296 \
2297 _(VSEQUENCE, 286, true) \
2298 \
2299 _(INDEX, 288, true) \
2300 \
2301 _(VINDEX, 289, true) \
2302 \
2303 _(FUNC, 296, true) \
2304 \
2305 _(VFUNC, 297, true) \
2306 \
2307 _(USER, 304, true) \
2308 \
2309 _(VUSER, 305, true) \
2310 \
2311 _(PRIV, 312, true) \
2312 \
2313 _(VPRIV, 313, true) \
2314 \
2315 _(CLUSTER, 320, true) \
2316 \
2317 _(TRIGGER, 328, true) \
2318 \
2319 _(TRUNCATE, 330, true) \
2320 \
2321 _(SPACE_SEQUENCE, 340, true) \
2322 \
2323 _(VSPACE_SEQUENCE, 341, true) \
2324 \
2325 _(FK_CONSTRAINT, 356, true) \
2326 \
2327 _(CK_CONSTRAINT, 364, true) \
2328 \
2329 _(FUNC_INDEX, 372, true) \
2330 \
2331 _(SESSION_SETTINGS, 380, true) \
2332 \
2333 _(GC_CONSUMERS, 388, false) \
2334
2336#define SYSTEM_SPACE_MEMBER(name, id, ...) BOX_ ## name ## _ID = id,
2337
2338enum {
2344 BOX_ID_NIL = 2147483647
2345};
2355API_EXPORT uint64_t
2357
2361API_EXPORT bool
2363
2374API_EXPORT int
2375box_wait_ro(bool ro, double timeout);
2376
2384API_EXPORT const char *
2386
2390/*
2391 * Opaque structure passed to the stored C procedure
2392 */
2393typedef struct box_function_ctx box_function_ctx_t;
2394
2406
2419typedef enum iproto_handler_status
2420(*iproto_handler_t)(const char *header, const char *header_end,
2421 const char *body, const char *body_end,
2422 void *ctx);
2423
2430typedef void
2431(*iproto_handler_destroy_t)(void *ctx);
2432
2444API_EXPORT int
2446
2463API_EXPORT int
2464box_return_mp(box_function_ctx_t *ctx, const char *mp, const char *mp_end);
2465
2476API_EXPORT uint32_t
2477box_space_id_by_name(const char *name, uint32_t len);
2478
2490API_EXPORT uint32_t
2491box_index_id_by_name(uint32_t space_id, const char *name, uint32_t len);
2492
2504API_EXPORT int
2505box_insert(uint32_t space_id, const char *tuple, const char *tuple_end,
2506 box_tuple_t **result);
2507
2519API_EXPORT int
2520box_replace(uint32_t space_id, const char *tuple, const char *tuple_end,
2521 box_tuple_t **result);
2522
2535API_EXPORT int
2536box_delete(uint32_t space_id, uint32_t index_id, const char *key,
2537 const char *key_end, box_tuple_t **result);
2538
2557API_EXPORT int
2558box_update(uint32_t space_id, uint32_t index_id, const char *key,
2559 const char *key_end, const char *ops, const char *ops_end,
2560 int index_base, box_tuple_t **result);
2561
2580API_EXPORT int
2581box_upsert(uint32_t space_id, uint32_t index_id, const char *tuple,
2582 const char *tuple_end, const char *ops, const char *ops_end,
2583 int index_base, box_tuple_t **result);
2584
2585struct ArrowArray;
2586struct ArrowSchema;
2587
2606API_EXPORT int
2607box_insert_arrow(uint32_t space_id, struct ArrowArray *array,
2608 struct ArrowSchema *schema);
2609
2615API_EXPORT int
2616box_truncate(uint32_t space_id);
2617
2627API_EXPORT int
2628box_sequence_next(uint32_t seq_id, int64_t *result);
2629
2639API_EXPORT int
2640box_sequence_current(uint32_t seq_id, int64_t *result);
2641
2651API_EXPORT int
2652box_sequence_set(uint32_t seq_id, int64_t value);
2653
2661API_EXPORT int
2662box_sequence_reset(uint32_t seq_id);
2663
2675API_EXPORT int
2676box_session_push(const char *data, const char *data_end);
2677
2682API_EXPORT uint64_t
2684
2699API_EXPORT int
2700box_iproto_send(uint64_t sid,
2701 const char *header, const char *header_end,
2702 const char *body, const char *body_end);
2703
2721API_EXPORT int
2722box_iproto_override(uint32_t req_type, iproto_handler_t handler,
2723 iproto_handler_destroy_t destroy, void *ctx);
2724
2729API_EXPORT int64_t
2731
2741
2745API_EXPORT uint64_t
2747
2751typedef struct iterator box_iterator_t;
2752
2769box_index_iterator(uint32_t space_id, uint32_t index_id, int type,
2770 const char *key, const char *key_end);
2779int
2781
2787void
2789
2798ssize_t
2799box_index_len(uint32_t space_id, uint32_t index_id);
2800
2809ssize_t
2810box_index_bsize(uint32_t space_id, uint32_t index_id);
2811
2823int
2824box_index_random(uint32_t space_id, uint32_t index_id, uint32_t rnd,
2825 box_tuple_t **result);
2826
2843int
2844box_index_get(uint32_t space_id, uint32_t index_id, const char *key,
2845 const char *key_end, box_tuple_t **result);
2846
2859int
2860box_index_min(uint32_t space_id, uint32_t index_id, const char *key,
2861 const char *key_end, box_tuple_t **result);
2862
2875int
2876box_index_max(uint32_t space_id, uint32_t index_id, const char *key,
2877 const char *key_end, box_tuple_t **result);
2878
2892ssize_t
2893box_index_count(uint32_t space_id, uint32_t index_id, int type,
2894 const char *key, const char *key_end);
2895
2908char *
2909box_tuple_extract_key(box_tuple_t *tuple, uint32_t space_id,
2910 uint32_t index_id, uint32_t *key_size);
2911
2936 /* ITER_EQ must be the first member for request_create */
2937 ITER_EQ = 0, /* key == x ASC order */
2938 ITER_REQ = 1, /* key == x DESC order */
2939 ITER_ALL = 2, /* all tuples */
2940 ITER_LT = 3, /* key < x */
2941 ITER_LE = 4, /* key <= x */
2942 ITER_GE = 5, /* key >= x */
2943 ITER_GT = 6, /* key > x */
2944 ITER_BITS_ALL_SET = 7, /* all bits from x are set in key */
2945 ITER_BITS_ANY_SET = 8, /* at least one x's bit is set */
2946 ITER_BITS_ALL_NOT_SET = 9, /* all bits are not set */
2947 ITER_OVERLAPS = 10, /* key overlaps x */
2948 ITER_NEIGHBOR = 11, /* tuples as they move away from x point */
2949 ITER_NP = 12, /* next prefix, ASC order */
2950 ITER_PP = 13, /* previous prefix, DESC order */
2951 iterator_type_MAX
2952};
2953
2957struct error;
2961typedef struct error box_error_t;
2962
2968const char *
2970
2976uint32_t
2978
2984const char *
2986
3010
3014void
3016
3029int
3030box_error_set(const char *file, unsigned line, uint32_t code,
3031 const char *format, ...);
3032
3036#define box_error_raise(code, format, ...) \
3037 box_error_set(__FILE__, __LINE__, code, format, ##__VA_ARGS__)
3038
3052luaT_checktuple(struct lua_State *L, int idx);
3053
3061API_EXPORT void
3062luaT_pushtuple(struct lua_State *L, box_tuple_t *tuple);
3063
3073luaT_istuple(struct lua_State *L, int idx);
3074
3090API_EXPORT char *
3091luaT_tuple_encode(struct lua_State *L, int idx, size_t *tuple_len_ptr);
3092
3112luaT_tuple_new(struct lua_State *L, int idx, box_tuple_format_t *format);
3113
3120typedef struct box_latch box_latch_t;
3121
3128
3133void
3135
3142void
3144
3151int
3153
3160void
3162
3172double
3174
3180double
3182
3189double
3191
3197double
3199
3204int64_t
3206
3211int64_t
3213
3218int64_t
3220
3225int64_t
3227
3231/* {{{ decimal structure and constants */
3232
3244 uint64_t internal[8];
3245};
3246
3274
3279#define BOX_DECIMAL_STRING_BUFFER_SIZE 128
3280
3281/* }}} decimal structure and constants */
3282
3283/* {{{ decimal properties */
3284
3296API_EXPORT int
3298
3308API_EXPORT int
3310
3318API_EXPORT bool
3320
3328API_EXPORT bool
3330
3331/* }}} decimal properties */
3332
3333/* {{{ decimal constructors */
3334
3343
3357
3369
3379
3389
3404
3405/* }}} decimal constructors */
3406
3407/* {{{ decimal conversions */
3408
3418API_EXPORT void
3420
3430box_decimal_to_int64(const box_decimal_t *dec, int64_t *num);
3431
3441box_decimal_to_uint64(const box_decimal_t *dec, uint64_t *num);
3442
3443/* }}} decimal conversions */
3444
3445/* {{{ decimal rounding */
3446
3471
3493
3502
3521
3522/* }}} decimal rounding */
3523
3524/* {{{ decimal arithmetic */
3525
3535API_EXPORT int
3537
3551
3563
3575 const box_decimal_t *rhs);
3576
3588 const box_decimal_t *rhs);
3589
3601 const box_decimal_t *rhs);
3602
3614 const box_decimal_t *rhs);
3615
3629 const box_decimal_t *rhs);
3630
3631/* }}} decimal arithmetic */
3632
3633/* {{{ decimal math functions */
3634
3645
3656
3668 const box_decimal_t *rhs);
3669
3680
3691
3692/* }}} decimal math functions */
3693
3694/* {{{ decimal encoding to/decoding from msgpack */
3695
3703uint32_t
3705
3713char *
3714box_decimal_mp_encode(const box_decimal_t *dec, char *data);
3715
3727box_decimal_mp_decode(box_decimal_t *dec, const char **data);
3728
3757 uint32_t size);
3758
3759/* }}} decimal encoding to/decoding from msgpack */
3760
3769luaT_newdecimal(struct lua_State *L);
3770
3776luaT_pushdecimal(struct lua_State *L, const box_decimal_t *dec);
3777
3785luaT_isdecimal(struct lua_State *L, int index);
3786
3788enum box_error_code { ER_UNKNOWN = 0, ER_ILLEGAL_PARAMS = 1, ER_MEMORY_ISSUE = 2, ER_TUPLE_FOUND = 3, ER_UNSUPPORTED = 5, ER_READONLY = 7, ER_INJECTION = 8, ER_CREATE_SPACE = 9, ER_SPACE_EXISTS = 10, ER_DROP_SPACE = 11, ER_ALTER_SPACE = 12, ER_INDEX_TYPE = 13, ER_MODIFY_INDEX = 14, ER_LAST_DROP = 15, ER_TUPLE_FORMAT_LIMIT = 16, ER_DROP_PRIMARY_KEY = 17, ER_KEY_PART_TYPE = 18, ER_EXACT_MATCH = 19, ER_INVALID_MSGPACK = 20, ER_TUPLE_NOT_ARRAY = 22, ER_FIELD_TYPE = 23, ER_INDEX_PART_TYPE_MISMATCH = 24, ER_UPDATE_SPLICE = 25, ER_UPDATE_ARG_TYPE = 26, ER_FORMAT_MISMATCH_INDEX_PART = 27, ER_UNKNOWN_UPDATE_OP = 28, ER_UPDATE_FIELD = 29, ER_FUNCTION_TX_ACTIVE = 30, ER_KEY_PART_COUNT = 31, ER_PROC_LUA = 32, ER_NO_SUCH_PROC = 33, ER_NO_SUCH_TRIGGER = 34, ER_NO_SUCH_INDEX_ID = 35, ER_NO_SUCH_SPACE = 36, ER_NO_SUCH_FIELD_NO = 37, ER_EXACT_FIELD_COUNT = 38, ER_FIELD_MISSING = 39, ER_WAL_IO = 40, ER_MORE_THAN_ONE_TUPLE = 41, ER_ACCESS_DENIED = 42, ER_CREATE_USER = 43, ER_DROP_USER = 44, ER_NO_SUCH_USER = 45, ER_USER_EXISTS = 46, ER_CREDS_MISMATCH = 47, ER_UNKNOWN_REQUEST_TYPE = 48, ER_UNKNOWN_SCHEMA_OBJECT = 49, ER_CREATE_FUNCTION = 50, ER_NO_SUCH_FUNCTION = 51, ER_FUNCTION_EXISTS = 52, ER_BEFORE_REPLACE_RET = 53, ER_MULTISTATEMENT_TRANSACTION = 54, ER_TRIGGER_EXISTS = 55, ER_USER_MAX = 56, ER_NO_SUCH_ENGINE = 57, ER_RELOAD_CFG = 58, ER_CFG = 59, ER_SAVEPOINT_EMPTY_TX = 60, ER_NO_SUCH_SAVEPOINT = 61, ER_UNKNOWN_REPLICA = 62, ER_REPLICASET_UUID_MISMATCH = 63, ER_INVALID_UUID = 64, ER_REPLICASET_UUID_IS_RO = 65, ER_INSTANCE_UUID_MISMATCH = 66, ER_REPLICA_ID_IS_RESERVED = 67, ER_MISSING_REQUEST_FIELD = 69, ER_IDENTIFIER = 70, ER_DROP_FUNCTION = 71, ER_ITERATOR_TYPE = 72, ER_REPLICA_MAX = 73, ER_NO_CONNECTION = 77, ER_TIMEOUT = 78, ER_ACTIVE_TRANSACTION = 79, ER_CURSOR_NO_TRANSACTION = 80, ER_CROSS_ENGINE_TRANSACTION = 81, ER_NO_SUCH_ROLE = 82, ER_ROLE_EXISTS = 83, ER_CREATE_ROLE = 84, ER_INDEX_EXISTS = 85, ER_SESSION_CLOSED = 86, ER_ROLE_LOOP = 87, ER_GRANT = 88, ER_PRIV_GRANTED = 89, ER_ROLE_GRANTED = 90, ER_PRIV_NOT_GRANTED = 91, ER_ROLE_NOT_GRANTED = 92, ER_MISSING_SNAPSHOT = 93, ER_CANT_UPDATE_PRIMARY_KEY = 94, ER_UPDATE_INTEGER_OVERFLOW = 95, ER_GUEST_USER_PASSWORD = 96, ER_TRANSACTION_CONFLICT = 97, ER_UNSUPPORTED_PRIV = 98, ER_LOAD_FUNCTION = 99, ER_FUNCTION_LANGUAGE = 100, ER_RTREE_RECT = 101, ER_PROC_C = 102, ER_PROTOCOL = 104, ER_WRONG_INDEX_RECORD = 106, ER_WRONG_INDEX_PARTS = 107, ER_WRONG_INDEX_OPTIONS = 108, ER_WRONG_SCHEMA_VERSION = 109, ER_MEMTX_MAX_TUPLE_SIZE = 110, ER_WRONG_SPACE_OPTIONS = 111, ER_UNSUPPORTED_INDEX_FEATURE = 112, ER_VIEW_IS_RO = 113, ER_NO_TRANSACTION = 114, ER_SYSTEM = 115, ER_LOADING = 116, ER_CONNECTION_TO_SELF = 117, ER_COMPRESSION = 119, ER_CHECKPOINT_IN_PROGRESS = 120, ER_SUB_STMT_MAX = 121, ER_COMMIT_IN_SUB_STMT = 122, ER_ROLLBACK_IN_SUB_STMT = 123, ER_DECOMPRESSION = 124, ER_INVALID_XLOG_TYPE = 125, ER_ALREADY_RUNNING = 126, ER_INDEX_FIELD_COUNT_LIMIT = 127, ER_LOCAL_INSTANCE_ID_IS_READ_ONLY = 128, ER_BACKUP_IN_PROGRESS = 129, ER_READ_VIEW_ABORTED = 130, ER_INVALID_INDEX_FILE = 131, ER_INVALID_RUN_FILE = 132, ER_INVALID_VYLOG_FILE = 133, ER_CASCADE_ROLLBACK = 134, ER_VY_QUOTA_TIMEOUT = 135, ER_PARTIAL_KEY = 136, ER_TRUNCATE_SYSTEM_SPACE = 137, ER_LOAD_MODULE = 138, ER_VINYL_MAX_TUPLE_SIZE = 139, ER_WRONG_DD_VERSION = 140, ER_WRONG_SPACE_FORMAT = 141, ER_CREATE_SEQUENCE = 142, ER_ALTER_SEQUENCE = 143, ER_DROP_SEQUENCE = 144, ER_NO_SUCH_SEQUENCE = 145, ER_SEQUENCE_EXISTS = 146, ER_SEQUENCE_OVERFLOW = 147, ER_NO_SUCH_INDEX_NAME = 148, ER_SPACE_FIELD_IS_DUPLICATE = 149, ER_CANT_CREATE_COLLATION = 150, ER_WRONG_COLLATION_OPTIONS = 151, ER_NULLABLE_PRIMARY = 152, ER_NO_SUCH_FIELD_NAME_IN_SPACE = 153, ER_TRANSACTION_YIELD = 154, ER_NO_SUCH_GROUP = 155, ER_SQL_BIND_TYPE = 157, ER_SQL_BIND_PARAMETER_MAX = 158, ER_SQL_EXECUTE = 159, ER_UPDATE_DECIMAL_OVERFLOW = 160, ER_SQL_BIND_NOT_FOUND = 161, ER_ACTION_MISMATCH = 162, ER_VIEW_MISSING_SQL = 163, ER_FOREIGN_KEY_CONSTRAINT = 164, ER_NO_SUCH_MODULE = 165, ER_NO_SUCH_COLLATION = 166, ER_CREATE_FK_CONSTRAINT = 167, ER_NO_SUCH_CONSTRAINT = 169, ER_CONSTRAINT_EXISTS = 170, ER_SQL_TYPE_MISMATCH = 171, ER_ROWID_OVERFLOW = 172, ER_DROP_COLLATION = 173, ER_ILLEGAL_COLLATION_MIX = 174, ER_SQL_NO_SUCH_PRAGMA = 175, ER_SQL_CANT_RESOLVE_FIELD = 176, ER_INDEX_EXISTS_IN_SPACE = 177, ER_INCONSISTENT_TYPES = 178, ER_SQL_SYNTAX_WITH_POS = 179, ER_SQL_STACK_OVERFLOW = 180, ER_SQL_SELECT_WILDCARD = 181, ER_SQL_STATEMENT_EMPTY = 182, ER_SQL_KEYWORD_IS_RESERVED = 183, ER_SQL_SYNTAX_NEAR_TOKEN = 184, ER_SQL_UNKNOWN_TOKEN = 185, ER_SQL_PARSER_GENERIC = 186, ER_SQL_COLUMN_COUNT_MAX = 188, ER_HEX_LITERAL_MAX = 189, ER_INT_LITERAL_MAX = 190, ER_SQL_PARSER_LIMIT = 191, ER_INDEX_DEF_UNSUPPORTED = 192, ER_MULTIKEY_INDEX_MISMATCH = 194, ER_CREATE_CK_CONSTRAINT = 195, ER_SQL_COLUMN_COUNT = 197, ER_FUNC_INDEX_FUNC = 198, ER_FUNC_INDEX_FORMAT = 199, ER_FUNC_INDEX_PARTS = 200, ER_NO_SUCH_FIELD_NAME = 201, ER_FUNC_WRONG_ARG_COUNT = 202, ER_BOOTSTRAP_READONLY = 203, ER_SQL_FUNC_WRONG_RET_COUNT = 204, ER_FUNC_INVALID_RETURN_TYPE = 205, ER_SQL_PARSER_GENERIC_WITH_POS = 206, ER_REPLICA_NOT_ANON = 207, ER_CANNOT_REGISTER = 208, ER_SESSION_SETTING_INVALID_VALUE = 209, ER_SQL_PREPARE = 210, ER_WRONG_QUERY_ID = 211, ER_SEQUENCE_NOT_STARTED = 212, ER_NO_SUCH_SESSION_SETTING = 213, ER_UNCOMMITTED_FOREIGN_SYNC_TXNS = 214, ER_SYNC_QUORUM_TIMEOUT = 216, ER_SYNC_ROLLBACK = 217, ER_TUPLE_METADATA_IS_TOO_BIG = 218, ER_XLOG_GAP = 219, ER_TOO_EARLY_SUBSCRIBE = 220, ER_SQL_CANT_ADD_AUTOINC = 221, ER_QUORUM_WAIT = 222, ER_INTERFERING_PROMOTE = 223, ER_ELECTION_DISABLED = 224, ER_TXN_ROLLBACK = 225, ER_NOT_LEADER = 226, ER_SYNC_QUEUE_UNCLAIMED = 227, ER_SYNC_QUEUE_FOREIGN = 228, ER_UNABLE_TO_PROCESS_IN_STREAM = 229, ER_UNABLE_TO_PROCESS_OUT_OF_STREAM = 230, ER_TRANSACTION_TIMEOUT = 231, ER_ACTIVE_TIMER = 232, ER_TUPLE_FIELD_COUNT_LIMIT = 233, ER_CREATE_CONSTRAINT = 234, ER_FIELD_CONSTRAINT_FAILED = 235, ER_TUPLE_CONSTRAINT_FAILED = 236, ER_CREATE_FOREIGN_KEY = 237, ER_FOREIGN_KEY_INTEGRITY = 238, ER_FIELD_FOREIGN_KEY_FAILED = 239, ER_COMPLEX_FOREIGN_KEY_FAILED = 240, ER_WRONG_SPACE_UPGRADE_OPTIONS = 241, ER_NO_ELECTION_QUORUM = 242, ER_SSL = 243, ER_SPLIT_BRAIN = 244, ER_OLD_TERM = 245, ER_INTERFERING_ELECTIONS = 246, ER_ITERATOR_POSITION = 247, ER_DEFAULT_VALUE_TYPE = 248, ER_UNKNOWN_AUTH_METHOD = 249, ER_INVALID_AUTH_DATA = 250, ER_INVALID_AUTH_REQUEST = 251, ER_WEAK_PASSWORD = 252, ER_OLD_PASSWORD = 253, ER_NO_SUCH_SESSION = 254, ER_WRONG_SESSION_TYPE = 255, ER_PASSWORD_EXPIRED = 256, ER_AUTH_DELAY = 257, ER_AUTH_REQUIRED = 258, ER_SQL_SEQ_SCAN = 259, ER_NO_SUCH_EVENT = 260, ER_BOOTSTRAP_NOT_UNANIMOUS = 261, ER_CANT_CHECK_BOOTSTRAP_LEADER = 262, ER_BOOTSTRAP_CONNECTION_NOT_TO_ALL = 263, ER_NIL_UUID = 264, ER_WRONG_FUNCTION_OPTIONS = 265, ER_MISSING_SYSTEM_SPACES = 266, ER_CLUSTER_NAME_MISMATCH = 267, ER_REPLICASET_NAME_MISMATCH = 268, ER_INSTANCE_NAME_DUPLICATE = 269, ER_INSTANCE_NAME_MISMATCH = 270, ER_SCHEMA_NEEDS_UPGRADE = 271, ER_SCHEMA_UPGRADE_IN_PROGRESS = 272, ER_DEPRECATED = 273, ER_UNCONFIGURED = 274, ER_CREATE_DEFAULT_FUNC = 275, ER_DEFAULT_FUNC_FAILED = 276, ER_INVALID_DEC = 277, ER_IN_ANOTHER_PROMOTE = 278, ER_SHUTDOWN = 279, ER_FIELD_VALUE_OUT_OF_RANGE = 280, ER_REPLICASET_NOT_FOUND = 281, ER_REPLICASET_NO_WRITABLE = 282, ER_REPLICASET_MORE_THAN_ONE_WRITABLE = 283, ER_TXN_COMMIT = 284, ER_READ_VIEW_BUSY = 285, ER_READ_VIEW_CLOSED = 286, ER_WAL_QUEUE_FULL = 287, ER_INVALID_VCLOCK = 288, ER_ARROW_IPC_ENCODE = 289, ER_ARROW_IPC_DECODE = 290, ER_SYNC_QUEUE_FULL = 291, box_error_code_MAX };
3789#if defined(__cplusplus)
3790} /* extern "C" */
3791#endif /* defined(__cplusplus) */
3792
3793#endif /* TARANTOOL_MODULE_H_INCLUDED */
box_error_code
public
Definition module.h:3788
int box_index_max(uint32_t space_id, uint32_t index_id, const char *key, const char *key_end, box_tuple_t **result)
Return a last (maximal) tuple matched the provided key.
@ COIO_READ
READ event.
Definition module.h:1086
@ COIO_WRITE
WRITE event.
Definition module.h:1088
double fiber_time(void)
Report loop begin time as double (cheap).
int box_insert(uint32_t space_id, const char *tuple, const char *tuple_end, box_tuple_t **result)
Execute an INSERT request.
int luaT_cpcall(lua_State *L, lua_CFunction func, void *ud)
Like lua_cpcall(), but with the proper support of Tarantool errors.
int luaL_iscallable(lua_State *L, int idx)
Check whether a Lua object is a function or has metatable/metatype with a __call field.
void fiber_set_name_n(struct fiber *fiber, const char *name, uint32_t len)
Set fiber name.
void fiber_sleep(double s)
Put the current fiber to sleep for at least 's' seconds.
box_decimal_t * box_decimal_mp_decode_data(box_decimal_t *dec, const char **data, uint32_t size)
Decode a decimal from msgpack data without the msgpack extension header.
struct fiber_attr * fiber_attr_new(void)
Create a new fiber attribute container and initialize it with default parameters.
void luaT_pushtuple(struct lua_State *L, box_tuple_t *tuple)
Push a tuple onto the stack.
double fiber_clock(void)
Report loop begin time as double (cheap).
int box_session_push(const char *data, const char *data_end)
Push MessagePack data into a session data channel - socket, console or whatever is behind the session...
box_key_def_t * box_key_def_new_v2(box_key_part_def_t *parts, uint32_t part_count)
Create a key_def from given key parts.
size_t box_region_used(void)
box region allocator
static bool say_log_level_is_enabled(int level)
Function checks whether passed log level is enabled.
Definition module.h:545
void box_latch_unlock(box_latch_t *latch)
Unlock a latch.
void box_tuple_format_unref(box_tuple_format_t *format)
Decrement tuple format ref count.
uint64_t box_session_id(void)
int64_t luaL_checkint64(struct lua_State *L, int idx)
Checks whether the argument idx is a int64 or a convertible string and returns this number.
box_decimal_t * luaT_isdecimal(struct lua_State *L, int index)
Check whether a value on the Lua stack is a decimal.
int64_t clock_process64(void)
Same as clock_process(), but returns the time as 64 bit signed integer.
int box_decimal_precision(const box_decimal_t *dec)
Decimal precision.
enum iproto_handler_status(* iproto_handler_t)(const char *header, const char *header_end, const char *body, const char *body_end, void *ctx)
IPROTO request handler signature: receives MsgPack encoded header and body, a context provided by box...
Definition module.h:2420
char * luaT_tuple_encode(struct lua_State *L, int idx, size_t *tuple_len_ptr)
Encode a table or a tuple on the Lua stack as an MsgPack array.
bool box_decimal_is_int(const box_decimal_t *dec)
Whether the fractional part of a decimal number is 0.
void box_error_clear(void)
Clear the last error.
void fiber_reschedule(void)
Reschedule fiber to end of event loop cycle.
#define SYSTEM_SPACE_MEMBER(name, id,...)
System space identifier definition.
Definition module.h:2336
const char * box_ro_reason(void)
public
void luaL_pushint64(struct lua_State *L, int64_t val)
Push int64_t onto the stack.
int fiber_cond_wait(struct fiber_cond *cond)
Shortcut for fiber_cond_wait_timeout().
void * box_region_alloc(size_t size)
Allocate size bytes from the box region.
void box_ibuf_read_range(box_ibuf_t *ibuf, char ***rpos, char ***wpos)
Return pointers to read range pointers used [rpos..wpos)
box_tuple_format_t * box_tuple_format_new(struct key_def **keys, uint16_t key_count)
public
int box_truncate(uint32_t space_id)
Truncate space.
uint64_t luaL_touint64(struct lua_State *L, int idx)
Checks whether the argument idx is a uint64 or a convertible string and returns this number.
int box_tuple_ref(box_tuple_t *tuple)
Increase the reference counter of tuple.
void box_tuple_unref(box_tuple_t *tuple)
Decrease the reference counter of tuple.
int box_key_def_validate_full_key(const box_key_def_t *key_def, const char *key, uint32_t *key_size_ptr)
Check a full key against given key definition.
void box_txn_make_sync(void)
Make the transaction synchronous.
void(* sayfunc_t)(int, const char *, int, const char *, const char *,...)
public
Definition module.h:552
int box_upsert(uint32_t space_id, uint32_t index_id, const char *tuple, const char *tuple_end, const char *ops, const char *ops_end, int index_base, box_tuple_t **result)
Execute an UPSERT request.
iterator_type
public
Definition module.h:2935
box_tuple_t * box_tuple_new(box_tuple_format_t *format, const char *data, const char *end)
Allocate and initialize a new tuple from a raw MsgPack Array data.
int box_latch_trylock(box_latch_t *latch)
Try to lock a latch.
box_error_t * box_error_last(void)
Get the information about the last API call error.
int64_t clock_monotonic64(void)
Same as clock_monotonic(), but returns the time as 64 bit signed integer.
box_decimal_t * box_decimal_sqrt(box_decimal_t *res, const box_decimal_t *dec)
Calculate a square root.
struct iterator box_iterator_t
public
Definition module.h:2751
union PACKED box_key_part_def_t
Public representation of a key part definition.
int64_t luaL_toint64(struct lua_State *L, int idx)
Checks whether the argument idx is a int64 or a convertible string and returns this number.
int box_key_def_validate_key(const box_key_def_t *key_def, const char *key, uint32_t *key_size_ptr)
Check a key against given key definition.
int box_decimal_scale(const box_decimal_t *dec)
Decimal scale.
double clock_monotonic(void)
A nonsettable system-wide clock that represents monotonic time.
box_decimal_t * box_decimal_floor(box_decimal_t *dec, int scale)
Apply a floor function to a decimal, i.e.
uint64_t box_slab_info(enum box_slab_info_type type)
Get memtx status information for box.slab.info.
int64_t clock_realtime64(void)
Same as clock_realtime(), but returns the time as 64 bit signed integer.
int box_key_def_validate_tuple(box_key_def_t *key_def, box_tuple_t *tuple)
Check that tuple fields match with given key definition.
box_tuple_t * luaT_istuple(struct lua_State *L, int idx)
Checks whether argument idx is a tuple.
const char * luaT_tolstring(lua_State *L, int idx, size_t *ssize)
Like lua_tolstring, but supports metatables, booleans and nil properly.
int box_sequence_next(uint32_t seq_id, int64_t *result)
Advance a sequence.
int box_txn_set_timeout(double timeout)
Set timeout for transaction, when it expires, transaction will be rolled back.
box_decimal_t * box_decimal_from_string(box_decimal_t *dec, const char *str)
Initialize a decimal with a value from a string.
ssize_t box_index_count(uint32_t space_id, uint32_t index_id, int type, const char *key, const char *key_end)
Count the number of tuple matched the provided key.
void fiber_cond_signal(struct fiber_cond *cond)
Wake one fiber waiting for the cond.
bool fiber_set_cancellable(bool yesno)
Deprecated.
const char * fiber_name(const struct fiber *fiber)
Get fiber name.
box_tuple_t * luaT_checktuple(struct lua_State *L, int idx)
public
box_decimal_t * box_decimal_ln(box_decimal_t *res, const box_decimal_t *dec)
Calculate a natural logarithm (base e).
int luaL_cdef(struct lua_State *L, const char *ctypename)
Declare symbols for FFI.
int box_on_shutdown(void *arg, int(*new_handler)(void *), int(*old_handler)(void *))
Statement Attributes }}}.
void * box_ibuf_reserve(box_ibuf_t *ibuf, size_t size)
Reserve requested amount of bytes in ibuf buffer.
uint32_t box_space_id_by_name(const char *name, uint32_t len)
Find space id by name.
struct fiber * fiber_new_ex(const char *name, const struct fiber_attr *fiber_attr, fiber_func f)
Create a new fiber with defined attributes.
uint32_t box_index_id_by_name(uint32_t space_id, const char *name, uint32_t len)
Find index id by name.
box_key_part_def_t * box_key_def_dump_parts(const box_key_def_t *key_def, uint32_t *part_count_ptr)
Dump key part definitions of given key_def.
int luaT_call(lua_State *L, int nargs, int nreturns)
Like lua_call(), but with the proper support of Tarantool errors.
iproto_handler_status
Return codes for IPROTO request handlers.
Definition module.h:2398
@ IPROTO_HANDLER_ERROR
Error, diagnostic must be set by handler via box_error_set().
Definition module.h:2402
@ IPROTO_HANDLER_OK
Success, no further actions needed.
Definition module.h:2400
@ IPROTO_HANDLER_FALLBACK
Fallback to system handler.
Definition module.h:2404
int fiber_attr_setstacksize(struct fiber_attr *fiber_attr, size_t stack_size)
Set stack size for the fiber attribute.
const char * box_error_message(const box_error_t *error)
Return the error message.
int box_index_min(uint32_t space_id, uint32_t index_id, const char *key, const char *key_end, box_tuple_t **result)
Return a first (minimal) tuple matched the provided key.
void box_key_part_def_create(box_key_part_def_t *part)
Initialize a key part with default values.
int box_txn_commit(void)
Commit the current transaction.
int fiber_join(struct fiber *f)
Wait until the fiber is dead and then move its execution status to the caller.
int box_txn_rollback(void)
Rollback the current transaction.
box_decimal_t * luaT_pushdecimal(struct lua_State *L, const box_decimal_t *dec)
Allocate a new decimal on the Lua stack with copy of given decimal and return a pointer to it.
int box_index_get(uint32_t space_id, uint32_t index_id, const char *key, const char *key_end, box_tuple_t **result)
Get a tuple from index by the key.
uint32_t luaL_ctypeid(struct lua_State *L, const char *ctypename)
Return CTypeID (FFI) of given СDATA type.
box_decimal_t * box_decimal_log10(box_decimal_t *res, const box_decimal_t *dec)
Calculate a common logarithm (base 10).
#define API_EXPORT
The API_EXPORT attribute declares public C API function.
Definition module.h:408
void luaL_pushuint64(struct lua_State *L, uint64_t val)
public
void fiber_cond_delete(struct fiber_cond *cond)
Delete the fiber cond object.
void box_region_truncate(size_t size)
Truncate the box region to the given size.
void fiber_wakeup(struct fiber *f)
Interrupt a synchronous wait of a fiber.
int box_sequence_current(uint32_t seq_id, int64_t *result)
Get the last value returned by a sequence.
int64_t box_info_lsn(void)
Get self LSN component of box vclock, -1 if no one or bootstrap haven't succeeded.
int fiber_join_timeout(struct fiber *f, double timeout)
Wait until the fiber is dead or timeout exceeded.
size_t box_tuple_bsize(box_tuple_t *tuple)
Return the number of bytes used to store internal tuple data (MsgPack Array).
ssize_t box_index_len(uint32_t space_id, uint32_t index_id)
Return the number of element in the index.
box_latch_t * box_latch_new(void)
Allocate and initialize the new latch.
void * box_txn_alloc(size_t size)
Allocate memory on txn memory pool.
struct fiber * fiber_find(uint64_t fid)
Get a pointer to a live fiber in the current cord by the given fiber id, which may be used for gettin...
int box_iproto_override(uint32_t req_type, iproto_handler_t handler, iproto_handler_destroy_t destroy, void *ctx)
Sets an IPROTO request handler with the provided context for the given request type.
lua_State * luaT_state(void)
Get global Lua state used by Tarantool.
void box_iterator_free(box_iterator_t *iterator)
Destroy and deallocate iterator.
box_decimal_t * box_decimal_remainder(box_decimal_t *res, const box_decimal_t *lhs, const box_decimal_t *rhs)
Get the remainder of diviging two decimals.
box_decimal_t * box_decimal_exp(box_decimal_t *res, const box_decimal_t *dec)
Calculate exp(dec), i.e.
void * luaL_pushcdata(struct lua_State *L, uint32_t ctypeid)
Push cdata of given ctypeid onto the stack.
int box_delete(uint32_t space_id, uint32_t index_id, const char *key, const char *key_end, box_tuple_t **result)
Execute an DELETE request.
bool box_decimal_is_neg(const box_decimal_t *dec)
Whether a decimal number is negative.
void * box_region_aligned_alloc(size_t size, size_t alignment)
Allocate size bytes from the box region with given alignment.
#define CFORMAT(archetype, stringindex, firsttocheck)
The CFORMAT attribute specifies that a function takes printf, scanf, strftime or strfmon style argume...
Definition module.h:422
box_tuple_t * box_tuple_update(box_tuple_t *tuple, const char *expr, const char *expr_end)
Update a tuple.
box_key_def_t * box_key_def_new(uint32_t *fields, uint32_t *types, uint32_t part_count)
Create key definition with given field numbers and field types.
void box_decimal_to_string(const box_decimal_t *dec, char *buf)
Write the decimal as a string into the passed buffer.
box_decimal_t * box_decimal_mp_decode(box_decimal_t *dec, const char **data)
Decode a decimal from msgpack data.
box_decimal_t * box_decimal_from_uint64(box_decimal_t *dec, uint64_t num)
Initialize a decimal with a unsigned integer value.
double clock_process(void)
A clock that measures CPU time consumed by this process (by all threads in the process).
int box_return_tuple(box_function_ctx_t *ctx, box_tuple_t *tuple)
Return a tuple from stored C procedure.
uint32_t box_tuple_field_count(box_tuple_t *tuple)
Return the number of fields in tuple (the size of MsgPack Array).
double clock_realtime(void)
public
void box_key_def_delete(box_key_def_t *key_def)
Delete key definition.
int coio_getaddrinfo(const char *host, const char *port, const struct addrinfo *hints, struct addrinfo **res, double timeout)
Fiber-friendly version of getaddrinfo(3).
void box_latch_delete(box_latch_t *latch)
Destroy and free the latch.
box_decimal_t * box_decimal_round(box_decimal_t *dec, int scale)
Round to nearest decimal at given scale, half goes away from zero.
char * box_tuple_extract_key(box_tuple_t *tuple, uint32_t space_id, uint32_t index_id, uint32_t *key_size)
Extract key from tuple according to key definition of given index.
struct fiber * fiber_new(const char *name, fiber_func f)
Create a new fiber.
struct tuple box_tuple_t
Tuple.
Definition module.h:1581
int box_txn_begin(void)
Begin a transaction in the current fiber.
int box_tuple_compare(box_tuple_t *tuple_a, box_tuple_t *tuple_b, box_key_def_t *key_def)
Compare tuples using the key definition.
int box_txn_set_isolation(uint32_t level)
Set an isolation level for a transaction.
uint64_t box_schema_version(void)
public
int64_t fiber_clock64(void)
Report loop begin time as 64-bit int.
void fiber_set_joinable(struct fiber *fiber, bool yesno)
Set fiber to be joinable (false by default).
int box_tuple_validate(box_tuple_t *tuple, box_tuple_format_t *format)
Check tuple data correspondence to the space format.
int box_sequence_reset(uint32_t seq_id)
Reset a sequence.
box_tuple_t * luaT_tuple_new(struct lua_State *L, int idx, box_tuple_format_t *format)
Create a new tuple with specific format from a Lua table or a tuple.
int luaT_error_at(lua_State *L, int level)
Same as luaT_error but set error trace frame according to given level.
uint64_t fiber_id(const struct fiber *fiber)
Get fiber id.
struct box_latch box_latch_t
public
Definition module.h:3120
int box_replace(uint32_t space_id, const char *tuple, const char *tuple_end, box_tuple_t **result)
Execute an REPLACE request.
const char * box_tuple_field_by_path(box_tuple_t *tuple, const char *path, uint32_t path_len, int index_base)
Return a raw tuple field in the MsgPack format pointed by a JSON path.
int(* fiber_func)(va_list)
Fiber - contains information about fiber.
Definition module.h:669
int64_t box_txn_id(void)
public
int box_return_mp(box_function_ctx_t *ctx, const char *mp, const char *mp_end)
Return MessagePack from a stored C procedure.
box_decimal_t * box_decimal_rescale(box_decimal_t *dec, int scale)
Set scale of dec to scale.
bool fiber_is_cancelled(void)
Check current fiber for cancellation (it must be checked manually).
box_decimal_t * luaT_newdecimal(struct lua_State *L)
public
@ BOX_KEY_PART_DEF_T_SIZE
The constant.
Definition module.h:1892
void fiber_cancel(struct fiber *f)
Cancel the subject fiber.
int box_update(uint32_t space_id, uint32_t index_id, const char *key, const char *key_end, const char *ops, const char *ops_end, int index_base, box_tuple_t **result)
Execute an UPDATE request.
uint64_t fiber_csw(const struct fiber *fiber)
Get number of context switches of the given fiber.
bool luaL_isnull(struct lua_State *L, int idx)
Return true if the value at Lua stack is ffi's NULL (cdata<void *>: NULL).
int fiber_cond_wait_timeout(struct fiber_cond *cond, double timeout)
Suspend the execution of the current fiber (i.e.
box_decimal_t * box_decimal_abs(box_decimal_t *res, const box_decimal_t *dec)
Get the absolute value of a decimal.
int luaT_push_nil_and_error(lua_State *L)
Return nil as the first return value and an error as the second.
int luaT_dostring(struct lua_State *L, const char *str)
Like luaL_dostring(), but in case of error sets fiber diag instead of putting error on stack.
struct tuple_iterator box_tuple_iterator_t
Tuple iterator.
Definition module.h:1694
box_decimal_t * box_decimal_mul(box_decimal_t *res, const box_decimal_t *lhs, const box_decimal_t *rhs)
Multiply two decimal numbers.
struct box_function_ctx box_function_ctx_t
public
Definition module.h:2393
#define SYSTEM_SPACES(_)
public
Definition module.h:2279
int box_index_random(uint32_t space_id, uint32_t index_id, uint32_t rnd, box_tuple_t **result)
Return a random tuple from the index (useful for statistical analysis).
bool box_is_ro(void)
public
void luaL_setcdatagc(struct lua_State *L, int idx)
Sets finalizer function on a cdata object.
int box_error_set(const char *file, unsigned line, uint32_t code, const char *format,...)
Set the last error.
const box_decimal_t * box_decimal_to_uint64(const box_decimal_t *dec, uint64_t *num)
Convert a given decimal to uint64_t.
void(* iproto_handler_destroy_t)(void *ctx)
IPROTO request handler destructor called when the corresponding handler is removed.
Definition module.h:2431
box_decimal_t * box_decimal_sub(box_decimal_t *res, const box_decimal_t *lhs, const box_decimal_t *rhs)
Subtract one decimal number from another.
void fiber_yield(void)
Return control to another fiber and wait until it'll be woken.
void box_tuple_rewind(box_tuple_iterator_t *it)
Rewind iterator to the initial position.
box_decimal_t * box_decimal_pow(box_decimal_t *res, const box_decimal_t *lhs, const box_decimal_t *rhs)
Calculate lhs raised to the power of rhs.
double clock_thread(void)
A clock that measures CPU time consumed by this thread.
void * luaL_checkcdata(struct lua_State *L, int idx, uint32_t *ctypeid)
Checks whether the function argument idx is a cdata.
ssize_t box_index_bsize(uint32_t space_id, uint32_t index_id)
Return the number of bytes used in memory by the index.
int box_decimal_compare(const box_decimal_t *lhs, const box_decimal_t *rhs)
Compare two decimal values.
char * box_key_def_extract_key(box_key_def_t *key_def, box_tuple_t *tuple, int multikey_idx, uint32_t *key_size_ptr)
Extract key from tuple by given key definition and return buffer allocated on the box region with thi...
box_decimal_t * box_decimal_from_int64(box_decimal_t *dec, int64_t num)
Initialize a decimal with a signed integer value.
struct tuple_format box_tuple_format_t
public
Definition module.h:1567
const char * box_error_type(const box_error_t *error)
Return the error type, e.g.
int box_txn_isolation(void)
Get isolation level of current transaction, one of enum txn_isolation_level values (but cannot be TXN...
int box_insert_arrow(uint32_t space_id, struct ArrowArray *array, struct ArrowSchema *schema)
Executes a batch insert request.
int log_level
Logging level.
int coio_wait(int fd, int event, double timeout)
Wait until READ or WRITE event on socket (fd).
struct fiber * fiber_self(void)
Return the current fiber.
void fiber_cond_broadcast(struct fiber_cond *cond)
Wake up all fibers waiting for the cond.
@ BOX_SYSTEM_ID_MIN
Start of the reserved range of system spaces.
Definition module.h:2340
@ BOX_SYSTEM_ID_MAX
End of the reserved range of system spaces.
Definition module.h:2343
void fiber_start(struct fiber *callee,...)
Start execution of created fiber.
int box_iproto_send(uint64_t sid, const char *header, const char *header_end, const char *body, const char *body_end)
Sends a packet with the given header and body over the IPROTO session's socket.
box_decimal_t * box_decimal_trim(box_decimal_t *dec)
Remove trailing zeros from the fractional part of a number.
void(* log_write_flightrec)(int level, const char *filename, int line, const char *error, const char *format, va_list ap)
This function is called for every log which log level is not less than log_level_flightrec.
box_decimal_t * box_decimal_from_double(box_decimal_t *dec, double d)
Initialize a decimal from double.
box_decimal_t * box_decimal_zero(box_decimal_t *dec)
Initialize a zero decimal number.
int box_sequence_set(uint32_t seq_id, int64_t value)
Set a sequence value.
uint32_t box_tuple_position(box_tuple_iterator_t *it)
Return zero-based next position in iterator.
box_decimal_t * box_decimal_copy(box_decimal_t *dest, const box_decimal_t *src)
Copy decimal value from one storage to another.
box_decimal_t * box_decimal_div(box_decimal_t *res, const box_decimal_t *lhs, const box_decimal_t *rhs)
Divide one decimal number on another.
void fiber_attr_delete(struct fiber_attr *fiber_attr)
Delete the fiber_attr and free all allocated resources.
on_conflict_action
Possible actions on conflict.
Definition module.h:2228
uint64_t luaL_checkuint64(struct lua_State *L, int idx)
Checks whether the argument idx is a uint64 or a convertible string and returns this number.
void fiber_set_ctx(struct fiber *f, void *f_arg)
Set a pointer to context for the fiber.
box_decimal_t * box_decimal_add(box_decimal_t *res, const box_decimal_t *lhs, const box_decimal_t *rhs)
Calculate a sum of two decimal numbers.
void box_ibuf_write_range(box_ibuf_t *ibuf, char ***wpos, char ***end)
Return pointers to write range pointers used [wpos..end)
size_t luaL_getgctotal(struct lua_State *L)
Return size of currently allocated memory.
const char * box_tuple_next(box_tuple_iterator_t *it)
Return the next tuple field from tuple iterator.
void box_tuple_iterator_free(box_tuple_iterator_t *it)
Destroy and free tuple iterator.
void box_tuple_format_ref(box_tuple_format_t *format)
Increment tuple format ref count.
int luaL_iscdata(struct lua_State *L, int idx)
public
box_decimal_t * box_decimal_minus(box_decimal_t *res, const box_decimal_t *dec)
Perform unary minus operation.
struct key_def box_key_def_t
public
Definition module.h:1855
const char * _say_strerror(int errnum)
Internal function that implements MT-Safe strerror().
box_key_def_t * box_key_def_dup(const box_key_def_t *key_def)
Duplicate key_def.
box_tuple_format_t * box_tuple_format_default(void)
Tuple Format.
struct error box_error_t
Error - contains information about error.
Definition module.h:2961
size_t fiber_attr_getstacksize(struct fiber_attr *fiber_attr)
Get stack size from the fiber attribute.
const char * box_tuple_seek(box_tuple_iterator_t *it, uint32_t fieldno)
Seek the tuple iterator.
uint32_t box_decimal_mp_sizeof(const box_decimal_t *dec)
Calculate exact buffer size needed to store msgpack representation of a decimal.
box_slab_info_type
Definition module.h:2733
@ BOX_SLAB_INFO_ARENA_SIZE
Definition module.h:2736
@ BOX_SLAB_INFO_QUOTA_SIZE
Definition module.h:2738
@ BOX_SLAB_INFO_ITEMS_SIZE
Definition module.h:2734
@ BOX_SLAB_INFO_QUOTA_USED
Definition module.h:2739
@ BOX_SLAB_INFO_ARENA_USED
Definition module.h:2737
@ BOX_SLAB_INFO_ITEMS_USED
Definition module.h:2735
box_key_def_t * box_key_def_merge(const box_key_def_t *first, const box_key_def_t *second)
Allocate a new key_def with a set union of key parts from first and second key defs.
box_tuple_t * box_tuple_upsert(box_tuple_t *tuple, const char *expr, const char *expr_end)
Update a tuple.
say_format
Log formats.
Definition module.h:522
void luaL_pushnull(struct lua_State *L)
Push ffi's NULL (cdata<void *>: NULL) onto the stack.
int box_wait_ro(bool ro, double timeout)
public
struct ibuf box_ibuf_t
public
Definition module.h:1165
int64_t fiber_time64(void)
Report loop begin time as 64-bit int.
const char * box_tuple_field(box_tuple_t *tuple, uint32_t fieldno)
Return the raw tuple field in MsgPack format.
int box_iterator_next(box_iterator_t *iterator, box_tuple_t **result)
Retrieve the next item from the iterator.
int luaT_error(lua_State *L)
Re-throws the last Tarantool error as a Lua object.
int box_tuple_compare_with_key(box_tuple_t *tuple_a, const char *key_b, box_key_def_t *key_def)
Compare tuple with key using the key definition.
struct fiber_cond * fiber_cond_new(void)
public
void box_latch_lock(box_latch_t *latch)
Lock a latch.
const box_decimal_t * box_decimal_to_int64(const box_decimal_t *dec, int64_t *num)
Convert a given decimal to int64_t.
void * fiber_get_ctx(struct fiber *f)
Get the context for the fiber which was set via the fiber_set_ctx function.
int coio_close(int fd)
Close the fd and wake any fiber blocked in coio_wait() call on this fd.
txn_isolation_level
public
Definition module.h:1456
@ TXN_ISOLATION_READ_COMMITTED
Allow to read committed, but not confirmed changes.
Definition module.h:1460
@ TXN_ISOLATION_DEFAULT
Take isolation level from global default_isolation_level.
Definition module.h:1458
@ TXN_ISOLATION_LINEARIZABLE
Allow to read only the changes confirmed on any cluster node.
Definition module.h:1466
@ txn_isolation_level_MAX
Upper bound of valid values.
Definition module.h:1468
@ TXN_ISOLATION_READ_CONFIRMED
Allow to read only confirmed changes.
Definition module.h:1462
@ TXN_ISOLATION_BEST_EFFORT
Determine isolation level automatically.
Definition module.h:1464
box_iterator_t * box_index_iterator(uint32_t space_id, uint32_t index_id, int type, const char *key, const char *key_end)
Allocate and initialize iterator for space_id, index_id.
bool box_txn(void)
Return true if there is an active transaction.
field_type
public
Definition module.h:2196
ssize_t box_tuple_to_buf(box_tuple_t *tuple, char *buf, size_t size)
Dump raw MsgPack data to the memory buffer buf of size size.
box_tuple_iterator_t * box_tuple_iterator(box_tuple_t *tuple)
Allocate and initialize a new tuple iterator.
say_level
public
Definition module.h:509
ssize_t coio_call(ssize_t(*func)(va_list),...)
public
int64_t clock_thread64(void)
Same as clock_thread(), but returns the time as 64 bit signed integer.
box_tuple_format_t * box_tuple_format(box_tuple_t *tuple)
Return the associated format.
char * box_decimal_mp_encode(const box_decimal_t *dec, char *data)
Encode a decimal as msgpack.
box_ibuf_t * luaT_toibuf(struct lua_State *L, int idx)
Check if a value on L stack by index idx is an ibuf object.
void luaT_pusherror(struct lua_State *L, struct error *e)
Push error to a Lua stack.
public
Definition module.h:3234
uint64_t internal[8]
Decimal data.
Definition module.h:3244
Public representation of a key part definition.
Definition module.h:1919
char padding[BOX_KEY_PART_DEF_T_SIZE]
Padding to guarantee certain size across different tarantool versions.
Definition module.h:1954
const char * path
JSON path to point a nested field.
Definition module.h:1948
uint32_t flags
Flags, e.g.
Definition module.h:1924
uint32_t fieldno
Index of a tuple field (zero based).
Definition module.h:1922
const char * collation
Collation name for string comparisons.
Definition module.h:1928
const char * field_type
Type of the tuple field.
Definition module.h:1926