diff --git a/include/fiber.h b/include/fiber.h index 44ce6b8766d7bbdd262d08b18810a5bf66c883b5..5689ad9e95e098cff14fbe66d90fda3693820199 100644 --- a/include/fiber.h +++ b/include/fiber.h @@ -87,7 +87,7 @@ struct fiber { void *f_data; /* Store execution context in a fiber. */ union { - struct box_txn *txn; + struct txn *txn; } mod_data; u64 cookie; diff --git a/mod/box/box.m b/mod/box/box.m index 3d7bfd7ce353930eb009abcde09ed96dc980648a..1001ca99ea276455f49f1fc95d80b98a88d83783 100644 --- a/mod/box/box.m +++ b/mod/box/box.m @@ -74,7 +74,7 @@ box_process_rw(u32 op, struct tbuf *request_data) stat_collect(stat_base, op, 1); - struct box_txn *txn = in_txn(); + struct txn *txn = in_txn(); if (txn == NULL) { txn = txn_begin(); txn->flags |= BOX_GC_TXN; @@ -102,7 +102,7 @@ static void box_process_ro(u32 op, struct tbuf *request_data) { if (!request_is_select(op)) { - struct box_txn *txn = in_txn(); + struct txn *txn = in_txn(); if (txn != NULL) txn_rollback(txn); tnt_raise(LoggedError, :ER_NONMASTER); @@ -272,7 +272,7 @@ recover_row(struct recovery_state *r __attribute__((unused)), struct tbuf *t) u16 op = read_u16(t); - struct box_txn *txn = txn_begin(); + struct txn *txn = txn_begin(); txn->flags |= BOX_NOT_STORE; txn->port = &port_null; @@ -519,7 +519,7 @@ mod_cat(const char *filename) } static void -snapshot_write_tuple(struct log_io_iter *i, unsigned n, struct box_tuple *tuple) +snapshot_write_tuple(struct log_io_iter *i, unsigned n, struct tuple *tuple) { struct tbuf *row; struct box_snap_row header; @@ -541,7 +541,7 @@ snapshot_write_tuple(struct log_io_iter *i, unsigned n, struct box_tuple *tuple) void mod_snapshot(struct log_io_iter *i) { - struct box_tuple *tuple; + struct tuple *tuple; for (uint32_t n = 0; n < BOX_SPACE_MAX; ++n) { if (!space[n].enabled) diff --git a/mod/box/box_lua.h b/mod/box/box_lua.h index 0c9b4445f9a3920c995499d9b0dc433a39124348..6849649fd76fcc41007bec4e9c74f14a0eb05733 100644 --- a/mod/box/box_lua.h +++ b/mod/box/box_lua.h @@ -31,19 +31,19 @@ * SUCH DAMAGE. */ struct tbuf; -struct box_txn; -struct box_tuple; +struct txn; +struct tuple; struct lua_State; /** * Invoke a Lua stored procedure from the binary protocol * (implementation of 'CALL' command code). */ -void do_call(struct box_txn *txn, struct tbuf *req); +void do_call(struct txn *txn, struct tbuf *req); /** * Create an instance of Lua interpreter in box. */ void box_lua_init(); -struct box_tuple *lua_istuple(struct lua_State *L, int narg); +struct tuple *lua_istuple(struct lua_State *L, int narg); #endif /* INCLUDES_TARANTOOL_MOD_BOX_LUA_H */ diff --git a/mod/box/box_lua.m b/mod/box/box_lua.m index 71ddab4e5654e51e8c63f00b21b5fb17a19ae586..28add972b21257aa6f321ec60cd086a81f73ae65 100644 --- a/mod/box/box_lua.m +++ b/mod/box/box_lua.m @@ -72,19 +72,19 @@ lua_State *root_L; static const char *tuplelib_name = "box.tuple"; -static inline struct box_tuple * +static inline struct tuple * lua_checktuple(struct lua_State *L, int narg) { return *(void **) luaL_checkudata(L, narg, tuplelib_name); } -struct box_tuple * +struct tuple * lua_istuple(struct lua_State *L, int narg) { if (lua_getmetatable(L, narg) == 0) return NULL; luaL_getmetatable(L, tuplelib_name); - struct box_tuple *tuple = 0; + struct tuple *tuple = 0; if (lua_equal(L, -1, -2)) tuple = * (void **) lua_touserdata(L, narg); lua_pop(L, 2); @@ -94,7 +94,7 @@ lua_istuple(struct lua_State *L, int narg) static int lbox_tuple_gc(struct lua_State *L) { - struct box_tuple *tuple = lua_checktuple(L, 1); + struct tuple *tuple = lua_checktuple(L, 1); tuple_ref(tuple, -1); return 0; } @@ -102,7 +102,7 @@ lbox_tuple_gc(struct lua_State *L) static int lbox_tuple_len(struct lua_State *L) { - struct box_tuple *tuple = lua_checktuple(L, 1); + struct tuple *tuple = lua_checktuple(L, 1); lua_pushnumber(L, tuple->field_count); return 1; } @@ -110,7 +110,7 @@ lbox_tuple_len(struct lua_State *L) static int lbox_tuple_slice(struct lua_State *L) { - struct box_tuple *tuple = lua_checktuple(L, 1); + struct tuple *tuple = lua_checktuple(L, 1); int argc = lua_gettop(L) - 1; int start, end; @@ -156,7 +156,7 @@ lbox_tuple_slice(struct lua_State *L) static int lbox_tuple_unpack(struct lua_State *L) { - struct box_tuple *tuple = lua_checktuple(L, 1); + struct tuple *tuple = lua_checktuple(L, 1); u8 *field = tuple->data; while (field < tuple->data + tuple->bsize) { @@ -178,7 +178,7 @@ lbox_tuple_unpack(struct lua_State *L) static int lbox_tuple_index(struct lua_State *L) { - struct box_tuple *tuple = lua_checktuple(L, 1); + struct tuple *tuple = lua_checktuple(L, 1); /* For integer indexes, implement [] operator */ if (lua_isnumber(L, 2)) { int i = luaL_checkint(L, 2); @@ -199,7 +199,7 @@ lbox_tuple_index(struct lua_State *L) static int lbox_tuple_tostring(struct lua_State *L) { - struct box_tuple *tuple = lua_checktuple(L, 1); + struct tuple *tuple = lua_checktuple(L, 1); /* @todo: print the tuple */ struct tbuf *tbuf = tbuf_alloc(fiber->gc_pool); tuple_print(tbuf, tuple->field_count, tuple->data); @@ -208,7 +208,7 @@ lbox_tuple_tostring(struct lua_State *L) } static void -lbox_pushtuple(struct lua_State *L, struct box_tuple *tuple) +lbox_pushtuple(struct lua_State *L, struct tuple *tuple) { if (tuple) { void **ptr = lua_newuserdata(L, sizeof(void *)); @@ -229,7 +229,7 @@ lbox_pushtuple(struct lua_State *L, struct box_tuple *tuple) static int lbox_tuple_next(struct lua_State *L) { - struct box_tuple *tuple = lua_checktuple(L, 1); + struct tuple *tuple = lua_checktuple(L, 1); int argc = lua_gettop(L) - 1; u8 *field = NULL; size_t len; @@ -466,7 +466,7 @@ lbox_index_move(struct lua_State *L, enum iterator_type type) if (argc == 1 && lua_type(L, 2) == LUA_TUSERDATA) { /* Searching by tuple. */ - struct box_tuple *tuple = lua_checktuple(L, 2); + struct tuple *tuple = lua_checktuple(L, 2); key = tuple->data; field_count = tuple->field_count; } else { @@ -494,7 +494,7 @@ lbox_index_move(struct lua_State *L, enum iterator_type type) } else { /* 1 item on the stack and it's a userdata. */ it = lua_checkiterator(L, 2); } - struct box_tuple *tuple = it->next(it); + struct tuple *tuple = it->next(it); /* If tuple is NULL, pushes nil as end indicator. */ lbox_pushtuple(L, tuple); return tuple ? 2 : 1; @@ -567,7 +567,7 @@ port_lua_add_u32(u32 *p_u32 __attribute__((unused))) } static void -port_lua_add_tuple(struct box_tuple *tuple) +port_lua_add_tuple(struct tuple *tuple) { struct lua_State *L = in_txn()->L; lbox_pushtuple(L, tuple); @@ -594,12 +594,12 @@ static struct port port_lua = { /* }}} */ -static inline struct box_txn * +static inline struct txn * txn_enter_lua(lua_State *L) { - struct box_txn *old_txn = in_txn(); + struct txn *old_txn = in_txn(); fiber->mod_data.txn = NULL; - struct box_txn *txn = fiber->mod_data.txn = txn_begin(); + struct txn *txn = fiber->mod_data.txn = txn_begin(); txn->port = &port_lua; txn->L = L; return old_txn; @@ -637,7 +637,7 @@ static int lbox_process(lua_State *L) int top = lua_gettop(L); /* to know how much is added by rw_callback */ size_t allocated_size = palloc_allocated(fiber->gc_pool); - struct box_txn *old_txn = txn_enter_lua(L); + struct txn *old_txn = txn_enter_lua(L); @try { rw_callback(op, &req); } @finally { @@ -696,7 +696,7 @@ box_lua_panic(struct lua_State *L) * Invoke a Lua stored procedure from the binary protocol * (implementation of 'CALL' command code). */ -void do_call(struct box_txn *txn, struct tbuf *data) +void do_call(struct txn *txn, struct tbuf *data) { lua_State *L = lua_newthread(root_L); int coro_ref = luaL_ref(root_L, LUA_REGISTRYINDEX); diff --git a/mod/box/index.h b/mod/box/index.h index 2c518ffa1f379c36740e77e8fba5cc5a34936daf..8ad94a73d9ce7308cae7c19617c793db401eba71 100644 --- a/mod/box/index.h +++ b/mod/box/index.h @@ -29,7 +29,7 @@ #include <stdbool.h> #include <util.h> -struct box_tuple; +struct tuple; struct space; struct index; @@ -113,12 +113,12 @@ struct key_def { - (void) enable; - (void) build: (Index *) pk; - (size_t) size; -- (struct box_tuple *) min; -- (struct box_tuple *) max; -- (struct box_tuple *) findByKey: (void *) key :(int) part_count; -- (struct box_tuple *) findByTuple: (struct box_tuple *) tuple; -- (void) remove: (struct box_tuple *) tuple; -- (void) replace: (struct box_tuple *) old_tuple :(struct box_tuple *) new_tuple; +- (struct tuple *) min; +- (struct tuple *) max; +- (struct tuple *) findByKey: (void *) key :(int) part_count; +- (struct tuple *) findByTuple: (struct tuple *) tuple; +- (void) remove: (struct tuple *) tuple; +- (void) replace: (struct tuple *) old_tuple :(struct tuple *) new_tuple; /** * Create a structure to represent an iterator. Must be * initialized separately. @@ -136,15 +136,15 @@ struct key_def { /** * Unsafe search methods that do not check key part count. */ -- (struct box_tuple *) findUnsafe: (void *) key :(int) part_count; +- (struct tuple *) findUnsafe: (void *) key :(int) part_count; - (void) initIteratorUnsafe: (struct iterator *) iterator :(enum iterator_type) type :(void *) key :(int) part_count; @end struct iterator { - struct box_tuple *(*next)(struct iterator *); - struct box_tuple *(*next_equal)(struct iterator *); + struct tuple *(*next)(struct iterator *); + struct tuple *(*next_equal)(struct iterator *); void (*free)(struct iterator *); }; diff --git a/mod/box/index.m b/mod/box/index.m index 154cd919294bb15c30037e5fc0c0b6c736d9de88..8f7dc9f5da3f35752955800fc7cb752fc67d946a 100644 --- a/mod/box/index.m +++ b/mod/box/index.m @@ -35,13 +35,13 @@ const char *field_data_type_strs[] = {"NUM", "NUM64", "STR", "\0"}; const char *index_type_strs[] = { "HASH", "TREE", "\0" }; -static struct box_tuple * +static struct tuple * iterator_next_equal(struct iterator *it __attribute__((unused))) { return NULL; } -static struct box_tuple * +static struct tuple * iterator_first_equal(struct iterator *it) { it->next_equal = iterator_next_equal; @@ -119,25 +119,25 @@ iterator_first_equal(struct iterator *it) return 0; } -- (struct box_tuple *) min +- (struct tuple *) min { [self subclassResponsibility: _cmd]; return NULL; } -- (struct box_tuple *) max +- (struct tuple *) max { [self subclassResponsibility: _cmd]; return NULL; } -- (struct box_tuple *) findByKey: (void *) key :(int) part_count +- (struct tuple *) findByKey: (void *) key :(int) part_count { [self checkKeyParts: part_count :false]; return [self findUnsafe: key :part_count]; } -- (struct box_tuple *) findUnsafe: (void *) key :(int) part_count +- (struct tuple *) findUnsafe: (void *) key :(int) part_count { (void) key; (void) part_count; @@ -145,21 +145,21 @@ iterator_first_equal(struct iterator *it) return NULL; } -- (struct box_tuple *) findByTuple: (struct box_tuple *) pattern +- (struct tuple *) findByTuple: (struct tuple *) pattern { (void) pattern; [self subclassResponsibility: _cmd]; return NULL; } -- (void) remove: (struct box_tuple *) tuple +- (void) remove: (struct tuple *) tuple { (void) tuple; [self subclassResponsibility: _cmd]; } -- (void) replace: (struct box_tuple *) old_tuple - :(struct box_tuple *) new_tuple +- (void) replace: (struct tuple *) old_tuple + :(struct tuple *) new_tuple { (void) old_tuple; (void) new_tuple; @@ -228,7 +228,7 @@ hash_iterator(struct iterator *it) return (struct hash_iterator *) it; } -struct box_tuple * +struct tuple * hash_iterator_next(struct iterator *iterator) { assert(iterator->next == hash_iterator_next); @@ -271,7 +271,7 @@ hash_iterator_free(struct iterator *iterator) PRIu32 "...", n_tuples, index_n(self)); struct iterator *it = pk->position; - struct box_tuple *tuple; + struct tuple *tuple; [pk initIterator: it :ITER_FORWARD]; while ((tuple = it->next(it))) @@ -283,19 +283,19 @@ hash_iterator_free(struct iterator *iterator) [super free]; } -- (struct box_tuple *) min +- (struct tuple *) min { tnt_raise(ClientError, :ER_UNSUPPORTED, "Hash index", "min()"); return NULL; } -- (struct box_tuple *) max +- (struct tuple *) max { tnt_raise(ClientError, :ER_UNSUPPORTED, "Hash index", "max()"); return NULL; } -- (struct box_tuple *) findByTuple: (struct box_tuple *) tuple +- (struct tuple *) findByTuple: (struct tuple *) tuple { /* Hash index currently is always single-part. */ void *field = tuple_field(tuple, key_def->parts[0].fieldno); @@ -367,11 +367,11 @@ int32_key_to_value(void *key) return mh_size(int_hash); } -- (struct box_tuple *) findUnsafe: (void *) key :(int) part_count +- (struct tuple *) findUnsafe: (void *) key :(int) part_count { (void) part_count; - struct box_tuple *ret = NULL; + struct tuple *ret = NULL; u32 num = int32_key_to_value(key); mh_int_t k = mh_i32ptr_get(int_hash, num); if (k != mh_end(int_hash)) @@ -382,7 +382,7 @@ int32_key_to_value(void *key) return ret; } -- (void) remove: (struct box_tuple *) tuple +- (void) remove: (struct tuple *) tuple { void *field = tuple_field(tuple, key_def->parts[0].fieldno); u32 num = int32_key_to_value(field); @@ -394,8 +394,8 @@ int32_key_to_value(void *key) #endif } -- (void) replace: (struct box_tuple *) old_tuple - :(struct box_tuple *) new_tuple +- (void) replace: (struct tuple *) old_tuple + :(struct tuple *) new_tuple { void *field = tuple_field(new_tuple, key_def->parts[0].fieldno); u32 num = int32_key_to_value(field); @@ -488,11 +488,11 @@ int64_key_to_value(void *key) return mh_size(int64_hash); } -- (struct box_tuple *) findUnsafe: (void *) key :(int) part_count +- (struct tuple *) findUnsafe: (void *) key :(int) part_count { (void) part_count; - struct box_tuple *ret = NULL; + struct tuple *ret = NULL; u64 num = int64_key_to_value(key); mh_int_t k = mh_i64ptr_get(int64_hash, num); if (k != mh_end(int64_hash)) @@ -503,7 +503,7 @@ int64_key_to_value(void *key) return ret; } -- (void) remove: (struct box_tuple *) tuple +- (void) remove: (struct tuple *) tuple { void *field = tuple_field(tuple, key_def->parts[0].fieldno); u64 num = int64_key_to_value(field); @@ -516,8 +516,8 @@ int64_key_to_value(void *key) #endif } -- (void) replace: (struct box_tuple *) old_tuple - :(struct box_tuple *) new_tuple +- (void) replace: (struct tuple *) old_tuple + :(struct tuple *) new_tuple { void *field = tuple_field(new_tuple, key_def->parts[0].fieldno); u64 num = int64_key_to_value(field); @@ -601,10 +601,10 @@ int64_key_to_value(void *key) return mh_size(str_hash); } -- (struct box_tuple *) findUnsafe: (void *) key :(int) part_count +- (struct tuple *) findUnsafe: (void *) key :(int) part_count { (void) part_count; - struct box_tuple *ret = NULL; + struct tuple *ret = NULL; mh_int_t k = mh_lstrptr_get(str_hash, key); if (k != mh_end(str_hash)) ret = mh_value(str_hash, k); @@ -616,7 +616,7 @@ int64_key_to_value(void *key) return ret; } -- (void) remove: (struct box_tuple *) tuple +- (void) remove: (struct tuple *) tuple { void *field = tuple_field(tuple, key_def->parts[0].fieldno); @@ -630,8 +630,8 @@ int64_key_to_value(void *key) #endif } -- (void) replace: (struct box_tuple *) old_tuple - :(struct box_tuple *) new_tuple +- (void) replace: (struct tuple *) old_tuple + :(struct tuple *) new_tuple { void *field = tuple_field(new_tuple, key_def->parts[0].fieldno); diff --git a/mod/box/memcached-grammar.m b/mod/box/memcached-grammar.m index d97e8038de51101dcc64bde2538cfbd677b4a091..52623fc30099d9bbc1d0b06fb61cf3fc96ac32f9 100644 --- a/mod/box/memcached-grammar.m +++ b/mod/box/memcached-grammar.m @@ -269,7 +269,7 @@ tr26: #line 63 "mod/box/memcached-grammar.rl" { key = read_field(keys); - struct box_tuple *tuple = find(key); + struct tuple *tuple = find(key); if (tuple != NULL && !expired(tuple)) iov_add("NOT_STORED\r\n", 12); else @@ -309,7 +309,7 @@ tr30: #line 63 "mod/box/memcached-grammar.rl" { key = read_field(keys); - struct box_tuple *tuple = find(key); + struct tuple *tuple = find(key); if (tuple != NULL && !expired(tuple)) iov_add("NOT_STORED\r\n", 12); else @@ -351,7 +351,7 @@ tr39: #line 63 "mod/box/memcached-grammar.rl" { key = read_field(keys); - struct box_tuple *tuple = find(key); + struct tuple *tuple = find(key); if (tuple != NULL && !expired(tuple)) iov_add("NOT_STORED\r\n", 12); else @@ -397,7 +397,7 @@ tr58: u32 value_len; key = read_field(keys); - struct box_tuple *tuple = find(key); + struct tuple *tuple = find(key); if (tuple == NULL || tuple->flags & GHOST) { iov_add("NOT_STORED\r\n", 12); } else { @@ -455,7 +455,7 @@ tr62: u32 value_len; key = read_field(keys); - struct box_tuple *tuple = find(key); + struct tuple *tuple = find(key); if (tuple == NULL || tuple->flags & GHOST) { iov_add("NOT_STORED\r\n", 12); } else { @@ -515,7 +515,7 @@ tr71: u32 value_len; key = read_field(keys); - struct box_tuple *tuple = find(key); + struct tuple *tuple = find(key); if (tuple == NULL || tuple->flags & GHOST) { iov_add("NOT_STORED\r\n", 12); } else { @@ -571,7 +571,7 @@ tr91: #line 81 "mod/box/memcached-grammar.rl" { key = read_field(keys); - struct box_tuple *tuple = find(key); + struct tuple *tuple = find(key); if (tuple == NULL || expired(tuple)) iov_add("NOT_FOUND\r\n", 11); else if (meta(tuple)->cas != cas) @@ -613,7 +613,7 @@ tr95: #line 81 "mod/box/memcached-grammar.rl" { key = read_field(keys); - struct box_tuple *tuple = find(key); + struct tuple *tuple = find(key); if (tuple == NULL || expired(tuple)) iov_add("NOT_FOUND\r\n", 11); else if (meta(tuple)->cas != cas) @@ -657,7 +657,7 @@ tr105: #line 81 "mod/box/memcached-grammar.rl" { key = read_field(keys); - struct box_tuple *tuple = find(key); + struct tuple *tuple = find(key); if (tuple == NULL || expired(tuple)) iov_add("NOT_FOUND\r\n", 11); else if (meta(tuple)->cas != cas) @@ -686,7 +686,7 @@ tr118: u64 value; key = read_field(keys); - struct box_tuple *tuple = find(key); + struct tuple *tuple = find(key); if (tuple == NULL || tuple->flags & GHOST || expired(tuple)) { iov_add("NOT_FOUND\r\n", 11); } else { @@ -751,7 +751,7 @@ tr122: u64 value; key = read_field(keys); - struct box_tuple *tuple = find(key); + struct tuple *tuple = find(key); if (tuple == NULL || tuple->flags & GHOST || expired(tuple)) { iov_add("NOT_FOUND\r\n", 11); } else { @@ -818,7 +818,7 @@ tr132: u64 value; key = read_field(keys); - struct box_tuple *tuple = find(key); + struct tuple *tuple = find(key); if (tuple == NULL || tuple->flags & GHOST || expired(tuple)) { iov_add("NOT_FOUND\r\n", 11); } else { @@ -877,7 +877,7 @@ tr141: #line 174 "mod/box/memcached-grammar.rl" { key = read_field(keys); - struct box_tuple *tuple = find(key); + struct tuple *tuple = find(key); if (tuple == NULL || tuple->flags & GHOST || expired(tuple)) { iov_add("NOT_FOUND\r\n", 11); } else { @@ -911,7 +911,7 @@ tr146: #line 174 "mod/box/memcached-grammar.rl" { key = read_field(keys); - struct box_tuple *tuple = find(key); + struct tuple *tuple = find(key); if (tuple == NULL || tuple->flags & GHOST || expired(tuple)) { iov_add("NOT_FOUND\r\n", 11); } else { @@ -941,7 +941,7 @@ tr157: #line 174 "mod/box/memcached-grammar.rl" { key = read_field(keys); - struct box_tuple *tuple = find(key); + struct tuple *tuple = find(key); if (tuple == NULL || tuple->flags & GHOST || expired(tuple)) { iov_add("NOT_FOUND\r\n", 11); } else { @@ -1032,7 +1032,7 @@ tr195: } #line 192 "mod/box/memcached-grammar.rl" { - struct box_txn *txn = txn_begin(); + struct txn *txn = txn_begin(); txn->flags |= BOX_GC_TXN; txn->port = &port_null; @try { @@ -1096,7 +1096,7 @@ tr233: #line 72 "mod/box/memcached-grammar.rl" { key = read_field(keys); - struct box_tuple *tuple = find(key); + struct tuple *tuple = find(key); if (tuple == NULL || expired(tuple)) iov_add("NOT_STORED\r\n", 12); else @@ -1136,7 +1136,7 @@ tr237: #line 72 "mod/box/memcached-grammar.rl" { key = read_field(keys); - struct box_tuple *tuple = find(key); + struct tuple *tuple = find(key); if (tuple == NULL || expired(tuple)) iov_add("NOT_STORED\r\n", 12); else @@ -1178,7 +1178,7 @@ tr246: #line 72 "mod/box/memcached-grammar.rl" { key = read_field(keys); - struct box_tuple *tuple = find(key); + struct tuple *tuple = find(key); if (tuple == NULL || expired(tuple)) iov_add("NOT_STORED\r\n", 12); else diff --git a/mod/box/memcached.m b/mod/box/memcached.m index 6653655df3784b3d3c711439bcf0be68662e48f4..e16ca29474e037bc6fb0af8acaae401728f2bccb 100644 --- a/mod/box/memcached.m +++ b/mod/box/memcached.m @@ -104,7 +104,7 @@ store(void *key, u32 exptime, u32 flags, u32 bytes, u8 *data) say_debug("memcached/store key:(%i)'%.*s' exptime:%"PRIu32" flags:%"PRIu32" cas:%"PRIu64, key_len, key_len, (u8 *)key, exptime, flags, cas); - struct box_txn *txn = txn_begin(); + struct txn *txn = txn_begin(); txn->port = &port_null; /* * Use a box dispatch wrapper which handles correctly @@ -125,27 +125,27 @@ delete(void *key) tbuf_append(req, &key_len, sizeof(key_len)); tbuf_append_field(req, key); - struct box_txn *txn = txn_begin(); + struct txn *txn = txn_begin(); txn->port = &port_null; rw_callback(DELETE, req); } -static struct box_tuple * +static struct tuple * find(void *key) { return [memcached_index findByKey :key :1]; } static struct meta * -meta(struct box_tuple *tuple) +meta(struct tuple *tuple) { void *field = tuple_field(tuple, 1); return field + 1; } static bool -expired(struct box_tuple *tuple) +expired(struct tuple *tuple) { struct meta *m = meta(tuple); return m->exptime == 0 ? 0 : m->exptime < ev_now(); @@ -204,7 +204,7 @@ print_stats() iov_add(out->data, out->size); } -void memcached_get(struct box_txn *txn, size_t keys_count, struct tbuf *keys, +void memcached_get(struct txn *txn, size_t keys_count, struct tbuf *keys, bool show_cas) { txn->type = SELECT; @@ -213,7 +213,7 @@ void memcached_get(struct box_txn *txn, size_t keys_count, struct tbuf *keys, say_debug("ensuring space for %"PRI_SZ" keys", keys_count); iov_ensure(keys_count * 5 + 1); while (keys_count-- > 0) { - struct box_tuple *tuple; + struct tuple *tuple; struct meta *m; void *field; void *value; @@ -286,7 +286,7 @@ flush_all(void *data) { uintptr_t delay = (uintptr_t)data; fiber_sleep(delay - ev_now()); - struct box_tuple *tuple; + struct tuple *tuple; struct iterator *it = [memcached_index allocIterator]; [memcached_index initIterator: it :ITER_FORWARD]; while ((tuple = it->next(it))) { @@ -501,7 +501,7 @@ memcached_delete_expired_keys(struct tbuf *keys_to_delete) void memcached_expire_loop(void *data __attribute__((unused))) { - struct box_tuple *tuple = NULL; + struct tuple *tuple = NULL; say_info("memcached expire fiber started"); memcached_it = [memcached_index allocIterator]; diff --git a/mod/box/port.h b/mod/box/port.h index efe495c56d3de110fb4946884734a2339f563647..af5aeffa7d0a09af1fd6e1d1a32370e88b2aefc3 100644 --- a/mod/box/port.h +++ b/mod/box/port.h @@ -30,13 +30,13 @@ */ #include <util.h> -struct box_tuple; +struct tuple; struct lua_State; struct port { void (*add_u32)(u32 *u32); void (*dup_u32)(u32 u32); - void (*add_tuple)(struct box_tuple *tuple); + void (*add_tuple)(struct tuple *tuple); void (*add_lua_multret)(struct lua_State *L); }; diff --git a/mod/box/port.m b/mod/box/port.m index ba29fb728417aad6645e2b7d1a09551e7ccd4b63..2fb3297771107f88f5765bbc31daaa3e77ae40f2 100644 --- a/mod/box/port.m +++ b/mod/box/port.m @@ -68,7 +68,7 @@ iov_dup_u32(u32 u32) } static void -iov_add_tuple(struct box_tuple *tuple) +iov_add_tuple(struct tuple *tuple) { size_t len = tuple_len(tuple); @@ -151,7 +151,7 @@ iov_add_lua_table(struct lua_State *L, int index) void iov_add_ret(struct lua_State *L, int index) { int type = lua_type(L, index); - struct box_tuple *tuple; + struct tuple *tuple; switch (type) { case LUA_TTABLE: { @@ -238,7 +238,7 @@ struct port port_iproto = { static void port_null_add_u32(u32 *p_u32 __attribute__((unused))) {} static void port_null_dup_u32(u32 u32 __attribute__((unused))) {} -static void port_null_add_tuple(struct box_tuple *tuple __attribute__((unused))) {} +static void port_null_add_tuple(struct tuple *tuple __attribute__((unused))) {} static void port_null_add_lua_multret(struct lua_State *L __attribute__((unused))) {} struct port port_null = { diff --git a/mod/box/request.h b/mod/box/request.h index 06a84c8a48407e37a8f09332bbeb10b3a4ad8cb6..132a39b4d85bb8010363e01f54b77709438df00a 100644 --- a/mod/box/request.h +++ b/mod/box/request.h @@ -39,11 +39,11 @@ enum { }; @class Index; struct tarantool_cfg; -struct box_tuple; +struct tuple; struct port; struct space; -struct box_txn { +struct txn { u16 type; u32 flags; @@ -53,9 +53,9 @@ struct box_txn { Index *index; struct tbuf *ref_tuples; - struct box_tuple *old_tuple; - struct box_tuple *new_tuple; - struct box_tuple *lock_tuple; + struct tuple *old_tuple; + struct tuple *new_tuple; + struct tuple *lock_tuple; struct tbuf req; }; @@ -118,8 +118,8 @@ ENUM(update_op_codes, UPDATE_OP_CODES); extern iproto_callback rw_callback; -void request_set_type(struct box_txn *req, u16 type, struct tbuf *data); -void request_dispatch(struct box_txn *txn, struct tbuf *data); +void request_set_type(struct txn *req, u16 type, struct tbuf *data); +void request_dispatch(struct txn *txn, struct tbuf *data); static inline bool request_is_select(u32 type) diff --git a/mod/box/request.m b/mod/box/request.m index 16dd68d42fdea8fa8829c4370bc2ef49f3a8f84d..2ddec39d9c4167d5acf2dc26cb7e7a48b7a96770 100644 --- a/mod/box/request.m +++ b/mod/box/request.m @@ -57,7 +57,7 @@ read_key(struct tbuf *data, void **key_ptr, u32 *key_part_count_ptr) } static void __attribute__((noinline)) -do_replace(struct box_txn *txn, size_t field_count, struct tbuf *data) +do_replace(struct txn *txn, size_t field_count, struct tbuf *data) { assert(data != NULL); if (field_count == 0) @@ -641,7 +641,7 @@ update_field_skip_fields(struct update_field *field, i32 skip_count, * the operations. */ static void -init_update_operations(struct box_txn *txn, struct update_cmd *cmd) +init_update_operations(struct txn *txn, struct update_cmd *cmd) { /* * 1. Sort operations by field number and order within the @@ -766,7 +766,7 @@ init_update_operations(struct box_txn *txn, struct update_cmd *cmd) } static void -do_update_ops(struct box_txn *txn, struct update_cmd *cmd) +do_update_ops(struct txn *txn, struct update_cmd *cmd) { void *new_data = txn->new_tuple->data; void *new_data_end = new_data + txn->new_tuple->bsize; @@ -828,7 +828,7 @@ do_update_ops(struct box_txn *txn, struct update_cmd *cmd) } static void __attribute__((noinline)) -do_update(struct box_txn *txn, struct tbuf *data) +do_update(struct txn *txn, struct tbuf *data) { u32 tuples_affected = 1; @@ -864,9 +864,9 @@ out: /** }}} */ static void __attribute__((noinline)) -do_select(struct box_txn *txn, u32 limit, u32 offset, struct tbuf *data) +do_select(struct txn *txn, u32 limit, u32 offset, struct tbuf *data) { - struct box_tuple *tuple; + struct tuple *tuple; uint32_t *found; u32 count = read_u32(data); if (count == 0) @@ -911,7 +911,7 @@ do_select(struct box_txn *txn, u32 limit, u32 offset, struct tbuf *data) } static void __attribute__((noinline)) -do_delete(struct box_txn *txn, struct tbuf *data) +do_delete(struct txn *txn, struct tbuf *data) { u32 tuples_affected = 0; @@ -944,7 +944,7 @@ do_delete(struct box_txn *txn, struct tbuf *data) } static void -request_set_space(struct box_txn *txn, struct tbuf *data) +request_set_space(struct txn *txn, struct tbuf *data) { int space_no = read_u32(data); @@ -961,7 +961,7 @@ request_set_space(struct box_txn *txn, struct tbuf *data) /** Remember op code/request in the txn. */ void -request_set_type(struct box_txn *req, u16 type, struct tbuf *data) +request_set_type(struct txn *req, u16 type, struct tbuf *data) { req->type = type; req->req = (struct tbuf) { @@ -972,7 +972,7 @@ request_set_type(struct box_txn *req, u16 type, struct tbuf *data) } void -request_dispatch(struct box_txn *txn, struct tbuf *data) +request_dispatch(struct txn *txn, struct tbuf *data) { u32 field_count; diff --git a/mod/box/space.h b/mod/box/space.h index 8b7b46d08004238bc2afbcdec4f23717ba4ee69c..848c97ef4e79cb1abfa82580f3c465c5684a36db 100644 --- a/mod/box/space.h +++ b/mod/box/space.h @@ -89,11 +89,11 @@ space_n(struct space *sp) return sp - space; } -void space_validate(struct space *sp, struct box_tuple *old_tuple, - struct box_tuple *new_tuple); -void space_replace(struct space *sp, struct box_tuple *old_tuple, - struct box_tuple *new_tuple); -void space_remove(struct space *sp, struct box_tuple *tuple); +void space_validate(struct space *sp, struct tuple *old_tuple, + struct tuple *new_tuple); +void space_replace(struct space *sp, struct tuple *old_tuple, + struct tuple *new_tuple); +void space_remove(struct space *sp, struct tuple *tuple); /** Get key_def ordinal number. */ static inline int diff --git a/mod/box/space.m b/mod/box/space.m index a9bf0034bd7027689445870f190064dc88a450a7..eb5ad4948f915b026c3d4259ce9f45a099bec0a0 100644 --- a/mod/box/space.m +++ b/mod/box/space.m @@ -47,8 +47,8 @@ key_free(struct key_def *key_def) } void -space_replace(struct space *sp, struct box_tuple *old_tuple, - struct box_tuple *new_tuple) +space_replace(struct space *sp, struct tuple *old_tuple, + struct tuple *new_tuple) { int n = index_count(sp); for (int i = 0; i < n; i++) { @@ -58,8 +58,8 @@ space_replace(struct space *sp, struct box_tuple *old_tuple, } void -space_validate(struct space *sp, struct box_tuple *old_tuple, - struct box_tuple *new_tuple) +space_validate(struct space *sp, struct tuple *old_tuple, + struct tuple *new_tuple) { int n = index_count(sp); @@ -95,7 +95,7 @@ space_validate(struct space *sp, struct box_tuple *old_tuple, for (int i = 1; i < n; ++i) { Index *index = sp->index[i]; if (index->key_def->is_unique) { - struct box_tuple *tuple = [index findByTuple: new_tuple]; + struct tuple *tuple = [index findByTuple: new_tuple]; if (tuple != NULL && tuple != old_tuple) tnt_raise(ClientError, :ER_INDEX_VIOLATION); } @@ -103,7 +103,7 @@ space_validate(struct space *sp, struct box_tuple *old_tuple, } void -space_remove(struct space *sp, struct box_tuple *tuple) +space_remove(struct space *sp, struct tuple *tuple) { int n = index_count(sp); for (int i = 0; i < n; i++) { diff --git a/mod/box/tree.h b/mod/box/tree.h index b4580f75f6940fca61acd3981ede1da52144c294..0b62c2697fcc205b313037637292131f06cba339 100644 --- a/mod/box/tree.h +++ b/mod/box/tree.h @@ -48,8 +48,8 @@ typedef int (*tree_cmp_t)(const void *, const void *, void *); - (tree_cmp_t) node_cmp; - (tree_cmp_t) dup_node_cmp; - (tree_cmp_t) key_node_cmp; -- (void) fold: (void *) node :(struct box_tuple *) tuple; -- (struct box_tuple *) unfold: (const void *) node; +- (void) fold: (void *) node :(struct tuple *) tuple; +- (struct tuple *) unfold: (const void *) node; @end diff --git a/mod/box/tree.m b/mod/box/tree.m index 9ad7a70897308451c6d52cd932528ba5d9d0c77b..091dc9024c54fabea5d82ff87597bfb6a96ee1ca 100644 --- a/mod/box/tree.m +++ b/mod/box/tree.m @@ -53,7 +53,7 @@ u64_cmp(u64 a, u64 b) * Tuple address comparison. */ static inline int -ta_cmp(struct box_tuple *tuple_a, struct box_tuple *tuple_b) +ta_cmp(struct tuple *tuple_a, struct tuple *tuple_b) { if (!tuple_a) return 0; @@ -148,22 +148,22 @@ union sparse_part { */ struct sparse_node { - struct box_tuple *tuple; + struct tuple *tuple; union sparse_part parts[]; } __attribute__((packed)); struct dense_node { - struct box_tuple *tuple; + struct tuple *tuple; u32 offset; } __attribute__((packed)); struct num32_node { - struct box_tuple *tuple; + struct tuple *tuple; u32 value; } __attribute__((packed)); struct fixed_node { - struct box_tuple *tuple; + struct tuple *tuple; }; /** @@ -294,7 +294,7 @@ key_is_linear(struct key_def *key_def) * Find field offsets/values for a sparse node. */ static void -fold_with_sparse_parts(struct key_def *key_def, struct box_tuple *tuple, union sparse_part* parts) +fold_with_sparse_parts(struct key_def *key_def, struct tuple *tuple, union sparse_part* parts) { u8 *part_data = tuple->data; @@ -371,7 +371,7 @@ fold_with_key_parts(struct key_def *key_def, struct key_data *key_data) * Find the offset for a dense node. */ static u32 -fold_with_dense_offset(struct key_def *key_def, struct box_tuple *tuple) +fold_with_dense_offset(struct key_def *key_def, struct tuple *tuple) { u8 *tuple_data = tuple->data; @@ -396,7 +396,7 @@ fold_with_dense_offset(struct key_def *key_def, struct box_tuple *tuple) * Find the value for a num32 node. */ static u32 -fold_with_num32_value(struct key_def *key_def, struct box_tuple *tuple) +fold_with_num32_value(struct key_def *key_def, struct tuple *tuple) { u8 *tuple_data = tuple->data; @@ -466,9 +466,9 @@ sparse_part_compare(enum field_data_type type, */ static int sparse_node_compare(struct key_def *key_def, - struct box_tuple *tuple_a, + struct tuple *tuple_a, const union sparse_part* parts_a, - struct box_tuple *tuple_b, + struct tuple *tuple_b, const union sparse_part* parts_b) { for (int part = 0; part < key_def->part_count; ++part) { @@ -488,7 +488,7 @@ sparse_node_compare(struct key_def *key_def, static int sparse_key_node_compare(struct key_def *key_def, const struct key_data *key_data, - struct box_tuple *tuple, + struct tuple *tuple, const union sparse_part* parts) { int part_count = MIN(key_def->part_count, key_data->part_count); @@ -538,8 +538,8 @@ dense_part_compare(enum field_data_type type, */ static int dense_node_compare(struct key_def *key_def, u32 first_field, - struct box_tuple *tuple_a, u32 offset_a, - struct box_tuple *tuple_b, u32 offset_b) + struct tuple *tuple_a, u32 offset_a, + struct tuple *tuple_b, u32 offset_b) { int part_count = key_def->part_count; assert(first_field + part_count <= tuple_a->field_count); @@ -587,8 +587,8 @@ dense_node_compare(struct key_def *key_def, u32 first_field, static int linear_node_compare(struct key_def *key_def, u32 first_field __attribute__((unused)), - struct box_tuple *tuple_a, u32 offset_a, - struct box_tuple *tuple_b, u32 offset_b) + struct tuple *tuple_a, u32 offset_a, + struct tuple *tuple_b, u32 offset_b) { int part_count = key_def->part_count; assert(first_field + part_count <= tuple_a->field_count); @@ -658,7 +658,7 @@ dense_key_part_compare(enum field_data_type type, static int dense_key_node_compare(struct key_def *key_def, const struct key_data *key_data, - u32 first_field, struct box_tuple *tuple, u32 offset) + u32 first_field, struct tuple *tuple, u32 offset) { int part_count = key_def->part_count; assert(first_field + part_count <= tuple->field_count); @@ -703,7 +703,7 @@ static int linear_key_node_compare(struct key_def *key_def, const struct key_data *key_data, u32 first_field __attribute__((unused)), - struct box_tuple *tuple, u32 offset) + struct tuple *tuple, u32 offset) { int part_count = key_def->part_count; assert(first_field + part_count <= tuple->field_count); @@ -743,7 +743,7 @@ tree_iterator(struct iterator *it) return (struct tree_iterator *) it; } -static struct box_tuple * +static struct tuple * tree_iterator_next(struct iterator *iterator) { assert(iterator->next == tree_iterator_next); @@ -753,7 +753,7 @@ tree_iterator_next(struct iterator *iterator) return [it->index unfold: node]; } -static struct box_tuple * +static struct tuple * tree_iterator_reverse_next(struct iterator *iterator) { assert(iterator->next == tree_iterator_reverse_next); @@ -763,7 +763,7 @@ tree_iterator_reverse_next(struct iterator *iterator) return [it->index unfold: node]; } -static struct box_tuple * +static struct tuple * tree_iterator_next_equal(struct iterator *iterator) { assert(iterator->next == tree_iterator_next); @@ -778,7 +778,7 @@ tree_iterator_next_equal(struct iterator *iterator) return NULL; } -static struct box_tuple * +static struct tuple * tree_iterator_reverse_next_equal(struct iterator *iterator) { assert(iterator->next == tree_iterator_reverse_next); @@ -853,19 +853,19 @@ tree_iterator_free(struct iterator *iterator) return tree.size; } -- (struct box_tuple *) min +- (struct tuple *) min { void *node = sptree_index_first(&tree); return [self unfold: node]; } -- (struct box_tuple *) max +- (struct tuple *) max { void *node = sptree_index_last(&tree); return [self unfold: node]; } -- (struct box_tuple *) findUnsafe: (void *) key : (int) part_count +- (struct tuple *) findUnsafe: (void *) key : (int) part_count { struct key_data *key_data = alloca(sizeof(struct key_data) + @@ -879,7 +879,7 @@ tree_iterator_free(struct iterator *iterator) return [self unfold: node]; } -- (struct box_tuple *) findByTuple: (struct box_tuple *) tuple +- (struct tuple *) findByTuple: (struct tuple *) tuple { struct key_data *key_data = alloca(sizeof(struct key_data) + _SIZEOF_SPARSE_PARTS(tuple->field_count)); @@ -892,15 +892,15 @@ tree_iterator_free(struct iterator *iterator) return [self unfold: node]; } -- (void) remove: (struct box_tuple *) tuple +- (void) remove: (struct tuple *) tuple { void *node = alloca([self node_size]); [self fold: node :tuple]; sptree_index_delete(&tree, node); } -- (void) replace: (struct box_tuple *) old_tuple - : (struct box_tuple *) new_tuple +- (void) replace: (struct tuple *) old_tuple + : (struct tuple *) new_tuple { if (new_tuple->field_count < key_def->max_fieldno) tnt_raise(ClientError, :ER_NO_SUCH_FIELD, @@ -978,7 +978,7 @@ tree_iterator_free(struct iterator *iterator) struct iterator *it = pk->position; [pk initIterator: it :ITER_FORWARD]; - struct box_tuple *tuple; + struct tuple *tuple; for (u32 i = 0; (tuple = it->next(it)) != NULL; ++i) { void *node = ((u8 *) nodes + i * node_size); [self fold: node :tuple]; @@ -1021,14 +1021,14 @@ tree_iterator_free(struct iterator *iterator) return 0; } -- (void) fold: (void *) node :(struct box_tuple *) tuple +- (void) fold: (void *) node :(struct tuple *) tuple { (void) node; (void) tuple; [self subclassResponsibility: _cmd]; } -- (struct box_tuple *) unfold: (const void *) node +- (struct tuple *) unfold: (const void *) node { (void) node; [self subclassResponsibility: _cmd]; @@ -1099,14 +1099,14 @@ sparse_key_node_cmp(const void *key, const void *node, void *arg) return sparse_key_node_cmp; } -- (void) fold: (void *) node :(struct box_tuple *) tuple +- (void) fold: (void *) node :(struct tuple *) tuple { struct sparse_node *node_x = node; node_x->tuple = tuple; fold_with_sparse_parts(key_def, tuple, node_x->parts); } -- (struct box_tuple *) unfold: (const void *) node +- (struct tuple *) unfold: (const void *) node { const struct sparse_node *node_x = node; return node_x ? node_x->tuple : NULL; @@ -1222,14 +1222,14 @@ linear_dense_key_node_cmp(const void *key, const void * node, void *arg) return is_linear ? linear_dense_key_node_cmp : dense_key_node_cmp; } -- (void) fold: (void *) node :(struct box_tuple *) tuple +- (void) fold: (void *) node :(struct tuple *) tuple { struct dense_node *node_x = node; node_x->tuple = tuple; node_x->offset = fold_with_dense_offset(key_def, tuple); } -- (struct box_tuple *) unfold: (const void *) node +- (struct tuple *) unfold: (const void *) node { const struct dense_node *node_x = node; return node_x ? node_x->tuple : NULL; @@ -1296,14 +1296,14 @@ num32_key_node_cmp(const void * key, const void * node, void *arg) return num32_key_node_cmp; } -- (void) fold: (void *) node :(struct box_tuple *) tuple +- (void) fold: (void *) node :(struct tuple *) tuple { struct num32_node *node_x = (struct num32_node *) node; node_x->tuple = tuple; node_x->value = fold_with_num32_value(key_def, tuple); } -- (struct box_tuple *) unfold: (const void *) node +- (struct tuple *) unfold: (const void *) node { const struct num32_node *node_x = node; return node_x ? node_x->tuple : NULL; @@ -1421,13 +1421,13 @@ linear_fixed_key_node_cmp(const void *key, const void * node, void *arg) return is_linear ? linear_fixed_key_node_cmp : fixed_key_node_cmp; } -- (void) fold: (void *) node :(struct box_tuple *) tuple +- (void) fold: (void *) node :(struct tuple *) tuple { struct fixed_node *node_x = (struct fixed_node *) node; node_x->tuple = tuple; } -- (struct box_tuple *) unfold: (const void *) node +- (struct tuple *) unfold: (const void *) node { const struct fixed_node *node_x = node; return node_x ? node_x->tuple : NULL; diff --git a/mod/box/tuple.h b/mod/box/tuple.h index df5d8ad9e3788486d188289b3f3fe0883444ae34..0a32dac4161bcb9f47e0b434010bf7f3b206a134 100644 --- a/mod/box/tuple.h +++ b/mod/box/tuple.h @@ -36,7 +36,7 @@ struct tbuf; * An atom of Tarantool/Box storage. Consists of a list of fields. * The first field is always the primary key. */ -struct box_tuple +struct tuple { /** reference counter */ u16 refs; @@ -59,7 +59,7 @@ struct box_tuple * @param size tuple->bsize * @post tuple->refs = 1 */ -struct box_tuple * +struct tuple * tuple_alloc(size_t size); /** @@ -68,7 +68,7 @@ tuple_alloc(size_t size); * @pre tuple->refs + count >= 0 */ void -tuple_ref(struct box_tuple *tuple, int count); +tuple_ref(struct tuple *tuple, int count); /** * Get a field from tuple by index. @@ -76,7 +76,7 @@ tuple_ref(struct box_tuple *tuple, int count); * @returns field data if the field exists, or NULL */ void * -tuple_field(struct box_tuple *tuple, size_t i); +tuple_field(struct tuple *tuple, size_t i); /** * Print a tuple in yaml-compatible mode to tbuf: @@ -86,7 +86,7 @@ void tuple_print(struct tbuf *buf, uint8_t field_count, void *f); /** Tuple length when adding to iov. */ -static inline size_t tuple_len(struct box_tuple *tuple) +static inline size_t tuple_len(struct tuple *tuple) { return tuple->bsize + sizeof(tuple->bsize) + sizeof(tuple->field_count); diff --git a/mod/box/tuple.m b/mod/box/tuple.m index 225830e2e4b2cbaa8fdb78ef3e1426bce5f8e595..3ec2a45f0a47a8e05650749262ec3c51371d641f 100644 --- a/mod/box/tuple.m +++ b/mod/box/tuple.m @@ -35,11 +35,11 @@ #include "exception.h" /** Allocate a tuple */ -struct box_tuple * +struct tuple * tuple_alloc(size_t size) { - size_t total = sizeof(struct box_tuple) + size; - struct box_tuple *tuple = salloc(total, "tuple"); + size_t total = sizeof(struct tuple) + size; + struct tuple *tuple = salloc(total, "tuple"); tuple->flags = tuple->refs = 0; tuple->bsize = size; @@ -53,7 +53,7 @@ tuple_alloc(size_t size) * @pre tuple->refs == 0 */ static void -tuple_free(struct box_tuple *tuple) +tuple_free(struct tuple *tuple) { say_debug("tuple_free(%p)", tuple); assert(tuple->refs == 0); @@ -67,7 +67,7 @@ tuple_free(struct box_tuple *tuple) * @pre tuple->refs + count >= 0 */ void -tuple_ref(struct box_tuple *tuple, int count) +tuple_ref(struct tuple *tuple, int count) { assert(tuple->refs + count >= 0); tuple->refs += count; @@ -90,7 +90,7 @@ next_field(void *f) * @returns field data if field exists or NULL */ void * -tuple_field(struct box_tuple *tuple, size_t i) +tuple_field(struct tuple *tuple, size_t i) { void *field = tuple->data; diff --git a/mod/box/txn.h b/mod/box/txn.h index 5a8cac6cce7b8e7e5113351d067ce778e49c2f87..d6815c2daae2c3f4c0cca3ee207a15b40937e679 100644 --- a/mod/box/txn.h +++ b/mod/box/txn.h @@ -29,8 +29,8 @@ * SUCH DAMAGE. */ #include <fiber.h> -struct box_txn; -struct box_tuple; +struct txn; +struct tuple; /** tuple's flags */ enum tuple_flags { @@ -40,10 +40,10 @@ enum tuple_flags { GHOST = 0x2, }; -static inline struct box_txn *in_txn() { return fiber->mod_data.txn; } -struct box_txn *txn_begin(); -void txn_commit(struct box_txn *txn); -void txn_rollback(struct box_txn *txn); -void txn_ref_tuple(struct box_txn *txn, struct box_tuple *tuple); -void txn_lock_tuple(struct box_txn *txn, struct box_tuple *tuple); +static inline struct txn *in_txn() { return fiber->mod_data.txn; } +struct txn *txn_begin(); +void txn_commit(struct txn *txn); +void txn_rollback(struct txn *txn); +void txn_ref_tuple(struct txn *txn, struct tuple *tuple); +void txn_lock_tuple(struct txn *txn, struct tuple *tuple); #endif /* TARANTOOL_BOX_TXN_H_INCLUDED */ diff --git a/mod/box/txn.m b/mod/box/txn.m index 0fcc714a6a66b2a44a7a75adf30b1ce6afe7617a..2dde4f5edd15b595a07fb62d8748351b45f45a92 100644 --- a/mod/box/txn.m +++ b/mod/box/txn.m @@ -33,7 +33,7 @@ #include <log_io.h> void -txn_lock_tuple(struct box_txn *txn, struct box_tuple *tuple) +txn_lock_tuple(struct txn *txn, struct tuple *tuple) { if (tuple->flags & WAL_WAIT) tnt_raise(ClientError, :ER_TUPLE_IS_RO); @@ -44,7 +44,7 @@ txn_lock_tuple(struct box_txn *txn, struct box_tuple *tuple) } static void -unlock_tuples(struct box_txn *txn) +unlock_tuples(struct txn *txn) { if (txn->lock_tuple) { txn->lock_tuple->flags &= ~WAL_WAIT; @@ -53,15 +53,15 @@ unlock_tuples(struct box_txn *txn) } void -txn_ref_tuple(struct box_txn *txn, struct box_tuple *tuple) +txn_ref_tuple(struct txn *txn, struct tuple *tuple) { say_debug("txn_ref_tuple(%p)", tuple); - tbuf_append(txn->ref_tuples, &tuple, sizeof(struct box_tuple *)); + tbuf_append(txn->ref_tuples, &tuple, sizeof(struct tuple *)); tuple_ref(tuple, +1); } static void -commit_replace(struct box_txn *txn) +commit_replace(struct txn *txn) { if (txn->old_tuple != NULL) { space_replace(txn->space, txn->old_tuple, txn->new_tuple); @@ -75,7 +75,7 @@ commit_replace(struct box_txn *txn) } static void -rollback_replace(struct box_txn *txn) +rollback_replace(struct txn *txn) { say_debug("rollback_replace: txn->new_tuple:%p", txn->new_tuple); @@ -84,7 +84,7 @@ rollback_replace(struct box_txn *txn) } static void -commit_delete(struct box_txn *txn) +commit_delete(struct txn *txn) { if (txn->old_tuple) { space_remove(txn->space, txn->old_tuple); @@ -92,10 +92,10 @@ commit_delete(struct box_txn *txn) } } -struct box_txn * +struct txn * txn_begin() { - struct box_txn *txn = p0alloc(fiber->gc_pool, sizeof(*txn)); + struct txn *txn = p0alloc(fiber->gc_pool, sizeof(*txn)); txn->ref_tuples = tbuf_alloc(fiber->gc_pool); assert(fiber->mod_data.txn == NULL); fiber->mod_data.txn = txn; @@ -103,10 +103,10 @@ txn_begin() } static void -txn_cleanup(struct box_txn *txn) +txn_cleanup(struct txn *txn) { - struct box_tuple **tuple = txn->ref_tuples->data; - int i = txn->ref_tuples->size / sizeof(struct box_txn *); + struct tuple **tuple = txn->ref_tuples->data; + int i = txn->ref_tuples->size / sizeof(struct txn *); while (i-- > 0) { say_debug("tuple_txn_unref(%p)", *tuple); @@ -118,7 +118,7 @@ txn_cleanup(struct box_txn *txn) } void -txn_commit(struct box_txn *txn) +txn_commit(struct txn *txn) { assert(txn == in_txn()); assert(txn->type); @@ -161,7 +161,7 @@ txn_commit(struct box_txn *txn) } void -txn_rollback(struct box_txn *txn) +txn_rollback(struct txn *txn) { assert(txn == in_txn()); fiber->mod_data.txn = 0;