#include <stddef.h>
#include <stdarg.h>
#include <errno.h>
#include <stdint.h>
#include <stdbool.h>
#include <stdio.h>
#include <sys/types.h>
#include "lua.h"
Go to the source code of this file.
Data Structures | |
union | PACKED |
Public representation of a key part definition. More... | |
struct | box_decimal |
public More... | |
Macros | |
#define | PACKAGE_VERSION_MAJOR 3 |
Package major version - 1 for 1.6.7. | |
#define | PACKAGE_VERSION_MINOR 4 |
Package minor version - 6 for 1.6.7. | |
#define | PACKAGE_VERSION_PATCH 0 |
Package patch version - 7 for 1.6.7. | |
#define | PACKAGE_VERSION "3.4.0-entrypoint-224-gf00141723d" |
A string with major-minor-patch-commit-id identifier of the release, e.g. | |
#define | TZDATA_VERSION "2022a" |
A string with tag identifier of the tzdata release, e.g. | |
#define | SYSCONF_DIR "etc" |
public | |
#define | INSTALL_PREFIX "/usr/local" |
Install prefix (e.g. | |
#define | BUILD_TYPE "Debug" |
Build type, e.g. | |
#define | BUILD_INFO "Linux-x86_64-Debug" |
CMake build type signature, e.g. | |
#define | BUILD_OPTIONS "cmake . -DCMAKE_INSTALL_PREFIX=/usr/local -DENABLE_BACKTRACE=TRUE" |
Command line used to run CMake. | |
#define | COMPILER_INFO "GNU-13.3.0" |
Compiler ID and version, assuming the C and C++ compiler IDs are equal. | |
#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 " |
C compile flags used to build Tarantool. | |
#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 " |
CXX compile flags used to build Tarantool. | |
#define | MODULE_LIBDIR "/usr/local/lib/tarantool" |
A path to install *.lua module files. | |
#define | MODULE_LUADIR "/usr/local/share/tarantool" |
A path to install *.so / *.dylib module files. | |
#define | MODULE_INCLUDEDIR "/usr/local/include/tarantool" |
A path to Lua includes (the same directory where this file is contained) | |
#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" |
A constant added to package.path in Lua to find *.lua module files. | |
#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" |
A constant added to package.cpath in Lua to find *.so module files. | |
#define | MODULE_LIBSUFFIX ".so" |
Shared library suffix - ".so" on Linux, ".dylib" on Mac. | |
#define | __has_feature(x) 0 |
public | |
#define | __has_builtin(x) 0 |
The special operator __has_builtin (operand) may be used in constant integer contexts and in preprocessor "#if" and "#elif" expressions to test whether the symbol named by its operand is recognized as a built-in function by GCC in the current language and conformance mode. | |
#define | __has_attribute(x) 0 |
The special operator __has_attribute (operand) may be used in "#if" and "#elif" expressions to test whether the attribute referenced by its operand is recognized by GCC. | |
#define | __has_cpp_attribute(x) 0 |
The special operator __has_cpp_attribute (operand) may be used in "#if" and "#elif" expressions in C++ code to test whether the attribute referenced by it operand is recognized by GCC. | |
#define | likely(x) (x) |
Compiler-independent built-ins. | |
#define | unlikely(x) (x) |
You may use likely()/unlikely() to provide the compiler with branch prediction information. | |
#define | prefetch(addr, ...) ((void) addr) |
This macro is used to minimize cache-miss latency by moving data into a cache before it is accessed. | |
#define | unreachable() (assert(0)) |
If control flow reaches the point of the unreachable(), the program is undefined. | |
#define | offsetof(type, member) ((size_t)&((type *)0)->member) |
The macro offsetof expands to an integral constant expression of type size_t, the value of which is the offset, in bytes, from the beginning of an object of specified type to its specified member, including padding if any. | |
#define | container_of(ptr, type, member) |
This macro is used to retrieve an enclosing structure from a pointer to a nested element. | |
#define | alignas(_n) |
C11/C++11 keyword. | |
#define | alignof(_T) offsetof(struct { char c; _T member; }, member) |
C11/C++11 operator. | |
#define | MAYBE_UNUSED |
Built-ins }}}. | |
#define | NODISCARD |
A diagnostic is generated when a function is marked with NODISCARD and the function call appears as a potentially-evaluated discarded-value expression that is not explicitly cast to void. | |
#define | NOINLINE |
This function attribute prevents a function from being considered for inlining. | |
#define | ALWAYS_INLINE inline |
Adds the 'always_inline' attribute to the function if it's supported. | |
#define | NORETURN |
A function declared as NORETURN shall not return to its caller. | |
#define | DEPRECATED(_msg) |
The DEPRECATED attribute can be applied to a function, a variable, or a type. | |
#define | API_EXPORT extern |
The API_EXPORT attribute declares public C API function. | |
#define | CFORMAT(archetype, stringindex, firsttocheck) |
The CFORMAT attribute specifies that a function takes printf, scanf, strftime or strfmon style arguments that should be type-checked against a format string. | |
#define | PACKED |
The PACKED qualifier is useful to map a structure to an external data structure, or for accessing unaligned data, but it is generally not useful to save data size because of the relatively high cost of unaligned access on some architectures. | |
#define | NO_SANITIZE_ADDRESS |
NO_SANITIZE_ADDRESS attribute disables AddressSanitizer for a given function. | |
#define | FALLTHROUGH |
Function Attributes }}}. | |
#define | say_file_line(level, file, line, error, format, ...) |
Format and print a message to Tarantool log file. | |
#define | say(level, error, format, ...) |
Format and print a message to Tarantool log file. | |
#define | say_error(format, ...) say(S_ERROR, NULL, format, ##__VA_ARGS__) |
Format and print a message to Tarantool log file. | |
#define | say_crit(format, ...) say(S_CRIT, NULL, format, ##__VA_ARGS__) |
Format and print a message to Tarantool log file. | |
#define | say_warn(format, ...) say(S_WARN, NULL, format, ##__VA_ARGS__) |
Format and print a message to Tarantool log file. | |
#define | say_info(format, ...) say(S_INFO, NULL, format, ##__VA_ARGS__) |
Format and print a message to Tarantool log file. | |
#define | say_verbose(format, ...) say(S_VERBOSE, NULL, format, ##__VA_ARGS__) |
Format and print a message to Tarantool log file. | |
#define | say_debug(format, ...) say(S_DEBUG, NULL, format, ##__VA_ARGS__) |
Format and print a message to Tarantool log file. | |
#define | say_syserror(format, ...) |
Format and print a message to Tarantool log file. | |
#define | SYSTEM_SPACES(_) |
public | |
#define | SYSTEM_SPACE_MEMBER(name, id, ...) BOX_ ## name ## _ID = id, |
System space identifier definition. | |
#define | box_error_raise(code, format, ...) box_error_set(__FILE__, __LINE__, code, format, ##__VA_ARGS__) |
A backward-compatible API define. | |
#define | BOX_DECIMAL_STRING_BUFFER_SIZE 128 |
Buffer of this size is enough to hold any box_decimal_to_string() result. | |
Typedefs | |
typedef void(* | sayfunc_t) (int, const char *, int, const char *, const char *,...) |
public | |
typedef int(* | fiber_func) (va_list) |
Fiber - contains information about fiber. | |
typedef void(* | tnt_tx_func_f) (void *) |
public | |
typedef struct ibuf | box_ibuf_t |
public | |
typedef struct tuple_format | box_tuple_format_t |
public | |
typedef struct tuple | box_tuple_t |
Tuple. | |
typedef struct tuple_iterator | box_tuple_iterator_t |
Tuple iterator. | |
typedef struct key_def | box_key_def_t |
public | |
typedef union PACKED | box_key_part_def_t |
Public representation of a key part definition. | |
typedef struct box_function_ctx | box_function_ctx_t |
public | |
typedef 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_iproto_override(), and must return one of the status codes from iproto_handler_status. | |
typedef void(* | iproto_handler_destroy_t) (void *ctx) |
IPROTO request handler destructor called when the corresponding handler is removed. | |
typedef struct iterator | box_iterator_t |
public | |
typedef struct error | box_error_t |
Error - contains information about error. | |
typedef struct box_latch | box_latch_t |
public | |
typedef struct box_decimal | box_decimal_t |
Storage for a decimal number. | |
Enumerations | |
enum | say_level { S_FATAL , S_SYSERROR , S_ERROR , S_CRIT , S_WARN , S_INFO , S_VERBOSE , S_DEBUG , say_level_MAX } |
public More... | |
enum | say_format { SF_PLAIN , SF_JSON , say_format_MAX } |
Log formats. | |
enum | { COIO_READ = 0x1 , COIO_WRITE = 0x2 } |
public More... | |
enum | txn_isolation_level { TXN_ISOLATION_DEFAULT , TXN_ISOLATION_READ_COMMITTED , TXN_ISOLATION_READ_CONFIRMED , TXN_ISOLATION_BEST_EFFORT , TXN_ISOLATION_LINEARIZABLE , txn_isolation_level_MAX } |
public More... | |
enum | { BOX_KEY_PART_DEF_IS_NULLABLE = 1 << 0 , BOX_KEY_PART_DEF_EXCLUDE_NULL = 1 << 1 , BOX_KEY_PART_DEF_SORT_ORDER_DESC = 1 << 2 } |
Key part definition flags. | |
enum | { BOX_KEY_PART_DEF_T_SIZE = 64 } |
It is recommended to verify size of box_key_part_def_t against this constant on the module side at build time. More... | |
enum | field_type { FIELD_TYPE_ANY = 0 , FIELD_TYPE_UNSIGNED , FIELD_TYPE_STRING , FIELD_TYPE_NUMBER , FIELD_TYPE_DOUBLE , FIELD_TYPE_INTEGER , FIELD_TYPE_BOOLEAN , FIELD_TYPE_VARBINARY , FIELD_TYPE_SCALAR , FIELD_TYPE_DECIMAL , FIELD_TYPE_UUID , FIELD_TYPE_DATETIME , FIELD_TYPE_INTERVAL , FIELD_TYPE_ARRAY , FIELD_TYPE_MAP , FIELD_TYPE_INT8 , FIELD_TYPE_UINT8 , FIELD_TYPE_INT16 , FIELD_TYPE_UINT16 , FIELD_TYPE_INT32 , FIELD_TYPE_UINT32 , FIELD_TYPE_INT64 , FIELD_TYPE_UINT64 , FIELD_TYPE_FLOAT32 , FIELD_TYPE_FLOAT64 , field_type_MAX } |
public | |
enum | on_conflict_action { ON_CONFLICT_ACTION_NONE = 0 , ON_CONFLICT_ACTION_ROLLBACK , ON_CONFLICT_ACTION_ABORT , ON_CONFLICT_ACTION_FAIL , ON_CONFLICT_ACTION_IGNORE , ON_CONFLICT_ACTION_REPLACE , ON_CONFLICT_ACTION_DEFAULT , on_conflict_action_MAX } |
Possible actions on conflict. | |
enum | { BOX_SYSTEM_ID_MIN = 256 , BOX_SYSTEM_ID_MAX = 511 , BOX_ID_NIL = 2147483647 } |
enum | iproto_handler_status { IPROTO_HANDLER_OK , IPROTO_HANDLER_ERROR , IPROTO_HANDLER_FALLBACK } |
Return codes for IPROTO request handlers. More... | |
enum | box_slab_info_type { BOX_SLAB_INFO_ITEMS_SIZE = 0 , BOX_SLAB_INFO_ITEMS_USED = 1 , BOX_SLAB_INFO_ARENA_SIZE = 2 , BOX_SLAB_INFO_ARENA_USED = 3 , BOX_SLAB_INFO_QUOTA_SIZE = 4 , BOX_SLAB_INFO_QUOTA_USED = 5 } |
enum | iterator_type { ITER_EQ = 0 , ITER_REQ = 1 , ITER_ALL = 2 , ITER_LT = 3 , ITER_LE = 4 , ITER_GE = 5 , ITER_GT = 6 , ITER_BITS_ALL_SET = 7 , ITER_BITS_ANY_SET = 8 , ITER_BITS_ALL_NOT_SET = 9 , ITER_OVERLAPS = 10 , ITER_NEIGHBOR = 11 , ITER_NP = 12 , ITER_PP = 13 , iterator_type_MAX } |
public More... | |
enum | 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 } |
public | |
Functions | |
int | box_on_shutdown (void *arg, int(*new_handler)(void *), int(*old_handler)(void *)) |
Statement Attributes }}}. | |
static bool | say_log_level_is_enabled (int level) |
Function checks whether passed log level is enabled. | |
CFORMAT (printf, 5, 6) extern sayfunc_t _say | |
Internal function used to implement say() macros. | |
const char * | _say_strerror (int errnum) |
Internal function that implements MT-Safe strerror(). | |
struct fiber_attr * | fiber_attr_new (void) |
Create a new fiber attribute container and initialize it with default parameters. | |
void | fiber_attr_delete (struct fiber_attr *fiber_attr) |
Delete the fiber_attr and free all allocated resources. | |
int | fiber_attr_setstacksize (struct fiber_attr *fiber_attr, size_t stack_size) |
Set stack size for the fiber attribute. | |
size_t | fiber_attr_getstacksize (struct fiber_attr *fiber_attr) |
Get stack size from the fiber attribute. | |
struct fiber * | fiber_self (void) |
Return the current fiber. | |
struct fiber * | fiber_new (const char *name, fiber_func f) |
Create a new fiber. | |
struct fiber * | fiber_new_ex (const char *name, const struct fiber_attr *fiber_attr, fiber_func f) |
Create a new fiber with defined attributes. | |
void | fiber_yield (void) |
Return control to another fiber and wait until it'll be woken. | |
void | fiber_start (struct fiber *callee,...) |
Start execution of created fiber. | |
void | fiber_set_ctx (struct fiber *f, void *f_arg) |
Set a pointer to context for the fiber. | |
void * | fiber_get_ctx (struct fiber *f) |
Get the context for the fiber which was set via the fiber_set_ctx function. | |
void | fiber_wakeup (struct fiber *f) |
Interrupt a synchronous wait of a fiber. | |
void | fiber_cancel (struct fiber *f) |
Cancel the subject fiber. | |
bool | fiber_set_cancellable (bool yesno) |
Deprecated. | |
void | fiber_set_joinable (struct fiber *fiber, bool yesno) |
Set fiber to be joinable (false by default). | |
int | fiber_join (struct fiber *f) |
Wait until the fiber is dead and then move its execution status to the caller. | |
int | fiber_join_timeout (struct fiber *f, double timeout) |
Wait until the fiber is dead or timeout exceeded. | |
void | fiber_sleep (double s) |
Put the current fiber to sleep for at least 's' seconds. | |
bool | fiber_is_cancelled (void) |
Check current fiber for cancellation (it must be checked manually). | |
double | fiber_time (void) |
Report loop begin time as double (cheap). | |
int64_t | fiber_time64 (void) |
Report loop begin time as 64-bit int. | |
double | fiber_clock (void) |
Report loop begin time as double (cheap). | |
int64_t | fiber_clock64 (void) |
Report loop begin time as 64-bit int. | |
void | fiber_reschedule (void) |
Reschedule fiber to end of event loop cycle. | |
void | fiber_set_name_n (struct fiber *fiber, const char *name, uint32_t len) |
Set fiber name. | |
const char * | fiber_name (const struct fiber *fiber) |
Get fiber name. | |
uint64_t | fiber_id (const struct fiber *fiber) |
Get fiber id. | |
uint64_t | fiber_csw (const struct fiber *fiber) |
Get number of context switches of the given fiber. | |
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 getting other info about the fiber (name, csw, etc.). | |
size_t | box_region_used (void) |
box region allocator | |
void * | box_region_alloc (size_t size) |
Allocate size bytes from the box region. | |
void * | box_region_aligned_alloc (size_t size, size_t alignment) |
Allocate size bytes from the box region with given alignment. | |
void | box_region_truncate (size_t size) |
Truncate the box region to the given size. | |
struct fiber_cond * | fiber_cond_new (void) |
public | |
void | fiber_cond_delete (struct fiber_cond *cond) |
Delete the fiber cond object. | |
void | fiber_cond_signal (struct fiber_cond *cond) |
Wake one fiber waiting for the cond. | |
void | fiber_cond_broadcast (struct fiber_cond *cond) |
Wake up all fibers waiting for the cond. | |
int | fiber_cond_wait_timeout (struct fiber_cond *cond, double timeout) |
Suspend the execution of the current fiber (i.e. | |
int | fiber_cond_wait (struct fiber_cond *cond) |
Shortcut for fiber_cond_wait_timeout(). | |
int | coio_wait (int fd, int event, double timeout) |
Wait until READ or WRITE event on socket (fd). | |
int | coio_close (int fd) |
Close the fd and wake any fiber blocked in coio_wait() call on this fd. | |
ssize_t | coio_call (ssize_t(*func)(va_list),...) |
public | |
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 | 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 | tnt_tx_flush (void) |
Send all the pending callbacks of this thread to TX thread. | |
void * | box_ibuf_reserve (box_ibuf_t *ibuf, size_t size) |
Reserve requested amount of bytes in ibuf buffer. | |
void | box_ibuf_read_range (box_ibuf_t *ibuf, char ***rpos, char ***wpos) |
Return pointers to read range pointers used [rpos..wpos) | |
void | box_ibuf_write_range (box_ibuf_t *ibuf, char ***wpos, char ***end) |
Return pointers to write range pointers used [wpos..end) | |
int | luaL_iscdata (struct lua_State *L, int idx) |
public | |
void * | luaL_pushcdata (struct lua_State *L, uint32_t ctypeid) |
Push cdata of given ctypeid onto the stack. | |
void * | luaL_checkcdata (struct lua_State *L, int idx, uint32_t *ctypeid) |
Checks whether the function argument idx is a cdata. | |
void | luaL_setcdatagc (struct lua_State *L, int idx) |
Sets finalizer function on a cdata object. | |
size_t | luaL_getgctotal (struct lua_State *L) |
Return size of currently allocated memory. | |
uint32_t | luaL_ctypeid (struct lua_State *L, const char *ctypename) |
Return CTypeID (FFI) of given СDATA type. | |
int | luaL_cdef (struct lua_State *L, const char *ctypename) |
Declare symbols for FFI. | |
void | luaL_pushuint64 (struct lua_State *L, uint64_t val) |
public | |
void | luaL_pushint64 (struct lua_State *L, int64_t val) |
Push int64_t onto the stack. | |
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. | |
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. | |
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. | |
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 | luaT_call (lua_State *L, int nargs, int nreturns) |
Like lua_call(), but with the proper support of Tarantool errors. | |
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. | |
int | luaT_cpcall (lua_State *L, lua_CFunction func, void *ud) |
Like lua_cpcall(), but with the proper support of Tarantool errors. | |
lua_State * | luaT_state (void) |
Get global Lua state used by Tarantool. | |
const char * | luaT_tolstring (lua_State *L, int idx, size_t *ssize) |
Like lua_tolstring, but supports metatables, booleans and nil properly. | |
int | luaL_iscallable (lua_State *L, int idx) |
Check whether a Lua object is a function or has metatable/metatype with a __call field. | |
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 | luaL_pushnull (struct lua_State *L) |
Push ffi's NULL (cdata<void *>: NULL) onto the stack. | |
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 | luaT_error (lua_State *L) |
Re-throws the last Tarantool error as a Lua object. | |
int | luaT_error_at (lua_State *L, int level) |
Same as luaT_error but set error trace frame according to given level. | |
int | luaT_push_nil_and_error (lua_State *L) |
Return nil as the first return value and an error as the second. | |
void | luaT_pusherror (struct lua_State *L, struct error *e) |
Push error to a Lua stack. | |
int64_t | box_txn_id (void) |
public | |
int | box_txn_isolation (void) |
Get isolation level of current transaction, one of enum txn_isolation_level values (but cannot be TXN_ISOLATION_DEFAULT (which is zero) by design). | |
bool | box_txn (void) |
Return true if there is an active transaction. | |
int | box_txn_begin (void) |
Begin a transaction in the current fiber. | |
int | box_txn_commit (void) |
Commit the current transaction. | |
int | box_txn_rollback (void) |
Rollback the current transaction. | |
void * | box_txn_alloc (size_t size) |
Allocate memory on txn memory pool. | |
int | box_txn_set_timeout (double timeout) |
Set timeout for transaction, when it expires, transaction will be rolled back. | |
int | box_txn_set_isolation (uint32_t level) |
Set an isolation level for a transaction. | |
void | box_txn_make_sync (void) |
Make the transaction synchronous. | |
box_tuple_format_t * | box_tuple_format_default (void) |
Tuple Format. | |
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. | |
uint32_t | box_tuple_field_count (box_tuple_t *tuple) |
Return the number of fields in tuple (the size of MsgPack Array). | |
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_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_format_t * | box_tuple_format (box_tuple_t *tuple) |
Return the associated format. | |
const char * | box_tuple_field (box_tuple_t *tuple, uint32_t fieldno) |
Return the raw tuple field in MsgPack format. | |
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. | |
box_tuple_iterator_t * | box_tuple_iterator (box_tuple_t *tuple) |
Allocate and initialize a new tuple iterator. | |
void | box_tuple_iterator_free (box_tuple_iterator_t *it) |
Destroy and free tuple iterator. | |
uint32_t | box_tuple_position (box_tuple_iterator_t *it) |
Return zero-based next position in iterator. | |
void | box_tuple_rewind (box_tuple_iterator_t *it) |
Rewind iterator to the initial position. | |
const char * | box_tuple_seek (box_tuple_iterator_t *it, uint32_t fieldno) |
Seek the tuple iterator. | |
const char * | box_tuple_next (box_tuple_iterator_t *it) |
Return the next tuple field from tuple iterator. | |
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. | |
box_tuple_t * | box_tuple_update (box_tuple_t *tuple, const char *expr, const char *expr_end) |
Update a tuple. | |
box_tuple_t * | box_tuple_upsert (box_tuple_t *tuple, const char *expr, const char *expr_end) |
Update a tuple. | |
int | box_tuple_validate (box_tuple_t *tuple, box_tuple_format_t *format) |
Check tuple data correspondence to the space format. | |
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_key_part_def_create (box_key_part_def_t *part) |
Initialize a key part with default values. | |
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. | |
box_key_def_t * | box_key_def_dup (const box_key_def_t *key_def) |
Duplicate key_def. | |
void | box_key_def_delete (box_key_def_t *key_def) |
Delete key definition. | |
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 | box_key_def_validate_tuple (box_key_def_t *key_def, box_tuple_t *tuple) |
Check that tuple fields match with given key definition. | |
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_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. | |
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. | |
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 this key. | |
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_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. | |
box_tuple_format_t * | box_tuple_format_new (struct key_def **keys, uint16_t key_count) |
public | |
void | box_tuple_format_ref (box_tuple_format_t *format) |
Increment tuple format ref count. | |
void | box_tuple_format_unref (box_tuple_format_t *format) |
Decrement tuple format ref count. | |
uint64_t | box_schema_version (void) |
public | |
bool | box_is_ro (void) |
public | |
int | box_wait_ro (bool ro, double timeout) |
public | |
const char * | box_ro_reason (void) |
public | |
int | box_return_tuple (box_function_ctx_t *ctx, box_tuple_t *tuple) |
Return a tuple from stored C procedure. | |
int | box_return_mp (box_function_ctx_t *ctx, const char *mp, const char *mp_end) |
Return MessagePack from a stored C procedure. | |
uint32_t | box_space_id_by_name (const char *name, uint32_t len) |
Find space id by name. | |
uint32_t | box_index_id_by_name (uint32_t space_id, const char *name, uint32_t len) |
Find index id by name. | |
int | box_insert (uint32_t space_id, const char *tuple, const char *tuple_end, box_tuple_t **result) |
Execute an INSERT request. | |
int | box_replace (uint32_t space_id, const char *tuple, const char *tuple_end, box_tuple_t **result) |
Execute an REPLACE request. | |
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. | |
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. | |
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. | |
int | box_insert_arrow (uint32_t space_id, struct ArrowArray *array, struct ArrowSchema *schema) |
Executes a batch insert request. | |
int | box_truncate (uint32_t space_id) |
Truncate space. | |
int | box_sequence_next (uint32_t seq_id, int64_t *result) |
Advance a sequence. | |
int | box_sequence_current (uint32_t seq_id, int64_t *result) |
Get the last value returned by a sequence. | |
int | box_sequence_set (uint32_t seq_id, int64_t value) |
Set a sequence value. | |
int | box_sequence_reset (uint32_t seq_id) |
Reset a sequence. | |
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. | |
uint64_t | box_session_id (void) |
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. | |
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. | |
int64_t | box_info_lsn (void) |
Get self LSN component of box vclock, -1 if no one or bootstrap haven't succeeded. | |
uint64_t | box_slab_info (enum box_slab_info_type type) |
Get memtx status information for box.slab.info. | |
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. | |
int | box_iterator_next (box_iterator_t *iterator, box_tuple_t **result) |
Retrieve the next item from the iterator. | |
void | box_iterator_free (box_iterator_t *iterator) |
Destroy and deallocate iterator. | |
ssize_t | box_index_len (uint32_t space_id, uint32_t index_id) |
Return the number of element in the index. | |
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_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. | |
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). | |
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. | |
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. | |
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. | |
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. | |
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. | |
const char * | box_error_type (const box_error_t *error) |
Return the error type, e.g. | |
uint32_t | box_error_code (const box_error_t *error) |
Return IPROTO error code. | |
const char * | box_error_message (const box_error_t *error) |
Return the error message. | |
box_error_t * | box_error_last (void) |
Get the information about the last API call error. | |
void | box_error_clear (void) |
Clear the last error. | |
int | box_error_set (const char *file, unsigned line, uint32_t code, const char *format,...) |
Set the last error. | |
box_tuple_t * | luaT_checktuple (struct lua_State *L, int idx) |
public | |
void | luaT_pushtuple (struct lua_State *L, box_tuple_t *tuple) |
Push a tuple onto the stack. | |
box_tuple_t * | luaT_istuple (struct lua_State *L, int idx) |
Checks whether argument idx is a tuple. | |
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. | |
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. | |
box_latch_t * | box_latch_new (void) |
Allocate and initialize the new latch. | |
void | box_latch_delete (box_latch_t *latch) |
Destroy and free the latch. | |
void | box_latch_lock (box_latch_t *latch) |
Lock a latch. | |
int | box_latch_trylock (box_latch_t *latch) |
Try to lock a latch. | |
void | box_latch_unlock (box_latch_t *latch) |
Unlock a latch. | |
double | clock_realtime (void) |
public | |
double | clock_monotonic (void) |
A nonsettable system-wide clock that represents monotonic time. | |
double | clock_process (void) |
A clock that measures CPU time consumed by this process (by all threads in the process). | |
double | clock_thread (void) |
A clock that measures CPU time consumed by this thread. | |
int64_t | clock_realtime64 (void) |
Same as clock_realtime(), but returns the time as 64 bit signed integer. | |
int64_t | clock_monotonic64 (void) |
Same as clock_monotonic(), but returns the time as 64 bit signed integer. | |
int64_t | clock_process64 (void) |
Same as clock_process(), but returns the time as 64 bit signed integer. | |
int64_t | clock_thread64 (void) |
Same as clock_thread(), but returns the time as 64 bit signed integer. | |
int | box_decimal_precision (const box_decimal_t *dec) |
Decimal precision. | |
int | box_decimal_scale (const box_decimal_t *dec) |
Decimal scale. | |
bool | box_decimal_is_int (const box_decimal_t *dec) |
Whether the fractional part of a decimal number is 0. | |
bool | box_decimal_is_neg (const box_decimal_t *dec) |
Whether a decimal number is negative. | |
box_decimal_t * | box_decimal_zero (box_decimal_t *dec) |
Initialize a zero decimal number. | |
box_decimal_t * | box_decimal_from_string (box_decimal_t *dec, const char *str) |
Initialize a decimal with a value from a string. | |
box_decimal_t * | box_decimal_from_double (box_decimal_t *dec, double d) |
Initialize a decimal from double. | |
box_decimal_t * | box_decimal_from_int64 (box_decimal_t *dec, int64_t num) |
Initialize a decimal with a signed integer value. | |
box_decimal_t * | box_decimal_from_uint64 (box_decimal_t *dec, uint64_t num) |
Initialize a decimal with a unsigned integer value. | |
box_decimal_t * | box_decimal_copy (box_decimal_t *dest, const box_decimal_t *src) |
Copy decimal value from one storage to another. | |
void | box_decimal_to_string (const box_decimal_t *dec, char *buf) |
Write the decimal as a string into the passed buffer. | |
const box_decimal_t * | box_decimal_to_int64 (const box_decimal_t *dec, int64_t *num) |
Convert a given decimal to int64_t. | |
const box_decimal_t * | box_decimal_to_uint64 (const box_decimal_t *dec, uint64_t *num) |
Convert a given decimal to uint64_t. | |
box_decimal_t * | box_decimal_round (box_decimal_t *dec, int scale) |
Round to nearest decimal at given scale, half goes away from zero. | |
box_decimal_t * | box_decimal_floor (box_decimal_t *dec, int scale) |
Apply a floor function to a decimal, i.e. | |
box_decimal_t * | box_decimal_trim (box_decimal_t *dec) |
Remove trailing zeros from the fractional part of a number. | |
box_decimal_t * | box_decimal_rescale (box_decimal_t *dec, int scale) |
Set scale of dec to scale. | |
int | box_decimal_compare (const box_decimal_t *lhs, const box_decimal_t *rhs) |
Compare two decimal values. | |
box_decimal_t * | box_decimal_abs (box_decimal_t *res, const box_decimal_t *dec) |
Get the absolute value of a decimal. | |
box_decimal_t * | box_decimal_minus (box_decimal_t *res, const box_decimal_t *dec) |
Perform unary minus operation. | |
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. | |
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. | |
box_decimal_t * | box_decimal_mul (box_decimal_t *res, const box_decimal_t *lhs, const box_decimal_t *rhs) |
Multiply two decimal numbers. | |
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. | |
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_log10 (box_decimal_t *res, const box_decimal_t *dec) |
Calculate a common logarithm (base 10). | |
box_decimal_t * | box_decimal_ln (box_decimal_t *res, const box_decimal_t *dec) |
Calculate a natural logarithm (base e). | |
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. | |
box_decimal_t * | box_decimal_exp (box_decimal_t *res, const box_decimal_t *dec) |
Calculate exp(dec), i.e. | |
box_decimal_t * | box_decimal_sqrt (box_decimal_t *res, const box_decimal_t *dec) |
Calculate a square root. | |
uint32_t | box_decimal_mp_sizeof (const box_decimal_t *dec) |
Calculate exact buffer size needed to store msgpack representation of a decimal. | |
char * | box_decimal_mp_encode (const box_decimal_t *dec, char *data) |
Encode a decimal as msgpack. | |
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_mp_decode_data (box_decimal_t *dec, const char **data, uint32_t size) |
Decode a decimal from msgpack data without the msgpack extension header. | |
box_decimal_t * | luaT_newdecimal (struct lua_State *L) |
public | |
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. | |
box_decimal_t * | luaT_isdecimal (struct lua_State *L, int index) |
Check whether a value on the Lua stack is a decimal. | |
#define __has_feature | ( | x | ) | 0 |
public
Feature test macros for -std=c11 / -std=c++11
Sic: clang aims to be gcc-compatible and thus defines GNUC
#define alignas | ( | _n | ) |
C11/C++11 keyword.
Appears in the declaration syntax as one of the type specifiers to modify the alignment requirement of the object being declared.
Sic: alignas() doesn't work on anonymous structs on gcc < 4.9
Example:
#define alignof | ( | _T | ) | offsetof(struct { char c; _T member; }, member) |
C11/C++11 operator.
Returns the alignment, in bytes, required for any instance of the type indicated by type-id, which is either complete type, an array type, or a reference type.
#define ALWAYS_INLINE inline |
Adds the 'always_inline' attribute to the function if it's supported.
This attribute forces the function to be inlined if it's possible. If it's not, this results in a diagnostic.
Example:
#define BUILD_INFO "Linux-x86_64-Debug" |
CMake build type signature, e.g.
Linux-x86_64-Debug
#define BUILD_TYPE "Debug" |
Build type, e.g.
Debug or Release
#define CFORMAT | ( | archetype, | |
stringindex, | |||
firsttocheck | |||
) |
The CFORMAT attribute specifies that a function takes printf, scanf, strftime or strfmon style arguments that should be type-checked against a format string.
#define container_of | ( | ptr, | |
type, | |||
member | |||
) |
This macro is used to retrieve an enclosing structure from a pointer to a nested element.
#define DEPRECATED | ( | _msg | ) |
The DEPRECATED attribute can be applied to a function, a variable, or a type.
This is useful when identifying functions, variables, or types that are expected to be removed in a future version of a program.
#define FALLTHROUGH |
Function Attributes }}}.
{{{ Statement Attributes The fallthrough attribute with a null statement serves as a fallthrough statement. It hints to the compiler that a statement that falls through to another case label, or user-defined label in a switch statement is intentional and thus the -Wimplicit-fallthrough warning must not trigger. The fallthrough attribute may appear at most once in each attribute list, and may not be mixed with other attributes. It can only be used in a switch statement (the compiler will issue an error otherwise), after a preceding statement and before a logically succeeding case label, or user-defined label.
#define INSTALL_PREFIX "/usr/local" |
Install prefix (e.g.
/usr)
#define likely | ( | x | ) | (x) |
Compiler-independent built-ins.
{{{ Built-ins You may use likely()/unlikely() to provide the compiler with branch prediction information.
#define MAYBE_UNUSED |
Built-ins }}}.
Compiler-independent function attributes.
{{{ Function Attributes The MAYBE_UNUSED function attribute can be used to silence -Wunused diagnostics when the entity cannot be removed. For instance, a local variable may exist solely for use in an assert() statement, which makes the local variable unused when NDEBUG is defined.
Example:
#define NO_SANITIZE_ADDRESS |
NO_SANITIZE_ADDRESS attribute disables AddressSanitizer for a given function.
The attribute may not be supported by old compilers, but they do not support ASAN as well, so it's safe to define the attribute only if ASAN is enabled.
#define NODISCARD |
A diagnostic is generated when a function is marked with NODISCARD and the function call appears as a potentially-evaluated discarded-value expression that is not explicitly cast to void.
Example:
#define NOINLINE |
#define NORETURN |
A function declared as NORETURN shall not return to its caller.
The compiler will generate a diagnostic for a function declared as NORETURN that appears to be capable of returning to its caller.
Example:
#define PACKAGE_VERSION "3.4.0-entrypoint-224-gf00141723d" |
A string with major-minor-patch-commit-id identifier of the release, e.g.
1.6.6-113-g8399d0e.
#define PACKED |
The PACKED qualifier is useful to map a structure to an external data structure, or for accessing unaligned data, but it is generally not useful to save data size because of the relatively high cost of unaligned access on some architectures.
Example:
#define prefetch | ( | addr, | |
... | |||
) | ((void) addr) |
This macro is used to minimize cache-miss latency by moving data into a cache before it is accessed.
You can insert calls to prefetch() into code for which you know addresses of data in memory that is likely to be accessed soon. If the target supports them, data prefetch instructions will be generated. If the prefetch is done early enough before the access then the data will be in the cache by the time it is accessed.
The value of addr is the address of the memory to prefetch. There are two optional arguments, rw and locality. The value of rw is a compile-time constant one or zero; one means that the prefetch is preparing for a write to the memory address and zero, the default, means that the prefetch is preparing for a read. The value locality must be a compile-time constant integer between zero and three. A value of zero means that the data has no temporal locality, so it need not be left in the cache after the access. A value of three means that the data has a high degree of temporal locality and should be left in all levels of cache possible. Values of one and two mean, respectively, a low or moderate degree of temporal locality. The default is three.
#define say | ( | level, | |
error, | |||
format, | |||
... | |||
) |
Format and print a message to Tarantool log file.
level | (int) - log level (see enum say_level) |
error | (const char * ) - error description, may be NULL |
format | (const char * ) - printf()-like format string |
... | - format arguments |
#define say_crit | ( | format, | |
... | |||
) | say(S_CRIT, NULL, format, ##__VA_ARGS__) |
Format and print a message to Tarantool log file.
format | (const char * ) - printf()-like format string |
... | - format arguments |
#define say_debug | ( | format, | |
... | |||
) | say(S_DEBUG, NULL, format, ##__VA_ARGS__) |
#define say_error | ( | format, | |
... | |||
) | say(S_ERROR, NULL, format, ##__VA_ARGS__) |
#define say_file_line | ( | level, | |
file, | |||
line, | |||
error, | |||
format, | |||
... | |||
) |
Format and print a message to Tarantool log file.
level | (int) - log level (see enum say_level) |
file | (const char * ) - file name to print |
line | (int) - line number to print |
error | (const char * ) - error description, may be NULL |
format | (const char * ) - printf()-like format string |
... | - format arguments |
#define say_info | ( | format, | |
... | |||
) | say(S_INFO, NULL, format, ##__VA_ARGS__) |
#define say_syserror | ( | format, | |
... | |||
) |
Format and print a message to Tarantool log file.
format | (const char * ) - printf()-like format string |
... | - format arguments |
#define say_verbose | ( | format, | |
... | |||
) | say(S_VERBOSE, NULL, format, ##__VA_ARGS__) |
#define say_warn | ( | format, | |
... | |||
) | say(S_WARN, NULL, format, ##__VA_ARGS__) |
#define SYSCONF_DIR "etc" |
public
System configuration dir (e.g /etc)
#define SYSTEM_SPACES | ( | _ | ) |
public
List of system space definitions in the following format: (name, identifier, is_sync), where is_sync determines whether synchronous replication is enabled for this system space when the synchronous queue is claimed. If is_sync is false, a reason must be supplied after the space definition comment.
#define TZDATA_VERSION "2022a" |
A string with tag identifier of the tzdata release, e.g.
2024a.
#define unlikely | ( | x | ) | (x) |
You may use likely()/unlikely() to provide the compiler with branch prediction information.
#define unreachable | ( | ) | (assert(0)) |
If control flow reaches the point of the unreachable(), the program is undefined.
It is useful in situations where the compiler cannot deduce the unreachability of the code.
typedef struct box_decimal box_decimal_t |
Storage for a decimal number.
This type is large enough to hold a decimal value. The primary usage is to allocate a decimal on the stack and pass it to a box_decimal_*() function.
Take it as opacue structure with ability to allocate a value on the stack.
Use box_decimal_copy() to copy the value, don't use memcpy(). The real data can be smaller than this type. Moreover, tarantool may allocate less bytes for box_decimal_t value, so direct read/write of the structure may lead to access to an unallocated memory.
The alignment of the structure is not less than alignment of decimal values allocated by tarantool. It can be larger and it is another reason to don't access the structure content directly.
Last, but not least: the data format is unspecified and can be changed. Modules and applications that aims to be compatible with future tarantool versions must not lean on particular data representation within the structure.
typedef union PACKED box_key_part_def_t |
Public representation of a key part definition.
Usage: Allocate an array of such key parts, initialize each key part (call box_key_part_def_create() and set necessary fields), pass the array into box_key_def_new_v2() function.
Important: A module should call box_key_part_def_create() to initialize the structure with default values. There is no guarantee that all future default values for fields and flags will be remain the same.
The idea of separation from internal "struct key_part_def" is to provide stable API and ABI for modules.
New fields may be added into the end of the structure in later tarantool versions. Also new flags may be introduced within flags field. collation cannot be changed to a union (to reuse for some other value), because it is verified even for a non-string key part by box_key_def_new_v2().
Fields that are unknown at given tarantool version are ignored in general, but filled with zeros when initialized.
typedef struct box_latch box_latch_t |
public
A lock for cooperative multitasking environment
typedef void(* iproto_handler_destroy_t) (void *ctx) |
IPROTO request handler destructor called when the corresponding handler is removed.
ctx | context provided by box_iproto_override() |
typedef 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_iproto_override(), and must return one of the status codes from iproto_handler_status.
header | Msgpack encoded header |
header_end | end of Msgpack encoded header |
body | Msgpack encoded body |
body_end | end of Msgpack encoded body |
ctx | context provided by box_iproto_override() |
anonymous enum |
It is recommended to verify size of box_key_part_def_t against this constant on the module side at build time.
Example:
This snippet is not part of module.h, because portability of static_assert() / _Static_assert() is dubious. It should be decision of a module author how portable its code should be.
Enumerator | |
---|---|
BOX_KEY_PART_DEF_T_SIZE | The constant. |
anonymous enum |
enum box_slab_info_type |
Codes for request memtx status information for box.slab.info.
Return codes for IPROTO request handlers.
Enumerator | |
---|---|
IPROTO_HANDLER_OK | Success, no further actions needed. |
IPROTO_HANDLER_ERROR | Error, diagnostic must be set by handler via box_error_set(). |
IPROTO_HANDLER_FALLBACK | Fallback to system handler. |
enum iterator_type |
public
Controls how to iterate over tuples in an index. Different index types support different iterator types. For example, one can start iteration from a particular value (request key) and then retrieve all tuples where keys are greater or equal (= GE) to this key.
If iterator type is not supported by the selected index type, iterator constructor must fail with ER_UNSUPPORTED. To be selectable for primary key, an index must support at least ITER_EQ and ITER_GE types.
NULL value of request key corresponds to the first or last key in the index, depending on iteration direction. (first key for GE and GT types, and last key for LE and LT). Therefore, to iterate over all tuples in an index, one can use ITER_GE or ITER_LE iteration types with start key equal to NULL. For ITER_EQ, the key must not be NULL.
enum say_level |
public
Log levels
enum txn_isolation_level |
public
When a transaction calls commit
, this action can last for some time until redo data is written to WAL. While such a commit
call is in progress we call changes of such a transaction as 'committed', and when the process is finished - we call the changes as 'confirmed'. One of the main options of a transaction is to see or not to see 'committed' changes. Note that now there are different terminologies in different places. This enum uses new 'committed' and 'confirmed' states of transactions. Meanwhile in engined the first state is usually called as 'prepared', and the second as 'committed' or 'completed'. Warning: this enum is exposed in lua via ffi, and thus any change in items must be correspondingly modified on ffi.cdef(), see schema.lua.
const char * _say_strerror | ( | int | errnum | ) |
Internal function that implements MT-Safe strerror().
It is used by say_syserror() macro.
box_decimal_t * box_decimal_abs | ( | box_decimal_t * | res, |
const box_decimal_t * | dec | ||
) |
Get the absolute value of a decimal.
res is set to the absolute value of dec.
box_decimal_abs(&a, &a) is allowed.
res | where to store the result |
dec | decimal operand |
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.
res | where to hold the result |
lhs | left hand side operand |
rhs | right hand side operand |
int box_decimal_compare | ( | const box_decimal_t * | lhs, |
const box_decimal_t * | rhs | ||
) |
Compare two decimal values.
lhs | left hand side operand |
rhs | right hand side operand |
box_decimal_t * box_decimal_copy | ( | box_decimal_t * | dest, |
const box_decimal_t * | src | ||
) |
Copy decimal value from one storage to another.
Use this function where you would use memcpy() if the precise data size would be known.
The memory areas must not overlap.
dest | where to store the copy |
src | from where to copy |
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.
res | where to hold the result |
lhs | left hand side operand |
rhs | right hand side operand |
box_decimal_t * box_decimal_exp | ( | box_decimal_t * | res, |
const box_decimal_t * | dec | ||
) |
Calculate exp(dec), i.e.
pow(e, dec).
res | where to hold the result |
dec | decimal operand |
box_decimal_t * box_decimal_floor | ( | box_decimal_t * | dec, |
int | scale | ||
) |
Apply a floor function to a decimal, i.e.
round it towards zero to a decimal with given scale.
floor(-0.66, 1) -> -0.6 floor(-0.65, 1) -> -0.6 floor(-0.64, 1) -> -0.6
floor(0.64, 1) -> 0.6 floor(0.65, 1) -> 0.6 floor(0.66, 1) -> 0.6
dec | decimal number |
scale | target scale |
box_decimal_t * box_decimal_from_double | ( | box_decimal_t * | dec, |
double | d | ||
) |
Initialize a decimal from double.
dec | where to store the decimal result |
d | source double value |
box_decimal_t * box_decimal_from_int64 | ( | box_decimal_t * | dec, |
int64_t | num | ||
) |
Initialize a decimal with a signed integer value.
dec | where to store the decimal result |
num | source integer value (signed) |
box_decimal_t * box_decimal_from_string | ( | box_decimal_t * | dec, |
const char * | str | ||
) |
Initialize a decimal with a value from a string.
The fractional part may be rounded if a maximum precision is reached.
dec | where to store the decimal result |
str | source string value |
box_decimal_t * box_decimal_from_uint64 | ( | box_decimal_t * | dec, |
uint64_t | num | ||
) |
Initialize a decimal with a unsigned integer value.
dec | where to store the decimal result |
num | source integer value (unsigned) |
bool box_decimal_is_int | ( | const box_decimal_t * | dec | ) |
Whether the fractional part of a decimal number is 0.
dec | decimal number |
bool box_decimal_is_neg | ( | const box_decimal_t * | dec | ) |
Whether a decimal number is negative.
dec | decimal number |
box_decimal_t * box_decimal_ln | ( | box_decimal_t * | res, |
const box_decimal_t * | dec | ||
) |
Calculate a natural logarithm (base e).
res | where to hold the result |
dec | decimal operand |
box_decimal_t * box_decimal_log10 | ( | box_decimal_t * | res, |
const box_decimal_t * | dec | ||
) |
Calculate a common logarithm (base 10).
res | where to hold the result |
dec | decimal operand |
box_decimal_t * box_decimal_minus | ( | box_decimal_t * | res, |
const box_decimal_t * | dec | ||
) |
Perform unary minus operation.
res is set to -dec.
res | where to store the result |
dec | decimal operand |
box_decimal_t * box_decimal_mp_decode | ( | box_decimal_t * | dec, |
const char ** | data | ||
) |
Decode a decimal from msgpack data.
dec | where to store the decoded decimal |
data | pointer to a buffer with the msgpack data |
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.
This function is suitable to finish decoding after calling mp_decode_extl() (from the msgpuck library).
dec | where to store the decoded decimal |
data | pointer to a buffer with the msgpack data |
size | size of the decimal data in the buffer; this value is returned by mp_decode_extl() |
char * box_decimal_mp_encode | ( | const box_decimal_t * | dec, |
char * | data | ||
) |
Encode a decimal as msgpack.
dec | decimal number to encode |
data | buffer to write the result |
uint32_t box_decimal_mp_sizeof | ( | const box_decimal_t * | dec | ) |
Calculate exact buffer size needed to store msgpack representation of a decimal.
dec | decimal operand |
box_decimal_t * box_decimal_mul | ( | box_decimal_t * | res, |
const box_decimal_t * | lhs, | ||
const box_decimal_t * | rhs | ||
) |
Multiply two decimal numbers.
res | where to hold the result |
lhs | left hand side operand |
rhs | right hand side operand |
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.
res | where to hold the result |
lhs | left hand side operand, base |
rhs | right hand side operand, power |
int box_decimal_precision | ( | const box_decimal_t * | dec | ) |
Decimal precision.
It is equivalent to amount of decimal digits in the string representation (not counting minus, decimal separator and the leading zero in 0.ddd...ddd number, but counting trailing zeros if any).
dec | decimal number |
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.
res is set to the remainder of dividing lhs by rhs.
res | where to hold the result |
lhs | left hand side operand |
rhs | right hand side operand |
box_decimal_t * box_decimal_rescale | ( | box_decimal_t * | dec, |
int | scale | ||
) |
Set scale of dec to scale.
If scale is less than scale(dec), round the decimal. Otherwise append a sufficient amount of trailing fractional zeros.
dec | decimal number |
scale | target scale |
box_decimal_t * box_decimal_round | ( | box_decimal_t * | dec, |
int | scale | ||
) |
Round to nearest decimal at given scale, half goes away from zero.
round(-0.66, 1) -> -0.7 round(-0.65, 1) -> -0.7 round(-0.64, 1) -> -0.6
round(0.64, 1) -> 0.6 round(0.65, 1) -> 0.7 round(0.66, 1) -> 0.7
Resulting decimal number has not more than scale digits after the decimal point.
If scale if greater than current dec scale, do nothing.
dec | decimal number |
scale | target scale |
int box_decimal_scale | ( | const box_decimal_t * | dec | ) |
Decimal scale.
It is equivalent to amount of digits after the decimal separator.
dec | decimal number |
box_decimal_t * box_decimal_sqrt | ( | box_decimal_t * | res, |
const box_decimal_t * | dec | ||
) |
Calculate a square root.
res | where to hold the result |
dec | decimal operand |
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.
res | where to hold the result |
lhs | left hand side operand |
rhs | right hand side operand |
const box_decimal_t * box_decimal_to_int64 | ( | const box_decimal_t * | dec, |
int64_t * | num | ||
) |
Convert a given decimal to int64_t.
dec | source decimal number |
num | where to store dec integer representation |
void box_decimal_to_string | ( | const box_decimal_t * | dec, |
char * | buf | ||
) |
Write the decimal as a string into the passed buffer.
The buffer must have at least BOX_DECIMAL_STRING_BUFFER_SIZE bytes.
dec | source decimal number |
buf | where to write dec string representation |
const box_decimal_t * box_decimal_to_uint64 | ( | const box_decimal_t * | dec, |
uint64_t * | num | ||
) |
Convert a given decimal to uint64_t.
dec | source decimal number |
num | where to store dec integer representation |
box_decimal_t * box_decimal_trim | ( | box_decimal_t * | dec | ) |
Remove trailing zeros from the fractional part of a number.
dec | decimal number |
box_decimal_t * box_decimal_zero | ( | box_decimal_t * | dec | ) |
Initialize a zero decimal number.
dec | where to store the decimal result |
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.
space_id | space identifier | |
index_id | index identifier | |
key | encoded key in MsgPack Array format ([part1, part2, ...]). | |
key_end | the end of encoded key. | |
[out] | result | an old tuple. Can be set to NULL to discard result. |
-1 | on error (check box_error_last()) |
0 | on success |
uint32_t box_error_code | ( | const box_error_t * | error | ) |
Return IPROTO error code.
error | error |
box_error_t * box_error_last | ( | void | ) |
Get the information about the last API call error.
The Tarantool error handling works most like libc's errno. All API calls return -1 or NULL in the event of error. An internal pointer to box_error_t type is set by API functions to indicate what went wrong. This value is only significant if API call failed (returned -1 or NULL).
Successful function can also touch the last error in some cases. You don't have to clear the last error before calling API functions. The returned object is valid only until next call to any API function.
You must set the last error using box_error_set() in your stored C procedures if you want to return a custom error message. You can re-throw the last API error to IPROTO client by keeping the current value and returning -1 to Tarantool from your stored procedure.
const char * box_error_message | ( | const box_error_t * | error | ) |
Return the error message.
error | error |
int box_error_set | ( | const char * | file, |
unsigned | line, | ||
uint32_t | code, | ||
const char * | format, | ||
... | |||
) |
Set the last error.
file | file name, usually FILE macro |
line | line number in the file, usually LINE macro |
code | IPROTO error code (enum box_error_code) |
format | (const char * ) - printf()-like format string |
... | - format arguments |
const char * box_error_type | ( | const box_error_t * | error | ) |
Return the error type, e.g.
"ClientError", "SocketError", etc.
error |
void box_ibuf_read_range | ( | box_ibuf_t * | ibuf, |
char *** | rpos, | ||
char *** | wpos | ||
) |
Return pointers to read range pointers used [rpos..wpos)
ibuf | ibuf structure |
rpos | where to place ibuf.rpos address |
wpos | where to place ibuf.wpos address |
void * box_ibuf_reserve | ( | box_ibuf_t * | ibuf, |
size_t | size | ||
) |
Reserve requested amount of bytes in ibuf buffer.
ibuf | buffer used for allocation |
size | allocated bytes |
NULL | on error, check diag. |
void box_ibuf_write_range | ( | box_ibuf_t * | ibuf, |
char *** | wpos, | ||
char *** | end | ||
) |
Return pointers to write range pointers used [wpos..end)
ibuf | ibuf structure |
wpos | where to place ibuf.rpos address |
end | where to place ibuf.wpos address |
ssize_t box_index_bsize | ( | uint32_t | space_id, |
uint32_t | index_id | ||
) |
Return the number of bytes used in memory by the index.
space_id | space identifier |
index_id | index identifier |
-1 | on error (check box_error_last()) |
>= | 0 otherwise |
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.
space_id | space identifier |
index_id | index identifier |
type | iterator type - enum iterator_type |
key | encoded key in MsgPack Array format ([part1, part2, ...]). |
key_end | the end of encoded key. |
-1 | on error (check box_error_last()) |
>=0 | on success |
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.
Please note that this function works much more faster than box_select() or box_index_iterator() + box_iterator_next().
space_id | space identifier | |
index_id | index identifier | |
key | encoded key in MsgPack Array format ([part1, part2, ...]). | |
key_end | the end of encoded key | |
[out] | result | a tuple or NULL if index is empty |
-1 | on error (check box_error_last()) |
0 | on success |
uint32_t box_index_id_by_name | ( | uint32_t | space_id, |
const char * | name, | ||
uint32_t | len | ||
) |
Find index id by name.
This function performs SELECT request to _vindex system space.
space_id | space identifier |
name | index name |
len | length of name |
BOX_ID_NIL | on error or if not found (check box_error_last()) |
index_id | otherwise |
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.
A returned iterator must be destroyed by box_iterator_free().
space_id | space identifier. |
index_id | index identifier. |
type | iterator type |
key | encoded key in MsgPack Array format ([part1, part2, ...]). |
key_end | the end of encoded key |
NULL | on error (check box_error_last()) |
iterator | otherwise |
ssize_t box_index_len | ( | uint32_t | space_id, |
uint32_t | index_id | ||
) |
Return the number of element in the index.
space_id | space identifier |
index_id | index identifier |
-1 | on error (check box_error_last()) |
>= | 0 otherwise |
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.
space_id | space identifier | |
index_id | index identifier | |
key | encoded key in MsgPack Array format ([part1, part2, ...]). | |
key_end | the end of encoded key. | |
[out] | result | a tuple or NULL if index is empty |
-1 | on error (check box_error_last()) |
0 | on success |
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.
space_id | space identifier | |
index_id | index identifier | |
key | encoded key in MsgPack Array format ([part1, part2, ...]). | |
key_end | the end of encoded key. | |
[out] | result | a tuple or NULL if index is empty |
-1 | on error (check box_error_last()) |
0 | on success |
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.
space_id | space identifier | |
index_id | index identifier | |
level | quantile level | |
begin_key | beginning key of the target range | |
begin_key_end | end of begin_key | |
end_key | end key of the target range | |
end_key_end | end of end_key | |
[out] | quantile_key | quantile point or NULL if the range is too small |
[out] | quantile_key_end | end of quantile_key |
-1 | on error (check box_error_last()) |
0 | on success |
The quantile point is such a key that the ratio of tuples less than the key in the target range approximately equals the given level.
begin_key and end_key must be encoded in the MsgPack Array format. The target range is defined as the intersection of GE begin_key and LT end_key read queries.
The quantile point is returned in the MsgPack Array format. It is allocated on the box region so the caller should use box_region_truncate() to clean up the region after calling this function.
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).
space_id | space identifier | |
index_id | index identifier | |
rnd | random seed | |
[out] | result | a tuple or NULL if index is empty |
-1 | on error (check box_error_last()) |
0 | on success |
int box_insert | ( | uint32_t | space_id, |
const char * | tuple, | ||
const char * | tuple_end, | ||
box_tuple_t ** | result | ||
) |
Execute an INSERT request.
space_id | space identifier | |
tuple | encoded tuple in MsgPack Array format ([ field1, field2, ...]) | |
tuple_end | end of tuple | |
[out] | result | a new tuple. Can be set to NULL to discard result. |
-1 | on error (check box_error_last()) |
0 | on success |
int box_insert_arrow | ( | uint32_t | space_id, |
struct ArrowArray * | array, | ||
struct ArrowSchema * | schema | ||
) |
Executes a batch insert request.
A record batch from the Arrow array
is inserted into the space columns, whose names are provided by the Arrow schema
. Column types in the schema must match the types of the corresponding fields in the space format.
If a column is nullable in space format, it can be omitted. All non-nullable columns (including primary key parts) must be present in the batch.
This function does not release neither array
nor schema
.
space_id | space identifier |
array | input data in ArrowArray format |
schema | definition of the input data in ArrowSchema format |
0 | on success |
-1 | on error (check box_error_last()) |
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.
NB: yields.
req_type | request type code from iproto_type enumeration (src/box/iproto_constants.h); use IPROTO_UNKNOWN for overriding the handler of unknown request types; |
handler | IPROTO request handler; passing NULL resets the corresponding handler |
destroy | IPROTO request handler destructor |
ctx | context passed to handler |
-1 | on error (check box_error_last()) |
0 | on success |
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.
NB: yields.
sid | IPROTO session identifier |
header | MsgPack encoded header |
header_end | MsgPack encoded header end |
body | MsgPack encoded body |
body_end | MsgPack encoded body end |
-1 | on error (check box_error_last()) |
0 | on success |
void box_iterator_free | ( | box_iterator_t * | iterator | ) |
Destroy and deallocate iterator.
iterator | an iterator returned by box_index_iterator() |
int box_iterator_next | ( | box_iterator_t * | iterator, |
box_tuple_t ** | result | ||
) |
Retrieve the next item from the iterator.
iterator | an iterator returned by box_index_iterator(). | |
[out] | result | a tuple or NULL if there is no more data. |
-1 | on error (check box_error_last() for details) |
0 | on success. The end of data is not an error. |
void box_key_def_delete | ( | box_key_def_t * | key_def | ) |
Delete key definition.
key_def | key definition to delete |
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.
The function allocates key parts and storage for pointer fields (e.g. collation names) on the box region.
box_key_part_def_t fields that are unknown at given tarantool version are set to zero. The same for unknown flags bits.
In case of an error set a diag and return NULL.
box_key_def_t * box_key_def_dup | ( | const box_key_def_t * | key_def | ) |
Duplicate key_def.
key_def | Original key_def. |
not | NULL Duplicate of src. |
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 this key.
This function has O(n) complexity, where n is the number of key parts.
key_def | Definition of key that need to extract. |
tuple | Tuple from which need to extract key. |
multikey_idx | Multikey index hint or -1. |
key_size_ptr | Here will be size of extracted key. |
not | NULL Success. |
NULL | Memory allocation error. |
In case of an error set a diag and return NULL.
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.
Parts of the new key_def consist of the first key_def's parts and those parts of the second key_def that were not among the first parts.
not | NULL Ok. |
NULL | Memory error. |
In case of an error set a diag and return NULL.
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.
May be used for tuple format creation and/or tuple comparison.
fields | array with key field identifiers |
types | array with key field types (see enum field_type) |
part_count | the number of key fields |
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.
Unlike box_key_def_new() this function allows to define nullability, collation and other options for each key part.
box_key_part_def_t fields that are unknown at given tarantool version are ignored. The same for unknown flags bits.
In case of an error set a diag and return NULL.
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.
Verifies key parts against given key_def's field types with respect to nullability.
Imposes the same parts count in key as in key_def. Absence of trailing key parts fails the check.
Note: nil is accepted for nullable fields, but only for them.
key_def | Key definition. |
key | MessagePack'ed data for matching. |
key_size_ptr | Here will be size of the validated key. |
0 | The key is valid. |
-1 | The key is invalid. |
In case of an invalid key set a diag and return -1.
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.
Verifies key parts against given key_def's field types with respect to nullability.
A partial key (with less part than defined in key_def) is verified by given key parts, the omitted tail is not verified anyhow.
Note: nil is accepted for nullable fields, but only for them.
key_def | Key definition. |
key | MessagePack'ed data for matching. |
key_size_ptr | Here will be size of the validated key. |
0 | The key is valid. |
-1 | The key is invalid. |
In case of an invalid key set a diag and return -1.
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.
key_def | Key definition. |
tuple | Tuple to validate. |
0 | The tuple is valid. |
-1 | The tuple is invalid. |
In case of an invalid tuple set a diag and return -1.
void box_key_part_def_create | ( | box_key_part_def_t * | part | ) |
Initialize a key part with default values.
Field | Default value | Details |
---|---|---|
fieldno | 0 | |
flags | default flags | |
field_type | NULL | [^1] |
collation | NULL | |
path | NULL |
Default flag values are the following:
Flag | Default value |
---|---|
BOX_KEY_PART_DEF_IS_NULLABLE | 0 (unset) |
BOX_KEY_PART_DEF_EXCLUDE_NULL | 0 (unset) |
BOX_KEY_PART_DEF_SORT_ORDER_DESC | 0 (unset) |
Default values of fields and flags are permitted to be changed in future tarantool versions. However we should be VERY conservative here and consider any meaningful usage scenarios, when doing so. At least new defaults should be consistent with how tarantool itself doing key_def related operations: validation, key extraction, comparisons and so on.
All trailing padding bytes are set to zero. The same for unknown flags bits.
[^1]: box_key_def_new_v2() does not accept NULL as a field_type, so it should be filled explicitly.
void box_latch_delete | ( | box_latch_t * | latch | ) |
Destroy and free the latch.
latch | latch |
void box_latch_lock | ( | box_latch_t * | latch | ) |
Lock a latch.
Waits indefinitely until the current fiber can gain access to the latch. Locks are acquired in the strict order as they were requested.
latch | a latch |
box_latch_t * box_latch_new | ( | void | ) |
Allocate and initialize the new latch.
int box_latch_trylock | ( | box_latch_t * | latch | ) |
Try to lock a latch.
Return immediately if the latch is locked.
latch | a latch |
0 | - success |
1 | - the latch is locked. |
void box_latch_unlock | ( | box_latch_t * | latch | ) |
Unlock a latch.
The fiber calling this function must own the latch.
latch | a latch |
int box_on_shutdown | ( | void * | arg, |
int(*)(void *) | new_handler, | ||
int(*)(void *) | old_handler | ||
) |
Statement Attributes }}}.
public Function, which registers or deletes on_shutdown handler.
[in] | arg | on_shutdown function's argument. |
[in] | new_handler | New on_shutdown handler, in case this argument is NULL, function finds and destroys old on_shutdown handler. |
[in] | old_handler | Old on_shutdown handler. |
return | 0 if success otherwise return -1 and sets errno. There are three cases when function fails:
|
void * box_region_aligned_alloc | ( | size_t | size, |
size_t | alignment | ||
) |
Allocate size bytes from the box region with given alignment.
Alignment must be a power of 2.
In case of a memory error set a diag and return NULL.
void * box_region_alloc | ( | size_t | size | ) |
Allocate size bytes from the box region.
Don't use this function to allocate a memory block for a value or array of values of a type with alignment requirements. A violation of alignment requirements leads to undefined behaviour.
In case of a memory error set a diag and return NULL.
size_t box_region_used | ( | void | ) |
box region allocator
It is the region allocator from the small library. It is useful for allocating tons of small objects and free them at once.
Typical usage is illustrated in the sketch below.
There are module API functions that return a result on this region. In this case a caller is responsible to free the result:
This API provides better compatibility guarantees over using the small library directly in a module. A binary layout of internal structures may be changed in a future, but <box_region_*>() functions will remain API and ABI compatible.
Each fiber has its own box region. It means that a call of, say, box_region_used() will give its own value in different fibers. It also means that a yield does not invalidate data in the box region.
Prior to version 2.11, the box region was implicitly cleaned up on transaction commit (see box_txn_commit()) so that box_region_truncate() wasn't strictly necessary. Starting from version 2.11, it isn't true anymore, and the client code must free all its allocations explicitly. How much memory is used by the box region.
int box_replace | ( | uint32_t | space_id, |
const char * | tuple, | ||
const char * | tuple_end, | ||
box_tuple_t ** | result | ||
) |
Execute an REPLACE request.
space_id | space identifier | |
tuple | encoded tuple in MsgPack Array format ([ field1, field2, ...]) | |
tuple_end | end of tuple | |
[out] | result | a new tuple. Can be set to NULL to discard result. |
-1 | on error (check box_error_last()) |
0 | on success |
int box_return_mp | ( | box_function_ctx_t * | ctx, |
const char * | mp, | ||
const char * | mp_end | ||
) |
Return MessagePack from a stored C procedure.
The MessagePack is copied, so it is safe to free/reuse the passed arguments after the call. MessagePack is not validated, for the sake of speed. It is expected to be a single encoded object. An attempt to encode and return multiple objects without wrapping them into an MP_ARRAY or MP_MAP is undefined behaviour.
ctx | An opaque structure passed to the stored C procedure by Tarantool. |
mp | Begin of MessagePack. |
mp_end | End of MessagePack. |
-1 | Error. |
0 | Success. |
int box_return_tuple | ( | box_function_ctx_t * | ctx, |
box_tuple_t * | tuple | ||
) |
Return a tuple from stored C procedure.
Returned tuple is automatically reference counted by Tarantool.
ctx | an opaque structure passed to the stored C procedure by Tarantool |
tuple | a tuple to return |
-1 | on error (perhaps, out of memory; check box_error_last()) |
0 | otherwise |
const char * box_ro_reason | ( | void | ) |
public
Get the reason why the instance is read only if it is. Can't be called on a writable instance.
uint64_t box_schema_version | ( | void | ) |
public
Returns the current version of the database schema, an unsigned number that goes up when there is a major change in the schema, i.e., on DDL operations.
int box_sequence_current | ( | uint32_t | seq_id, |
int64_t * | result | ||
) |
Get the last value returned by a sequence.
seq_id | sequence identifier | |
[out] | result | pointer to a variable where the current sequence value will be stored on success |
-1 | on error (check box_error_last()) |
0 | on success |
int box_sequence_next | ( | uint32_t | seq_id, |
int64_t * | result | ||
) |
Advance a sequence.
seq_id | sequence identifier | |
[out] | result | pointer to a variable where the next sequence value will be stored on success |
-1 | on error (check box_error_last()) |
0 | on success |
int box_sequence_reset | ( | uint32_t | seq_id | ) |
Reset a sequence.
seq_id | sequence identifier |
-1 | on error (check box_error_last()) |
0 | on success |
int box_sequence_set | ( | uint32_t | seq_id, |
int64_t | value | ||
) |
Set a sequence value.
seq_id | sequence identifier |
value | new sequence value; on success the next call to box_sequence_next() will return the value following value |
-1 | on error (check box_error_last()) |
0 | on success |
uint64_t box_session_id | ( | void | ) |
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.
Note, that successful push does not guarantee delivery in case it was sent into the network. Just like with write()/send() system calls.
data | begin of MessagePack to push |
data_end | end of MessagePack to push |
-1 | on error (check box_error_last()) |
0 | on success |
uint32_t box_space_id_by_name | ( | const char * | name, |
uint32_t | len | ||
) |
Find space id by name.
This function performs SELECT request to _vspace system space.
name | space name |
len | length of name |
BOX_ID_NIL | on error or if not found (check box_error_last()) |
space_id | otherwise |
int box_truncate | ( | uint32_t | space_id | ) |
Truncate space.
space_id | space identifier |
size_t box_tuple_bsize | ( | box_tuple_t * | tuple | ) |
Return the number of bytes used to store internal tuple data (MsgPack Array).
tuple | a tuple |
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.
tuple_a | first tuple |
tuple_b | second tuple |
key_def | key definition |
0 | if key_fields(tuple_a) == key_fields(tuple_b) |
<0 | if key_fields(tuple_a) < key_fields(tuple_b) |
>0 | if key_fields(tuple_a) > key_fields(tuple_b) |
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.
tuple_a | tuple |
key_b | key with MessagePack array header |
key_def | key definition |
0 | if key_fields(tuple) == parts(key) |
<0 | if key_fields(tuple) < parts(key) |
>0 | if key_fields(tuple) > parts(key) |
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.
Returned buffer is allocated on box_txn_alloc() with this key.
tuple | Tuple from which need to extract key. | |
space_id | Space identifier. | |
index_id | Index identifier. | |
[out] | key_size | where to store the size of the extracted key; pass NULL here if it is not needed |
not | NULL Success |
NULL | Memory Allocation error |
const char * box_tuple_field | ( | box_tuple_t * | tuple, |
uint32_t | fieldno | ||
) |
Return the raw tuple field in MsgPack format.
The buffer is valid until next call to box_tuple_* functions.
tuple | a tuple |
fieldno | zero-based index in MsgPack array. |
NULL | if i >= box_tuple_field_count(tuple) |
msgpack | otherwise |
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.
The JSON path includes the outmost field. For example, "c" in ["a", ["b", "c"], "d"] can be accessed using "[2][2]" path (if index_base is 1, as in Lua). If index_base is set to 0, the same field will be pointed by the "[1][1]" path.
The first JSON path token may be a field name if the tuple has associated format with named fields. A field of a nested map can be accessed in the same way: "foo.bar" or ".foo.bar".
The return value is valid until the tuple is destroyed, see box_tuple_ref().
Return NULL if the field does not exist or if the JSON path is malformed or invalid. Multikey JSON path token [*] is treated as invalid in this context.
tuple | a tuple |
path | a JSON path |
path_len | a length of path |
index_base | 0 if array element indexes in path are zero-based (like in C) or 1 if they're one-based (like in Lua) |
a | pointer to a field data if the field exists or NULL |
uint32_t box_tuple_field_count | ( | box_tuple_t * | tuple | ) |
Return the number of fields in tuple (the size of MsgPack Array).
tuple | a tuple |
box_tuple_format_t * box_tuple_format | ( | box_tuple_t * | tuple | ) |
Return the associated format.
tuple | tuple |
box_tuple_format_t * box_tuple_format_default | ( | void | ) |
Tuple Format.
Each Tuple has associated format (class). Default format is used to create tuples which are not attach to any particular space.
box_tuple_format_t * box_tuple_format_new | ( | struct key_def ** | keys, |
uint16_t | key_count | ||
) |
public
Return new in-memory tuple format based on passed key definitions.
keys | array of keys defined for the format |
key_count | count of keys |
new | tuple format if success |
NULL | for error |
void box_tuple_format_ref | ( | box_tuple_format_t * | format | ) |
Increment tuple format ref count.
format | the tuple format to ref |
void box_tuple_format_unref | ( | box_tuple_format_t * | format | ) |
Decrement tuple format ref count.
format | the tuple format to unref |
box_tuple_iterator_t * box_tuple_iterator | ( | box_tuple_t * | tuple | ) |
Allocate and initialize a new tuple iterator.
The tuple iterator allow to iterate over fields at root level of MsgPack array.
Example:
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.
format | tuple format. Use box_tuple_format_default() to create space-independent tuple. |
data | tuple data in MsgPack Array format ([field1, field2, ...]). |
end | the end of data |
tuple |
const char * box_tuple_next | ( | box_tuple_iterator_t * | it | ) |
Return the next tuple field from tuple iterator.
The returned buffer is valid until next call to box_tuple_* API.
it | tuple iterator. |
NULL | if there are no more fields. |
MsgPack | otherwise |
uint32_t box_tuple_position | ( | box_tuple_iterator_t * | it | ) |
Return zero-based next position in iterator.
That is, this function return the field id of field that will be returned by the next call to box_tuple_next(). Returned value is zero after initialization or rewind and box_tuple_field_count() after the end of iteration.
it | tuple iterator |
int box_tuple_ref | ( | box_tuple_t * | tuple | ) |
Increase the reference counter of tuple.
Tuples are reference counted. All functions that return tuples guarantee that the last returned tuple is refcounted internally until the next call to API function that yields or returns another tuple.
You should increase the reference counter before taking tuples for long processing in your code. Such tuples will not be garbage collected even if another fiber remove they from space. After processing please decrement the reference counter using box_tuple_unref(), otherwise the tuple will leak.
tuple | a tuple |
0 | always |
void box_tuple_rewind | ( | box_tuple_iterator_t * | it | ) |
Rewind iterator to the initial position.
it | tuple iterator |
const char * box_tuple_seek | ( | box_tuple_iterator_t * | it, |
uint32_t | fieldno | ||
) |
Seek the tuple iterator.
The returned buffer is valid until next call to box_tuple_* API. Requested fieldno returned by next call to box_tuple_next().
it | tuple iterator |
fieldno | - zero-based position in MsgPack array. |
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.
Store tuple fields in the memory buffer.
-1 | on error. |
number | of bytes written on success. Upon successful return, the function returns the number of bytes written. If buffer size is not enough then the return value is the number of bytes which would have been written if enough space had been available. |
void box_tuple_unref | ( | box_tuple_t * | tuple | ) |
box_tuple_t * box_tuple_update | ( | box_tuple_t * | tuple, |
const char * | expr, | ||
const char * | expr_end | ||
) |
Update a tuple.
Function returns a copy of tuple with updated fields. Pay attention that original tuple is left without changes.
tuple | Tuple to update. |
expr | MessagePack array of operations. |
expr_end | End of the expr. |
NULL | The tuple was not updated. |
box_tuple_t | A copy of original tuple with updated fields. |
box_tuple_t * box_tuple_upsert | ( | box_tuple_t * | tuple, |
const char * | expr, | ||
const char * | expr_end | ||
) |
Update a tuple.
The same as box_tuple_update(), but ignores errors. In case of an error the tuple is left intact, but an error message is printed. Only client errors are ignored, such as a bad field type, or wrong field index/name. System errors, such as OOM, are not ignored and raised just like with a normal box_tuple_update(). Note that only bad operations are ignored. All correct operations are applied.
Despite the function name (upsert, update and insert), the function does not insert any tuple.
tuple | Tuple to update. |
expr | MessagePack array of operations. |
expr_end | End of the expr. |
NULL | The tuple was not updated. |
box_tuple_t | A copy of original tuple with updated fields. |
int box_tuple_validate | ( | box_tuple_t * | tuple, |
box_tuple_format_t * | format | ||
) |
Check tuple data correspondence to the space format.
tuple | Tuple to validate. |
format | Format to which the tuple must match. |
0 | The tuple is valid. |
-1 | The tuple is invalid. |
void * box_txn_alloc | ( | size_t | size | ) |
Allocate memory on txn memory pool.
The memory is automatically deallocated when the transaction is committed or rolled back.
NULL | out of memory |
int box_txn_begin | ( | void | ) |
Begin a transaction in the current fiber.
A transaction is attached to caller fiber, therefore one fiber can have only one active transaction.
0 | - success |
-1 | - failed, perhaps a transaction has already been started |
int box_txn_commit | ( | void | ) |
Commit the current transaction.
0 | - success |
-1 | - failed, perhaps a disk write failure. started |
int64_t box_txn_id | ( | void | ) |
public
Transaction id - a non-persistent unique identifier of the current transaction. -1 if there is no current transaction.
int box_txn_isolation | ( | void | ) |
Get isolation level of current transaction, one of enum txn_isolation_level values (but cannot be TXN_ISOLATION_DEFAULT (which is zero) by design).
-1 if there is no current transaction.
int box_txn_rollback | ( | void | ) |
Rollback the current transaction.
May fail if called from a nested statement.
int box_txn_set_isolation | ( | uint32_t | level | ) |
Set an isolation level for a transaction.
Must be called before the first DML. The level must be of enun txn_isolation_level values.
0 | if success |
-1 | if failed, diag is set. |
int box_txn_set_timeout | ( | double | timeout | ) |
Set timeout for transaction, when it expires, transaction will be rolled back.
0 | if success |
-1 | if timeout is less than or equal to 0, there is no current transaction or rollback timer for current transaction is already started. |
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.
space_id | space identifier | |
index_id | index identifier | |
key | encoded key in MsgPack Array format ([part1, part2, ...]). | |
key_end | the end of encoded key. | |
ops | encoded operations in MsgPack Array format, e.g. [ [ '=', fieldno, value ], ['!', 2, 'xxx'] ] | |
ops_end | the end of encoded ops | |
index_base | 0 if fieldnos in update operations are zero-based indexed (like C) or 1 if for one-based indexed field ids (like Lua). | |
[out] | result | a new tuple. Can be set to NULL to discard result. |
-1 | on error (check box_error_last()) |
0 | on success |
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.
space_id | space identifier | |
index_id | index identifier | |
ops | encoded operations in MsgPack Array format, e.g. [ [ '=', fieldno, value ], ['!', 2, 'xxx'] ] | |
ops_end | the end of encoded ops | |
tuple | encoded tuple in MsgPack Array format ([ field1, field2, ...]) | |
tuple_end | end of tuple | |
index_base | 0 if fieldnos in update operations are zero-based indexed (like C) or 1 if for one-based indexed field ids (like Lua). | |
[out] | result | a new tuple. Can be set to NULL to discard result. |
-1 | on error (check box_error_last()) |
0 | on success |
int box_wait_ro | ( | bool | ro, |
double | timeout | ||
) |
public
Wait until the instance switches to a desired mode.
ro | wait read-only if set or read-write if unset |
timeout | max time to wait |
-1 | timeout or fiber is cancelled |
0 | success |
double clock_monotonic | ( | void | ) |
A nonsettable system-wide clock that represents monotonic time.
double clock_process | ( | void | ) |
A clock that measures CPU time consumed by this process (by all threads in the process).
double clock_realtime | ( | void | ) |
public
A settable system-wide clock that measures real (i.e., wall-clock) time.
double clock_thread | ( | void | ) |
A clock that measures CPU time consumed by this thread.
ssize_t coio_call | ( | ssize_t(*)(va_list) | func, |
... | |||
) |
public
Create new eio task with specified function and arguments. Yield and wait until the task is complete.
This function doesn't throw exceptions to avoid double error checking: in most cases it's also necessary to check the return value of the called function and perform necessary actions. If func sets errno, the errno is preserved across the call.
-1 | and errno = ENOMEM if failed to create a task |
the | function return (errno is preserved). |
int coio_getaddrinfo | ( | const char * | host, |
const char * | port, | ||
const struct addrinfo * | hints, | ||
struct addrinfo ** | res, | ||
double | timeout | ||
) |
Fiber-friendly version of getaddrinfo(3).
host | host name, i.e. "tarantool.org" | |
port | service name, i.e. "80" or "http" | |
hints | hints, see getaddrinfo(3) | |
[out] | res | result, see getaddrinfo(3) |
timeout | timeout |
0 | on success, please free res using freeaddrinfo(3). |
-1 | on error, check diag. Please note that the return value is not compatible with getaddrinfo(3). |
int coio_wait | ( | int | fd, |
int | event, | ||
double | timeout | ||
) |
Wait until READ or WRITE event on socket (fd).
Yields.
fd | non-blocking socket file description |
event | requested events to wait. Combination of TNT_IO_READ | TNT_IO_WRITE bit flags. |
timeout | timeout in seconds. |
0 | timeout |
>0 | returned events. Combination of TNT_IO_READ | TNT_IO_WRITE bit flags. |
void fiber_attr_delete | ( | struct fiber_attr * | fiber_attr | ) |
Delete the fiber_attr and free all allocated resources.
This is safe when fibers created with this attribute still exist.
fiber_attr | fiber attribute |
size_t fiber_attr_getstacksize | ( | struct fiber_attr * | fiber_attr | ) |
Get stack size from the fiber attribute.
fiber_attr | fiber attribute container or NULL for default |
stack | size |
struct fiber_attr * fiber_attr_new | ( | void | ) |
Create a new fiber attribute container and initialize it with default parameters.
Can be used for many fibers creation, corresponding fibers will not take ownership.
int fiber_attr_setstacksize | ( | struct fiber_attr * | fiber_attr, |
size_t | stack_size | ||
) |
Set stack size for the fiber attribute.
fiber_attr | fiber attribute container |
stack_size | stack size for new fibers |
void fiber_cancel | ( | struct fiber * | f | ) |
Cancel the subject fiber.
Cancellation is asynchronous. Use fiber_join() to wait for the cancellation to complete.
After fiber_cancel() is called, the fiber may or may not check whether it was cancelled. If the fiber does not check it, it cannot ever be cancelled. However, as long as most of the cooperative code calls fiber_testcancel(), most of the fibers are cancellable.
f | fiber to be cancelled |
double fiber_clock | ( | void | ) |
Report loop begin time as double (cheap).
Uses monotonic clock.
int64_t fiber_clock64 | ( | void | ) |
Report loop begin time as 64-bit int.
Uses monotonic clock.
void fiber_cond_broadcast | ( | struct fiber_cond * | cond | ) |
Wake up all fibers waiting for the cond.
cond | condition |
void fiber_cond_delete | ( | struct fiber_cond * | cond | ) |
Delete the fiber cond object.
Behaviour is undefined if there are fiber waiting for the cond.
struct fiber_cond * fiber_cond_new | ( | void | ) |
public
Instantiate a new fiber cond object.
void fiber_cond_signal | ( | struct fiber_cond * | cond | ) |
Wake one fiber waiting for the cond.
Does nothing if no one is waiting.
cond | condition |
int fiber_cond_wait | ( | struct fiber_cond * | cond | ) |
Shortcut for fiber_cond_wait_timeout().
int fiber_cond_wait_timeout | ( | struct fiber_cond * | cond, |
double | timeout | ||
) |
Suspend the execution of the current fiber (i.e.
yield) until fiber_cond_signal() is called. Like pthread_cond, fiber_cond can issue spurious wake ups caused by explicit fiber_wakeup() or fiber_cancel() calls. It is highly recommended to wrap calls to this function into a loop and check an actual predicate and fiber_testcancel() on every iteration.
cond | condition |
timeout | timeout in seconds |
0 | on fiber_cond_signal() call or a spurious wake up |
-1 | on timeout or fiber cancellation, diag is set |
uint64_t fiber_csw | ( | const struct fiber * | fiber | ) |
Get number of context switches of the given fiber.
fiber | Target fiber, if it's NULL the current fiber is used. |
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 getting other info about the fiber (name, csw, etc.).
fid | Target fiber id. |
void * fiber_get_ctx | ( | struct fiber * | f | ) |
Get the context for the fiber which was set via the fiber_set_ctx function.
Can be used to avoid calling fiber_start which means no yields. If f is NULL, the current fiber is used.
context | for the fiber function set by fiber_set_ctx function |
uint64_t fiber_id | ( | const struct fiber * | fiber | ) |
Get fiber id.
fiber | Target fiber, if it's NULL the current fiber is used. |
int fiber_join | ( | struct fiber * | f | ) |
Wait until the fiber is dead and then move its execution status to the caller.
The fiber must not be detached (
f | fiber to be woken up |
int fiber_join_timeout | ( | struct fiber * | f, |
double | timeout | ||
) |
Wait until the fiber is dead or timeout exceeded.
In case timeout == TIMEOUT_INFINITY, this function same as fiber_join function. Return fiber execution status to the caller or -1 if timeout exceeded and set diag. The fiber must not be detached
f | fiber to be woken up |
timeout | time during which we wait for the fiber completion |
const char * fiber_name | ( | const struct fiber * | fiber | ) |
Get fiber name.
fiber | Target fiber, if it's NULL the current fiber is used. |
struct fiber * fiber_new | ( | const char * | name, |
fiber_func | f | ||
) |
Create a new fiber.
Takes a fiber from fiber cache, if it's not empty. Can fail only if there is not enough memory for the fiber structure or fiber stack.
The created fiber automatically returns itself to the fiber cache when its "main" function completes.
name | string with fiber name |
f | func for run inside fiber |
struct fiber * fiber_new_ex | ( | const char * | name, |
const struct fiber_attr * | fiber_attr, | ||
fiber_func | f | ||
) |
Create a new fiber with defined attributes.
Can fail only if there is not enough memory for the fiber structure or fiber stack.
The created fiber automatically returns itself to the fiber cache if has default stack size when its "main" function completes.
name | string with fiber name |
fiber_attr | fiber attributes |
f | func for run inside fiber |
bool fiber_set_cancellable | ( | bool | yesno | ) |
Deprecated.
void fiber_set_ctx | ( | struct fiber * | f, |
void * | f_arg | ||
) |
Set a pointer to context for the fiber.
Can be used to avoid calling fiber_start which means no yields.
f | fiber to set the context for if NULL, the current fiber is used |
f_arg | context for the fiber function |
void fiber_set_joinable | ( | struct fiber * | fiber, |
bool | yesno | ||
) |
Set fiber to be joinable (false by default).
The fiber must not be joined already nor dead.
fiber | to (un)set the joinable property. If set to NULL, the current fiber is used. |
yesno | status to set |
void fiber_set_name_n | ( | struct fiber * | fiber, |
const char * | name, | ||
uint32_t | len | ||
) |
Set fiber name.
fiber | Target fiber, if it's NULL the current fiber is used. |
name | A new name of fiber. |
len | Length of the string pointed to by name. |
void fiber_sleep | ( | double | s | ) |
Put the current fiber to sleep for at least 's' seconds.
s | time to sleep |
void fiber_start | ( | struct fiber * | callee, |
... | |||
) |
Start execution of created fiber.
callee | fiber to start |
... | arguments to start the fiber with |
double fiber_time | ( | void | ) |
Report loop begin time as double (cheap).
Uses real time clock.
int64_t fiber_time64 | ( | void | ) |
Report loop begin time as 64-bit int.
Uses real time clock.
void fiber_wakeup | ( | struct fiber * | f | ) |
Interrupt a synchronous wait of a fiber.
Nop for the currently running fiber.
f | fiber to be woken up |
void fiber_yield | ( | void | ) |
Return control to another fiber and wait until it'll be woken.
int luaL_cdef | ( | struct lua_State * | L, |
const char * | ctypename | ||
) |
Declare symbols for FFI.
L | Lua State |
ctypename | C definitions, e.g "struct stat" |
0 | on success |
LUA_ERRRUN,LUA_ERRMEM,LUA_ERRERR | otherwise |
void * luaL_checkcdata | ( | struct lua_State * | L, |
int | idx, | ||
uint32_t * | ctypeid | ||
) |
Checks whether the function argument idx is a cdata.
L | Lua State |
idx | stack index |
ctypeid | FFI's CTypeID of this cdata |
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.
error | if the argument can't be converted. |
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.
error | if the argument can't be converted. |
uint32_t luaL_ctypeid | ( | struct lua_State * | L, |
const char * | ctypename | ||
) |
Return CTypeID (FFI) of given СDATA type.
L | Lua State |
ctypename | С type name as string (e.g. "struct request" or "uint32_t") |
size_t luaL_getgctotal | ( | struct lua_State * | L | ) |
Return size of currently allocated memory.
L | Lua State |
int luaL_iscallable | ( | lua_State * | L, |
int | idx | ||
) |
Check whether a Lua object is a function or has metatable/metatype with a __call field.
Note: It does not check type of __call metatable/metatype field.
int luaL_iscdata | ( | struct lua_State * | L, |
int | idx | ||
) |
public
Checks whether a value on the Lua stack is a cdata.
Unlike luaL_checkcdata() this function does not raise an error. It is useful to raise a domain specific error.
Lua API and module API don't expose LUA_TCDATA constant. We have no guarantee that this constant will remain the same in future LuaJIT versions. So this function should be used in modules instead of lua_type(L, idx) == LUA_TCDATA
.
L | Lua state. |
idx | Acceptable index on the Lua stack. |
1 | If the value at the given index is a cdata. |
0 | Otherwise. |
bool luaL_isnull | ( | struct lua_State * | L, |
int | idx | ||
) |
Return true if the value at Lua stack is ffi's NULL (cdata<void *>: NULL).
L | stack |
idx | stack index |
void * luaL_pushcdata | ( | struct lua_State * | L, |
uint32_t | ctypeid | ||
) |
Push cdata of given ctypeid onto the stack.
CTypeID must be used from FFI at least once. Allocated memory returned uninitialized. Only numbers and pointers are supported.
L | Lua State |
ctypeid | FFI's CTypeID of this cdata |
void luaL_pushint64 | ( | struct lua_State * | L, |
int64_t | val | ||
) |
Push int64_t onto the stack.
L | is a Lua State |
val | is a value to push |
void luaL_pushnull | ( | struct lua_State * | L | ) |
Push ffi's NULL (cdata<void *>: NULL) onto the stack.
Can be used as replacement of nil in Lua tables.
L | stack |
void luaL_pushuint64 | ( | struct lua_State * | L, |
uint64_t | val | ||
) |
public
Push uint64_t onto the stack.
L | is a Lua State |
val | is a value to push |
void luaL_setcdatagc | ( | struct lua_State * | L, |
int | idx | ||
) |
Sets finalizer function on a cdata object.
Equivalent to call ffi.gc(obj, function). Finalizer function must be on the top of the stack.
L | Lua State |
idx | object |
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.
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 luaT_call | ( | lua_State * | L, |
int | nargs, | ||
int | nreturns | ||
) |
Like lua_call(), but with the proper support of Tarantool errors.
box_tuple_t * luaT_checktuple | ( | struct lua_State * | L, |
int | idx | ||
) |
public
Checks whether the argument idx is a tuple and returns it.
L | Lua State |
idx | the stack index |
non-NULL | argument is tuple |
error | if the argument is not a tuple. |
int luaT_cpcall | ( | lua_State * | L, |
lua_CFunction | func, | ||
void * | ud | ||
) |
Like lua_cpcall(), but with the proper support of Tarantool errors.
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.
L | Lua state |
str | string with Lua code to load and run |
int luaT_error | ( | lua_State * | L | ) |
Re-throws the last Tarantool error as a Lua object.
Set trace frame of to the caller of Lua C API.
int luaT_error_at | ( | lua_State * | L, |
int | level | ||
) |
Same as luaT_error but set error trace frame according to given level.
luaT_error same as this function with level equal to 1. If level is 0 then error trace is unchanged.
box_decimal_t * luaT_isdecimal | ( | struct lua_State * | L, |
int | index | ||
) |
Check whether a value on the Lua stack is a decimal.
Returns a pointer to the decimal on a successful check, NULL otherwise.
box_tuple_t * luaT_istuple | ( | struct lua_State * | L, |
int | idx | ||
) |
Checks whether argument idx is a tuple.
L | Lua State |
idx | the stack index |
non-NULL | argument is tuple |
NULL | argument is not tuple |
box_decimal_t * luaT_newdecimal | ( | struct lua_State * | L | ) |
public
Allocate a new decimal on the Lua stack and return a pointer to it.
int luaT_push_nil_and_error | ( | lua_State * | L | ) |
Return nil as the first return value and an error as the second.
The error is received using box_error_last().
L | Lua stack. |
void luaT_pusherror | ( | struct lua_State * | L, |
struct error * | e | ||
) |
Push error to a Lua stack.
L | Lua stack. |
e | error. |
void luaT_pushtuple | ( | struct lua_State * | L, |
box_tuple_t * | tuple | ||
) |
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.
Both 'struct ibuf' and 'struct ibuf *' are accepted. Returns NULL, if can't convert - not an ibuf object.
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.
L | Lua state. |
idx | Acceptable index on the Lua stack. |
tuple_len_ptr | Where to store tuple data size in bytes (or NULL). |
The storage for data is allocated on the box region. A caller should call box_region_truncate() to release the data.
In case of an error set a diag and return NULL.
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.
The new tuple is referenced in the same way as one created by box_tuple_new(). There are two possible usage scenarios:
In case of an error set a diag and return NULL.
void tnt_tx_flush | ( | void | ) |
Send all the pending callbacks of this thread to TX thread.
Note, that it doesn't guarantee that they are already executed when this function returns. They are only sent to TX thread, not called yet. It is the caller's responsibility to ensure that the messages are not being sent faster than TX thread is handling them. Otherwise the queue in TX thread grows faster than shrinks and could lead to unpredictable latency and even OOM.
Note, that push is very cheap while flush is relatively expensive both for this thread and for TX thread. Avoid calling it on each push if possible.
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.
In order for the messages to be actually sent to TX thread the user must call tnt_tx_flush() in the same thread as the pushes.
In TX thread the callbacks are guaranteed to start execution in the same order as the push, but the order of completion is undefined if they are yielding, since they get executed potentially in different fibers.
The callbacks are handled by an internal fiber pool running in TX thread. The pool has a limited size. In case the callbacks are yielding and the user wants to execute more of them concurrently than the default size of the fiber pool, then the size can be extended (or reduced) using fiber.tx_user_pool_size() Lua API or fiber.tx_user_pool_size
YAML config.
If called during Tarantool shutdown, the behaviour is undefined. The external threads must be terminated before that.
If called in TX thread, the behaviour is undefined.
The function relies on thread_local
C++ data to have properly working destructors and constructors and won't be suitable for any other runtime.