From 132eb3497cbd86748b1b2eaa410a77daef6f0414 Mon Sep 17 00:00:00 2001 From: Konstantin Osipov <kostja.osipov@gmail.com> Date: Thu, 15 Sep 2011 17:54:55 +0400 Subject: [PATCH] Namespace -> space rename: rename a few more entries. --- connector/php/README | 46 ++++++++++++++-------------- doc/box-protocol.txt | 26 ++++++++-------- doc/user/configuration-reference.xml | 2 +- doc/user/errcode.xml | 2 +- doc/user/namespace.xml | 4 +-- include/errcode.h | 4 +-- mod/box/box.h | 2 +- mod/box/box.lua | 20 ++++++------ mod/box/box.m | 18 +++++------ mod/box/box_lua.m | 2 +- mod/box/index.m | 2 +- mod/box/memcached.m | 2 +- test/box/sql.result | 6 ++-- test/lib/sql_ast.py | 20 ++++++------ 14 files changed, 78 insertions(+), 78 deletions(-) diff --git a/connector/php/README b/connector/php/README index f58281b9e9..9aeeca26ef 100644 --- a/connector/php/README +++ b/connector/php/README @@ -7,26 +7,26 @@ This module realise the binary protocol. The protocol description is https://git the experimental tarantool_box config: -namespace[0].enabled = 1 -namespace[0].index[0].type = "HASH" -namespace[0].index[0].unique = 1 -namespace[0].index[0].key_field[0].fieldno = 0 -namespace[0].index[0].key_field[0].type = "NUM" - -namespace[0].index[1].type = "TREE" -namespace[0].index[1].unique = 0 -namespace[0].index[1].key_field[0].fieldno = 1 -namespace[0].index[1].key_field[0].type = "STR" - -namespace[0].index[2].type = "TREE" -namespace[0].index[2].unique = 0 -namespace[0].index[2].key_field[0].fieldno = 1 -namespace[0].index[2].key_field[0].type = "STR" -namespace[0].index[2].key_field[1].fieldno = 2 -namespace[0].index[2].key_field[1].type = "STR" - - -namespace[0].index[3].type = "TREE" -namespace[0].index[3].unique = 0 -namespace[0].index[3].key_field[0].fieldno = 3 -namespace[0].index[3].key_field[0].type = "NUM" +space[0].enabled = 1 +space[0].index[0].type = "HASH" +space[0].index[0].unique = 1 +space[0].index[0].key_field[0].fieldno = 0 +space[0].index[0].key_field[0].type = "NUM" + +space[0].index[1].type = "TREE" +space[0].index[1].unique = 0 +space[0].index[1].key_field[0].fieldno = 1 +space[0].index[1].key_field[0].type = "STR" + +space[0].index[2].type = "TREE" +space[0].index[2].unique = 0 +space[0].index[2].key_field[0].fieldno = 1 +space[0].index[2].key_field[0].type = "STR" +space[0].index[2].key_field[1].fieldno = 2 +space[0].index[2].key_field[1].type = "STR" + + +space[0].index[3].type = "TREE" +space[0].index[3].unique = 0 +space[0].index[3].key_field[0].fieldno = 3 +space[0].index[3].key_field[0].type = "NUM" diff --git a/doc/box-protocol.txt b/doc/box-protocol.txt index a09f2c39d6..beaef8e46a 100644 --- a/doc/box-protocol.txt +++ b/doc/box-protocol.txt @@ -105,7 +105,7 @@ ; <select_request_body> (required <header> <type> is 17): ; -; Specify which namespace to query, which index in the namespace +; Specify which space to query, which index in the space ; to use, offset in the resulting tuple set (set to 0 for no offset), ; a limit (set to 4294967295 for no limit), and one or several ; keys to use in lookup. When more than one key is given, they @@ -115,18 +115,18 @@ ; must be non-zero. ; -<select_request_body> ::= <namespace_no><index_no> +<select_request_body> ::= <space_no><index_no> <offset><limit><count><tuple>+ -; Namespace number is a non-negative integer, starting from 0. -; All namespaces are defined in the server configuration file, +; Space number is a non-negative integer, starting from 0. +; All spaces are defined in the server configuration file, ; and then referred to by numeric id. -<namespace_no> ::= <int32> +<space_no> ::= <int32> ; Tarantool supports HASH and TREE indexes. Indexes are -; enumerated similarly to namespaces, starting from 0. -; Each namespace has at least index #0, which defines +; enumerated similarly to spaces, starting from 0. +; Each space has at least index #0, which defines ; the primary key. <index_no> ::= <int32> @@ -219,10 +219,10 @@ ; ; It is not possible to insert more than one tuple at a time. ; Thus <insert_request_body> (<header> <type> = 13) simply -; holds one tuple, and which namespace to put it into. +; holds one tuple, and which space to put it into. ; -<insert_request_body> ::= <namespace_no><flags><tuple> +<insert_request_body> ::= <space_no><flags><tuple> ; The only defined flag BOX_RETURN_TUPLE (0x01) indicates ; that it is required to return the inserted tuple back: @@ -237,7 +237,7 @@ <insert_response_body> ::= <count> | <count><fq_tuple> ; <update> request, <type> = 19 is similar to <insert>: -; - <namespace_no>: same as in <select> or <insert> +; - <space_no>: same as in <select> or <insert> ; - <flags>, <tuple>: same as in <insert> ; Index number for tuple lookup does not need to be provided, ; since only primary key updates are allowed. @@ -246,7 +246,7 @@ ; - <count> specifies possibly zero operation count ; -<update_request_body> ::= <namespace_no><flags><tuple><count><operation>+ +<update_request_body> ::= <space_no><flags><tuple><count><operation>+ ; ; Operations are optional and exist solely to allow @@ -310,7 +310,7 @@ ; primary key. ; -<delete_request_body> ::= <namespace_no><flags><tuple> +<delete_request_body> ::= <space_no><flags><tuple> ; ; <delete> returns the number of deleted tuples. @@ -322,7 +322,7 @@ <delete_response_body> ::= <count> | <count><fq_tuple> ; -; CALL request body contains <namespace_no>, <flags>, <proc_name> +; CALL request body contains <space_no>, <flags>, <proc_name> ; the number of procedure args, and the arguments themselves, ; which are passed into the procedure as Lua strings. ; diff --git a/doc/user/configuration-reference.xml b/doc/user/configuration-reference.xml index bca5dfe491..ffa201b0e4 100644 --- a/doc/user/configuration-reference.xml +++ b/doc/user/configuration-reference.xml @@ -810,7 +810,7 @@ tarantool_box: primary@sessions pri:33013 sec:33014 adm:33015</programlisting> <entry> <anchor xml:id="memcached_space" xreflabel="memcached_space"/> - Namespace id to store memcached data in. The + Space id to store memcached data in. The format of tuple is [key, metadata, value], with a HASH index based on the key. Since the space format is defined by Memcached data model, it must not be diff --git a/doc/user/errcode.xml b/doc/user/errcode.xml index 1e55adde5f..2246021fb3 100644 --- a/doc/user/errcode.xml +++ b/doc/user/errcode.xml @@ -56,7 +56,7 @@ of existing codes.</para> </varlistentry> <varlistentry> - <term xml:id="ER_NO_SUCH_NAMESPACE" xreflabel="ER_NO_SUCH_NAMESPACE">ER_NO_SUCH_NAMESPACE</term> + <term xml:id="ER_NO_SUCH_SPACE" xreflabel="ER_NO_SUCH_SPACE">ER_NO_SUCH_SPACE</term> <listitem><para>Attempt to access a space that is not configured (doesn't exist). </para></listitem> diff --git a/doc/user/namespace.xml b/doc/user/namespace.xml index 5584316745..9786984442 100644 --- a/doc/user/namespace.xml +++ b/doc/user/namespace.xml @@ -2,8 +2,8 @@ xmlns:xi="http://www.w3.org/2001/XInclude" xmlns:xlink="http://www.w3.org/1999/xlink" xml:id="space"> -<bridgehead>Namespace settings explained</bridgehead> -Namespace is a composite parameter, i.e. it has properties. +<bridgehead>Space settings explained</bridgehead> +Space is a composite parameter, i.e. it has properties. <programlisting language="cpp"> /* * Each tuple consists of fields. Three field types are diff --git a/include/errcode.h b/include/errcode.h index 42a64d5d1f..2cf11c6ad0 100644 --- a/include/errcode.h +++ b/include/errcode.h @@ -106,12 +106,12 @@ enum { TNT_ERRMSG_MAX = 512 }; /* 49 */_(ER_TUPLE_NOT_FOUND, 2, "Tuple doesn't exist") \ /* 50 */_(ER_NO_SUCH_PROC, 2, "Procedure %.*s is not defined") \ /* 51 */_(ER_PROC_LUA, 2, "Lua error: %s") \ - /* 52 */_(ER_NAMESPACE_DISABLED, 2, "Namespace %u is disabled") \ + /* 52 */_(ER_SPACE_DISABLED, 2, "Space %u is disabled") \ /* 53 */_(ER_NO_SUCH_INDEX, 2, "No index #%u is defined in space %u") \ /* 54 */_(ER_NO_SUCH_FIELD, 2, "Field %u was not found in the tuple") \ /* 55 */_(ER_TUPLE_FOUND, 2, "Tuple already exists") \ /* 56 */_(ER_INDEX_VIOLATION, 2, "Duplicate key exists in a unique index") \ - /* 57 */_(ER_NO_SUCH_NAMESPACE, 2, "Namespace %u does not exists") + /* 57 */_(ER_NO_SUCH_SPACE, 2, "Space %u does not exists") /* diff --git a/mod/box/box.h b/mod/box/box.h index aca891b5f4..89b5ca9198 100644 --- a/mod/box/box.h +++ b/mod/box/box.h @@ -39,7 +39,7 @@ struct index; enum { BOX_INDEX_MAX = 10, - BOX_NAMESPACE_MAX = 256, + BOX_SPACE_MAX = 256, }; struct space { diff --git a/mod/box/box.lua b/mod/box/box.lua index dc19c275a7..c0609d3163 100644 --- a/mod/box/box.lua +++ b/mod/box/box.lua @@ -1,11 +1,11 @@ -- -- -- -function box.select(namespace, index, ...) +function box.select(space, index, ...) key = {...} return select(2, -- skip the first return from select, number of tuples box.process(17, box.pack('iiiiii'..string.rep('p', #key), - namespace, + space, index, 0, -- offset 4294967295, -- limit @@ -17,41 +17,41 @@ end -- delete can be done only by the primary key, whose -- index is always 0. It doesn't accept compound keys -- -function box.delete(namespace, key) +function box.delete(space, key) return select(2, -- skip the first return, tuple count - box.process(21, box.pack('iiip', namespace, + box.process(21, box.pack('iiip', space, 1, -- flags, BOX_RETURN_TUPLE 1, -- cardinality key))) end -- insert or replace a tuple -function box.replace(namespace, ...) +function box.replace(space, ...) tuple = {...} return select(2, box.process(13, box.pack('iii'..string.rep('p', #tuple), - namespace, + space, 1, -- flags, BOX_RETURN_TUPLE #tuple, -- cardinality unpack(tuple)))) end -- insert a tuple (produces an error if the tuple already exists) -function box.insert(namespace, ...) +function box.insert(space, ...) tuple = {...} return select(2, box.process(13, box.pack('iii'..string.rep('p', #tuple), - namespace, + space, 3, -- flags, BOX_RETURN_TUPLE | BOX_ADD #tuple, -- cardinality unpack(tuple)))) end -function box.update(namespace, key, format, ...) +function box.update(space, key, format, ...) ops = {...} return select(2, box.process(19, box.pack('iiipi'..format, - namespace, + space, 1, -- flags, BOX_RETURN_TUPLE 1, -- cardinality key, -- primary key diff --git a/mod/box/box.m b/mod/box/box.m index ab029e71cc..787c38c530 100644 --- a/mod/box/box.m +++ b/mod/box/box.m @@ -606,13 +606,13 @@ void txn_assign_n(struct box_txn *txn, struct tbuf *data) { txn->n = read_u32(data); - if (txn->n < 0 || txn->n >= BOX_NAMESPACE_MAX) - tnt_raise(ClientError, :ER_NO_SUCH_NAMESPACE, txn->n); + if (txn->n < 0 || txn->n >= BOX_SPACE_MAX) + tnt_raise(ClientError, :ER_NO_SUCH_SPACE, txn->n); txn->space = &space[txn->n]; if (!txn->space->enabled) - tnt_raise(ClientError, :ER_NAMESPACE_DISABLED, txn->n); + tnt_raise(ClientError, :ER_SPACE_DISABLED, txn->n); txn->index = txn->space->index; } @@ -898,7 +898,7 @@ void space_free(void) { int i; - for (i = 0 ; i < BOX_NAMESPACE_MAX ; i++) { + for (i = 0 ; i < BOX_SPACE_MAX ; i++) { if (!space[i].enabled) continue; int j; @@ -916,8 +916,8 @@ space_free(void) void space_init(void) { - space = palloc(eter_pool, sizeof(struct space) * BOX_NAMESPACE_MAX); - for (int i = 0; i < BOX_NAMESPACE_MAX; i++) { + space = palloc(eter_pool, sizeof(struct space) * BOX_SPACE_MAX); + for (int i = 0; i < BOX_SPACE_MAX; i++) { space[i].enabled = false; for (int j = 0; j < BOX_INDEX_MAX; j++) { space[i].index[j].key_cardinality = 0; @@ -1207,7 +1207,7 @@ mod_check_config(struct tarantool_cfg *conf) } /* check space bound */ - if (i >= BOX_NAMESPACE_MAX) { + if (i >= BOX_SPACE_MAX) { /* maximum space is reached */ out_warning(0, "(space = %zu) " "too many spaces (%i maximum)", i, space); @@ -1215,7 +1215,7 @@ mod_check_config(struct tarantool_cfg *conf) } if (conf->memcached_port && i == conf->memcached_space) { - out_warning(0, "Namespace %i is already used as " + out_warning(0, "Space %i is already used as " "memcached_space.", i); return -1; } @@ -1466,7 +1466,7 @@ mod_snapshot(struct log_io_iter *i) { struct box_tuple *tuple; - for (uint32_t n = 0; n < BOX_NAMESPACE_MAX; ++n) { + for (uint32_t n = 0; n < BOX_SPACE_MAX; ++n) { if (!space[n].enabled) continue; diff --git a/mod/box/box_lua.m b/mod/box/box_lua.m index a2e361eb21..973bfd2d21 100644 --- a/mod/box/box_lua.m +++ b/mod/box/box_lua.m @@ -158,7 +158,7 @@ lbox_index_new(struct lua_State *L) int n = luaL_checkint(L, 1); /* get space id */ int idx = luaL_checkint(L, 2); /* get index id in */ /* locate the appropriate index */ - if (n >= BOX_NAMESPACE_MAX || !space[n].enabled || + if (n >= BOX_SPACE_MAX || !space[n].enabled || idx >= BOX_INDEX_MAX || space[n].index[idx].key_cardinality == 0) tnt_raise(LoggedError, :ER_NO_SUCH_INDEX, idx, n); /* create a userdata object */ diff --git a/mod/box/index.m b/mod/box/index.m index 3da51c3be2..25598f4af1 100644 --- a/mod/box/index.m +++ b/mod/box/index.m @@ -520,7 +520,7 @@ validate_indexes(struct box_txn *txn) void build_indexes(void) { - for (u32 n = 0; n < BOX_NAMESPACE_MAX; ++n) { + for (u32 n = 0; n < BOX_SPACE_MAX; ++n) { u32 n_tuples, estimated_tuples; struct index_tree_el *elems[nelem(space[n].index)] = { NULL }; diff --git a/mod/box/memcached.m b/mod/box/memcached.m index 753fad1e4b..972d62b881 100644 --- a/mod/box/memcached.m +++ b/mod/box/memcached.m @@ -381,7 +381,7 @@ memcached_check_config(struct tarantool_cfg *conf) /* check memcached space number: it shoud be in segment [0, max_space] */ if ((conf->memcached_space < 0) || - (conf->memcached_space > BOX_NAMESPACE_MAX)) { + (conf->memcached_space > BOX_SPACE_MAX)) { /* invalid space number */ out_warning(0, "invalid memcached space number: %i", conf->memcached_space); diff --git a/test/box/sql.result b/test/box/sql.result index e1d92964d4..f69d99d261 100644 --- a/test/box/sql.result +++ b/test/box/sql.result @@ -82,11 +82,11 @@ Found 1 tuple: # select * from t1 where k0 = 0 -An error occurred: ER_NAMESPACE_DISABLED, 'Namespace 1 is disabled�' +An error occurred: ER_SPACE_DISABLED, 'Space 1 is disabled�' select * from t65537 where k0 = 0 -An error occurred: ER_NO_SUCH_NAMESPACE, 'Namespace 65537 does not exists�' +An error occurred: ER_NO_SUCH_SPACE, 'Space 65537 does not exists�' select * from t4294967295 where k0 = 0 -An error occurred: ER_NO_SUCH_NAMESPACE, 'Namespace 4294967295 does not exists�' +An error occurred: ER_NO_SUCH_SPACE, 'Space 4294967295 does not exists�' # # A test case for: http://bugs.launchpad.net/bugs/735140 diff --git a/test/lib/sql_ast.py b/test/lib/sql_ast.py index 8a7538fc90..f57d14c60e 100644 --- a/test/lib/sql_ast.py +++ b/test/lib/sql_ast.py @@ -53,12 +53,12 @@ ER = { 49: "ER_TUPLE_NOT_FOUND" , 50: "ER_NO_SUCH_PROC" , 51: "ER_PROC_LUA" , - 52: "ER_NAMESPACE_DISABLED" , + 52: "ER_SPACE_DISABLED" , 53: "ER_NO_SUCH_INDEX" , 54: "ER_NO_SUCH_FIELD" , 55: "ER_TUPLE_FOUND" , 56: "ER_INDEX_VIOLATION" , - 57: "ER_NO_SUCH_NAMESPACE" + 57: "ER_NO_SUCH_SPACE" } @@ -186,14 +186,14 @@ class StatementInsert(StatementPing): reqeust_type = INSERT_REQUEST_TYPE def __init__(self, table_name, value_list): - self.namespace_no = table_name + self.space_no = table_name self.flags = 0 self.value_list = value_list def pack(self): buf = ctypes.create_string_buffer(PACKET_BUF_LEN) (buf, offset) = pack_tuple(self.value_list, buf, INSERT_REQUEST_FIXED_LEN) - struct.pack_into("<LL", buf, 0, self.namespace_no, self.flags) + struct.pack_into("<LL", buf, 0, self.space_no, self.flags) return buf[:offset] def unpack(self, response): @@ -208,7 +208,7 @@ class StatementUpdate(StatementPing): reqeust_type = UPDATE_REQUEST_TYPE def __init__(self, table_name, update_list, where): - self.namespace_no = table_name + self.space_no = table_name self.flags = 0 key_no = where[0] if key_no != 0: @@ -218,7 +218,7 @@ class StatementUpdate(StatementPing): def pack(self): buf = ctypes.create_string_buffer(PACKET_BUF_LEN) - struct.pack_into("<LL", buf, 0, self.namespace_no, self.flags) + struct.pack_into("<LL", buf, 0, self.space_no, self.flags) (buf, offset) = pack_tuple(self.value_list, buf, UPDATE_REQUEST_FIXED_LEN) (buf, offset) = pack_operation_list(self.update_list, buf, offset) return buf[:offset] @@ -234,7 +234,7 @@ class StatementDelete(StatementPing): reqeust_type = DELETE_REQUEST_TYPE def __init__(self, table_name, where): - self.namespace_no = table_name + self.space_no = table_name self.flags = 0 key_no = where[0] if key_no != 0: @@ -244,7 +244,7 @@ class StatementDelete(StatementPing): def pack(self): buf = ctypes.create_string_buffer(PACKET_BUF_LEN) (buf, offset) = pack_tuple(self.value_list, buf, DELETE_REQUEST_FIXED_LEN) - struct.pack_into("<LL", buf, 0, self.namespace_no, self.flags) + struct.pack_into("<LL", buf, 0, self.space_no, self.flags) return buf[:offset] def unpack(self, response): @@ -258,7 +258,7 @@ class StatementSelect(StatementPing): reqeust_type = SELECT_REQUEST_TYPE def __init__(self, table_name, where, limit): - self.namespace_no = table_name + self.space_no = table_name self.index_no = None self.key_list = [] if not where: @@ -277,7 +277,7 @@ class StatementSelect(StatementPing): def pack(self): buf = ctypes.create_string_buffer(PACKET_BUF_LEN) struct.pack_into("<LLLLL", buf, 0, - self.namespace_no, + self.space_no, self.index_no, self.offset, self.limit, -- GitLab