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 4
65#define PACKAGE_VERSION_PATCH 0
70#define PACKAGE_VERSION "3.4.0-entrypoint-229-ge2a6e2cd13"
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.3.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 void
1166(*tnt_tx_func_f)(void *);
1167
1191API_EXPORT void
1193
1205API_EXPORT void
1207
1211typedef struct ibuf box_ibuf_t;
1212
1219API_EXPORT void *
1220box_ibuf_reserve(box_ibuf_t *ibuf, size_t size);
1221
1228API_EXPORT void
1229box_ibuf_read_range(box_ibuf_t *ibuf, char ***rpos, char ***wpos);
1230
1237API_EXPORT void
1238box_ibuf_write_range(box_ibuf_t *ibuf, char ***wpos, char ***end);
1239
1260LUA_API int
1261luaL_iscdata(struct lua_State *L, int idx);
1262
1272LUA_API void *
1273luaL_pushcdata(struct lua_State *L, uint32_t ctypeid);
1274
1283LUA_API void *
1284luaL_checkcdata(struct lua_State *L, int idx, uint32_t *ctypeid);
1285
1293LUA_API void
1294luaL_setcdatagc(struct lua_State *L, int idx);
1295
1300size_t
1301luaL_getgctotal(struct lua_State *L);
1302
1311LUA_API uint32_t
1312luaL_ctypeid(struct lua_State *L, const char *ctypename);
1313
1322LUA_API int
1323luaL_cdef(struct lua_State *L, const char *ctypename);
1324
1334LUA_API void
1335luaL_pushuint64(struct lua_State *L, uint64_t val);
1336
1343LUA_API void
1344luaL_pushint64(struct lua_State *L, int64_t val);
1345
1351LUA_API uint64_t
1352luaL_checkuint64(struct lua_State *L, int idx);
1353
1359LUA_API int64_t
1360luaL_checkint64(struct lua_State *L, int idx);
1361
1367LUA_API uint64_t
1368luaL_touint64(struct lua_State *L, int idx);
1369
1375LUA_API int64_t
1376luaL_toint64(struct lua_State *L, int idx);
1377
1382LUA_API int
1383luaT_call(lua_State *L, int nargs, int nreturns);
1384
1392int
1393luaT_dostring(struct lua_State *L, const char *str);
1394
1399LUA_API int
1400luaT_cpcall(lua_State *L, lua_CFunction func, void *ud);
1401
1405LUA_API lua_State *
1407
1411LUA_API const char *
1412luaT_tolstring(lua_State *L, int idx, size_t *ssize);
1413
1421LUA_API int
1422luaL_iscallable(lua_State *L, int idx);
1423
1429LUA_API box_ibuf_t *
1430luaT_toibuf(struct lua_State *L, int idx);
1431
1437LUA_API void
1438luaL_pushnull(struct lua_State *L);
1439
1445LUA_API bool
1446luaL_isnull(struct lua_State *L, int idx);
1447
1450struct error;
1451
1459LUA_API int
1460luaT_error(lua_State *L);
1461
1467int
1468luaT_error_at(lua_State *L, int level);
1469
1476LUA_API int
1478
1485void
1486luaT_pusherror(struct lua_State *L, struct error *e);
1516
1525API_EXPORT int64_t
1527
1533API_EXPORT int
1535
1539API_EXPORT bool
1541
1552API_EXPORT int
1554
1561API_EXPORT int
1563
1569API_EXPORT int
1571
1579API_EXPORT void *
1580box_txn_alloc(size_t size);
1581
1591API_EXPORT int
1592box_txn_set_timeout(double timeout);
1593
1602API_EXPORT int
1604
1608API_EXPORT void
1613typedef struct tuple_format box_tuple_format_t;
1614
1623
1627typedef struct tuple box_tuple_t;
1628
1646int
1648
1655void
1657
1662uint32_t
1664
1669size_t
1671
1682ssize_t
1683box_tuple_to_buf(box_tuple_t *tuple, char *buf, size_t size);
1684
1692
1703const char *
1704box_tuple_field(box_tuple_t *tuple, uint32_t fieldno);
1705
1734API_EXPORT const char *
1735box_tuple_field_by_path(box_tuple_t *tuple, const char *path,
1736 uint32_t path_len, int index_base);
1740typedef struct tuple_iterator box_tuple_iterator_t;
1741
1772
1776void
1778
1789uint32_t
1791
1798void
1800
1813const char *
1815
1827const char *
1829
1842box_tuple_new(box_tuple_format_t *format, const char *data, const char *end);
1843
1860box_tuple_update(box_tuple_t *tuple, const char *expr, const char *expr_end);
1861
1885box_tuple_upsert(box_tuple_t *tuple, const char *expr, const char *expr_end);
1886
1895int
1897
1901typedef struct key_def box_key_def_t;
1902
1904enum {
1905 BOX_KEY_PART_DEF_IS_NULLABLE = 1 << 0,
1906 BOX_KEY_PART_DEF_EXCLUDE_NULL = 1 << 1,
1907 BOX_KEY_PART_DEF_SORT_ORDER_DESC = 1 << 2,
1908};
1909
1936enum {
1939};
1940
1965typedef union PACKED {
1966 struct {
1968 uint32_t fieldno;
1970 uint32_t flags;
1972 const char *field_type;
1974 const char *collation;
1994 const char *path;
1995 };
2002
2016box_key_def_new(uint32_t *fields, uint32_t *types, uint32_t part_count);
2017
2050API_EXPORT void
2052
2066box_key_def_new_v2(box_key_part_def_t *parts, uint32_t part_count);
2067
2076
2082API_EXPORT void
2084
2099box_key_def_dump_parts(const box_key_def_t *key_def, uint32_t *part_count_ptr);
2100
2113API_EXPORT int
2115
2125API_EXPORT int
2127 box_key_def_t *key_def);
2139API_EXPORT int
2140box_tuple_compare_with_key(box_tuple_t *tuple_a, const char *key_b,
2141 box_key_def_t *key_def);
2142
2158box_key_def_merge(const box_key_def_t *first, const box_key_def_t *second);
2159
2179API_EXPORT char *
2181 int multikey_idx, uint32_t *key_size_ptr);
2182
2205API_EXPORT int
2206box_key_def_validate_key(const box_key_def_t *key_def, const char *key,
2207 uint32_t *key_size_ptr);
2208
2230API_EXPORT int
2231box_key_def_validate_full_key(const box_key_def_t *key_def, const char *key,
2232 uint32_t *key_size_ptr);
2233
2237/*
2238 * Possible field data types. Can't use STRS/ENUM macros for them,
2239 * since there is a mismatch between enum name (STRING) and type
2240 * name literal ("STR"). STR is already used as Objective C type.
2241 */
2243 FIELD_TYPE_ANY = 0,
2244 FIELD_TYPE_UNSIGNED,
2245 FIELD_TYPE_STRING,
2246 FIELD_TYPE_NUMBER,
2247 FIELD_TYPE_DOUBLE,
2248 FIELD_TYPE_INTEGER,
2249 FIELD_TYPE_BOOLEAN,
2250 FIELD_TYPE_VARBINARY,
2251 FIELD_TYPE_SCALAR,
2252 FIELD_TYPE_DECIMAL,
2253 FIELD_TYPE_UUID,
2254 FIELD_TYPE_DATETIME,
2255 FIELD_TYPE_INTERVAL,
2256 FIELD_TYPE_ARRAY,
2257 FIELD_TYPE_MAP,
2258 FIELD_TYPE_INT8,
2259 FIELD_TYPE_UINT8,
2260 FIELD_TYPE_INT16,
2261 FIELD_TYPE_UINT16,
2262 FIELD_TYPE_INT32,
2263 FIELD_TYPE_UINT32,
2264 FIELD_TYPE_INT64,
2265 FIELD_TYPE_UINT64,
2266 FIELD_TYPE_FLOAT32,
2267 FIELD_TYPE_FLOAT64,
2268 field_type_MAX
2269};
2270
2275 ON_CONFLICT_ACTION_NONE = 0,
2276 ON_CONFLICT_ACTION_ROLLBACK,
2277 ON_CONFLICT_ACTION_ABORT,
2278 ON_CONFLICT_ACTION_FAIL,
2279 ON_CONFLICT_ACTION_IGNORE,
2280 ON_CONFLICT_ACTION_REPLACE,
2281 ON_CONFLICT_ACTION_DEFAULT,
2282 on_conflict_action_MAX
2283};
2284
2297box_tuple_format_new(struct key_def **keys, uint16_t key_count);
2298
2304void
2306
2312void
2314
2325#define SYSTEM_SPACES(_) /* (name, id, is_sync) */ \
2326 \
2327 _(VINYL_DEFERRED_DELETE, 257, false) \
2328 \
2329 _(SCHEMA, 272, true) \
2330 \
2331 _(COLLATION, 276, true) \
2332 \
2333 _(VCOLLATION, 277, true) \
2334 \
2335 _(SPACE, 280, true) \
2336 \
2337 _(VSPACE, 281, true) \
2338 \
2339 _(SEQUENCE, 284, true) \
2340 \
2341 _(SEQUENCE_DATA, 285, false) \
2342 \
2343 _(VSEQUENCE, 286, true) \
2344 \
2345 _(INDEX, 288, true) \
2346 \
2347 _(VINDEX, 289, true) \
2348 \
2349 _(FUNC, 296, true) \
2350 \
2351 _(VFUNC, 297, true) \
2352 \
2353 _(USER, 304, true) \
2354 \
2355 _(VUSER, 305, true) \
2356 \
2357 _(PRIV, 312, true) \
2358 \
2359 _(VPRIV, 313, true) \
2360 \
2361 _(CLUSTER, 320, true) \
2362 \
2363 _(TRIGGER, 328, true) \
2364 \
2365 _(TRUNCATE, 330, true) \
2366 \
2367 _(SPACE_SEQUENCE, 340, true) \
2368 \
2369 _(VSPACE_SEQUENCE, 341, true) \
2370 \
2371 _(FK_CONSTRAINT, 356, true) \
2372 \
2373 _(CK_CONSTRAINT, 364, true) \
2374 \
2375 _(FUNC_INDEX, 372, true) \
2376 \
2377 _(SESSION_SETTINGS, 380, true) \
2378 \
2379 _(GC_CONSUMERS, 388, false) \
2380
2382#define SYSTEM_SPACE_MEMBER(name, id, ...) BOX_ ## name ## _ID = id,
2383
2384enum {
2390 BOX_ID_NIL = 2147483647
2391};
2401API_EXPORT uint64_t
2403
2407API_EXPORT bool
2409
2420API_EXPORT int
2421box_wait_ro(bool ro, double timeout);
2422
2430API_EXPORT const char *
2432
2436/*
2437 * Opaque structure passed to the stored C procedure
2438 */
2439typedef struct box_function_ctx box_function_ctx_t;
2440
2452
2465typedef enum iproto_handler_status
2466(*iproto_handler_t)(const char *header, const char *header_end,
2467 const char *body, const char *body_end,
2468 void *ctx);
2469
2476typedef void
2477(*iproto_handler_destroy_t)(void *ctx);
2478
2490API_EXPORT int
2492
2509API_EXPORT int
2510box_return_mp(box_function_ctx_t *ctx, const char *mp, const char *mp_end);
2511
2522API_EXPORT uint32_t
2523box_space_id_by_name(const char *name, uint32_t len);
2524
2536API_EXPORT uint32_t
2537box_index_id_by_name(uint32_t space_id, const char *name, uint32_t len);
2538
2550API_EXPORT int
2551box_insert(uint32_t space_id, const char *tuple, const char *tuple_end,
2552 box_tuple_t **result);
2553
2565API_EXPORT int
2566box_replace(uint32_t space_id, const char *tuple, const char *tuple_end,
2567 box_tuple_t **result);
2568
2581API_EXPORT int
2582box_delete(uint32_t space_id, uint32_t index_id, const char *key,
2583 const char *key_end, box_tuple_t **result);
2584
2603API_EXPORT int
2604box_update(uint32_t space_id, uint32_t index_id, const char *key,
2605 const char *key_end, const char *ops, const char *ops_end,
2606 int index_base, box_tuple_t **result);
2607
2626API_EXPORT int
2627box_upsert(uint32_t space_id, uint32_t index_id, const char *tuple,
2628 const char *tuple_end, const char *ops, const char *ops_end,
2629 int index_base, box_tuple_t **result);
2630
2631struct ArrowArray;
2632struct ArrowSchema;
2633
2652API_EXPORT int
2653box_insert_arrow(uint32_t space_id, struct ArrowArray *array,
2654 struct ArrowSchema *schema);
2655
2661API_EXPORT int
2662box_truncate(uint32_t space_id);
2663
2673API_EXPORT int
2674box_sequence_next(uint32_t seq_id, int64_t *result);
2675
2685API_EXPORT int
2686box_sequence_current(uint32_t seq_id, int64_t *result);
2687
2697API_EXPORT int
2698box_sequence_set(uint32_t seq_id, int64_t value);
2699
2707API_EXPORT int
2708box_sequence_reset(uint32_t seq_id);
2709
2721API_EXPORT int
2722box_session_push(const char *data, const char *data_end);
2723
2728API_EXPORT uint64_t
2730
2745API_EXPORT int
2746box_iproto_send(uint64_t sid,
2747 const char *header, const char *header_end,
2748 const char *body, const char *body_end);
2749
2767API_EXPORT int
2768box_iproto_override(uint32_t req_type, iproto_handler_t handler,
2769 iproto_handler_destroy_t destroy, void *ctx);
2770
2775API_EXPORT int64_t
2777
2787
2791API_EXPORT uint64_t
2793
2797typedef struct iterator box_iterator_t;
2798
2815box_index_iterator(uint32_t space_id, uint32_t index_id, int type,
2816 const char *key, const char *key_end);
2825int
2827
2833void
2835
2844ssize_t
2845box_index_len(uint32_t space_id, uint32_t index_id);
2846
2855ssize_t
2856box_index_bsize(uint32_t space_id, uint32_t index_id);
2857
2884int
2885box_index_quantile(uint32_t space_id, uint32_t index_id, double level,
2886 const char *begin_key, const char *begin_key_end,
2887 const char *end_key, const char *end_key_end,
2888 const char **quantile_key, const char **quantile_key_end);
2889
2901int
2902box_index_random(uint32_t space_id, uint32_t index_id, uint32_t rnd,
2903 box_tuple_t **result);
2904
2921int
2922box_index_get(uint32_t space_id, uint32_t index_id, const char *key,
2923 const char *key_end, box_tuple_t **result);
2924
2937int
2938box_index_min(uint32_t space_id, uint32_t index_id, const char *key,
2939 const char *key_end, box_tuple_t **result);
2940
2953int
2954box_index_max(uint32_t space_id, uint32_t index_id, const char *key,
2955 const char *key_end, box_tuple_t **result);
2956
2970ssize_t
2971box_index_count(uint32_t space_id, uint32_t index_id, int type,
2972 const char *key, const char *key_end);
2973
2986char *
2987box_tuple_extract_key(box_tuple_t *tuple, uint32_t space_id,
2988 uint32_t index_id, uint32_t *key_size);
2989
3014 /* ITER_EQ must be the first member for request_create */
3015 ITER_EQ = 0, /* key == x ASC order */
3016 ITER_REQ = 1, /* key == x DESC order */
3017 ITER_ALL = 2, /* all tuples */
3018 ITER_LT = 3, /* key < x */
3019 ITER_LE = 4, /* key <= x */
3020 ITER_GE = 5, /* key >= x */
3021 ITER_GT = 6, /* key > x */
3022 ITER_BITS_ALL_SET = 7, /* all bits from x are set in key */
3023 ITER_BITS_ANY_SET = 8, /* at least one x's bit is set */
3024 ITER_BITS_ALL_NOT_SET = 9, /* all bits are not set */
3025 ITER_OVERLAPS = 10, /* key overlaps x */
3026 ITER_NEIGHBOR = 11, /* tuples as they move away from x point */
3027 ITER_NP = 12, /* next prefix, ASC order */
3028 ITER_PP = 13, /* previous prefix, DESC order */
3029 iterator_type_MAX
3030};
3031
3035struct error;
3039typedef struct error box_error_t;
3040
3046const char *
3048
3054uint32_t
3056
3062const char *
3064
3088
3092void
3094
3107int
3108box_error_set(const char *file, unsigned line, uint32_t code,
3109 const char *format, ...);
3110
3114#define box_error_raise(code, format, ...) \
3115 box_error_set(__FILE__, __LINE__, code, format, ##__VA_ARGS__)
3116
3130luaT_checktuple(struct lua_State *L, int idx);
3131
3139API_EXPORT void
3140luaT_pushtuple(struct lua_State *L, box_tuple_t *tuple);
3141
3151luaT_istuple(struct lua_State *L, int idx);
3152
3168API_EXPORT char *
3169luaT_tuple_encode(struct lua_State *L, int idx, size_t *tuple_len_ptr);
3170
3190luaT_tuple_new(struct lua_State *L, int idx, box_tuple_format_t *format);
3191
3198typedef struct box_latch box_latch_t;
3199
3206
3211void
3213
3220void
3222
3229int
3231
3238void
3240
3250double
3252
3258double
3260
3267double
3269
3275double
3277
3282int64_t
3284
3289int64_t
3291
3296int64_t
3298
3303int64_t
3305
3309/* {{{ decimal structure and constants */
3310
3322 uint64_t internal[8];
3323};
3324
3352
3357#define BOX_DECIMAL_STRING_BUFFER_SIZE 128
3358
3359/* }}} decimal structure and constants */
3360
3361/* {{{ decimal properties */
3362
3374API_EXPORT int
3376
3386API_EXPORT int
3388
3396API_EXPORT bool
3398
3406API_EXPORT bool
3408
3409/* }}} decimal properties */
3410
3411/* {{{ decimal constructors */
3412
3421
3435
3447
3457
3467
3482
3483/* }}} decimal constructors */
3484
3485/* {{{ decimal conversions */
3486
3496API_EXPORT void
3498
3508box_decimal_to_int64(const box_decimal_t *dec, int64_t *num);
3509
3519box_decimal_to_uint64(const box_decimal_t *dec, uint64_t *num);
3520
3521/* }}} decimal conversions */
3522
3523/* {{{ decimal rounding */
3524
3549
3571
3580
3599
3600/* }}} decimal rounding */
3601
3602/* {{{ decimal arithmetic */
3603
3613API_EXPORT int
3615
3629
3641
3653 const box_decimal_t *rhs);
3654
3666 const box_decimal_t *rhs);
3667
3679 const box_decimal_t *rhs);
3680
3692 const box_decimal_t *rhs);
3693
3707 const box_decimal_t *rhs);
3708
3709/* }}} decimal arithmetic */
3710
3711/* {{{ decimal math functions */
3712
3723
3734
3746 const box_decimal_t *rhs);
3747
3758
3769
3770/* }}} decimal math functions */
3771
3772/* {{{ decimal encoding to/decoding from msgpack */
3773
3781uint32_t
3783
3791char *
3792box_decimal_mp_encode(const box_decimal_t *dec, char *data);
3793
3805box_decimal_mp_decode(box_decimal_t *dec, const char **data);
3806
3835 uint32_t size);
3836
3837/* }}} decimal encoding to/decoding from msgpack */
3838
3847luaT_newdecimal(struct lua_State *L);
3848
3854luaT_pushdecimal(struct lua_State *L, const box_decimal_t *dec);
3855
3863luaT_isdecimal(struct lua_State *L, int index);
3864
3866enum 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_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_SYNC_QUEUE_FULL = 289, ER_KEY_PART_VALUE_OUT_OF_RANGE = 290, ER_REPLICA_GC = 291, ER_ALIEN_ENGINE = 292, ER_MVCC_UNAVAILABLE = 293, box_error_code_MAX };
3867#if defined(__cplusplus)
3868} /* extern "C" */
3869#endif /* defined(__cplusplus) */
3870
3871#endif /* TARANTOOL_MODULE_H_INCLUDED */
box_error_code
public
Definition module.h:3866
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.
int box_index_quantile(uint32_t space_id, uint32_t index_id, double level, const char *begin_key, const char *begin_key_end, const char *end_key, const char *end_key_end, const char **quantile_key, const char **quantile_key_end)
Return a quantile point in an indexed range.
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:2466
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:2382
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:3013
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:2797
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:2444
@ IPROTO_HANDLER_ERROR
Error, diagnostic must be set by handler via box_error_set().
Definition module.h:2448
@ IPROTO_HANDLER_OK
Success, no further actions needed.
Definition module.h:2446
@ IPROTO_HANDLER_FALLBACK
Fallback to system handler.
Definition module.h:2450
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 tnt_tx_push(tnt_tx_func_f func, void *arg)
Schedule the given callback to be executed in TX thread with the provided argument.
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.
void tnt_tx_flush(void)
Send all the pending callbacks of this thread to TX thread.
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:1627
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:3198
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:1938
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:1740
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:2439
#define SYSTEM_SPACES(_)
public
Definition module.h:2325
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:2477
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:1613
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(* tnt_tx_func_f)(void *)
public
Definition module.h:1166
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:2386
@ BOX_SYSTEM_ID_MAX
End of the reserved range of system spaces.
Definition module.h:2389
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:2274
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:1901
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:3039
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:2779
@ BOX_SLAB_INFO_ARENA_SIZE
Definition module.h:2782
@ BOX_SLAB_INFO_QUOTA_SIZE
Definition module.h:2784
@ BOX_SLAB_INFO_ITEMS_SIZE
Definition module.h:2780
@ BOX_SLAB_INFO_QUOTA_USED
Definition module.h:2785
@ BOX_SLAB_INFO_ARENA_USED
Definition module.h:2783
@ BOX_SLAB_INFO_ITEMS_USED
Definition module.h:2781
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:1211
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:1502
@ TXN_ISOLATION_READ_COMMITTED
Allow to read committed, but not confirmed changes.
Definition module.h:1506
@ TXN_ISOLATION_DEFAULT
Take isolation level from global default_isolation_level.
Definition module.h:1504
@ TXN_ISOLATION_LINEARIZABLE
Allow to read only the changes confirmed on any cluster node.
Definition module.h:1512
@ txn_isolation_level_MAX
Upper bound of valid values.
Definition module.h:1514
@ TXN_ISOLATION_READ_CONFIRMED
Allow to read only confirmed changes.
Definition module.h:1508
@ TXN_ISOLATION_BEST_EFFORT
Determine isolation level automatically.
Definition module.h:1510
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:2242
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:3312
uint64_t internal[8]
Decimal data.
Definition module.h:3322
Public representation of a key part definition.
Definition module.h:1965
char padding[BOX_KEY_PART_DEF_T_SIZE]
Padding to guarantee certain size across different tarantool versions.
Definition module.h:2000
const char * path
JSON path to point a nested field.
Definition module.h:1994
uint32_t flags
Flags, e.g.
Definition module.h:1970
uint32_t fieldno
Index of a tuple field (zero based).
Definition module.h:1968
const char * collation
Collation name for string comparisons.
Definition module.h:1974
const char * field_type
Type of the tuple field.
Definition module.h:1972