diff --git a/doc/sphinx/book/administration.rst b/doc/sphinx/book/administration.rst index 67bab6bac14621e8c7644c13006e872c2a3666fb..91c05dae6fc624f063177b988d8331de7b0b0786 100644 --- a/doc/sphinx/book/administration.rst +++ b/doc/sphinx/book/administration.rst @@ -19,7 +19,7 @@ The server processes these signals during the main thread event loop: SIGUSR1 may cause saving of a snapshot, see the description of - :func:`box.snapshot`. + :ref:`box.snapshot <admin-snapshot>`. SIGTERM may cause graceful shutdown (information will be saved first). @@ -60,7 +60,7 @@ A Tarantool server's process title has these components: - "orphan" (not in a cluster), - "hot_standby" (see section :ref:`local hot standby <book_cfg_local_hot_standby>`), or - "dumper" + process-id (saving a snapshot). -* **custom_proc_title** is taken from the :confval:`custom_proc_title` configuration parameter, if one was specified. +* **custom_proc_title** is taken from the :ref:`custom_proc_title <cfg_basic-custom_proc_title>` configuration parameter, if one was specified. For example: @@ -79,7 +79,7 @@ For example: .. program:: tarantool If ``tarantool`` is started without an :ref:`initialization file <init-label>`, -or if the initialization file contains :func:`console.start()`, then ``tarantool`` +or if the initialization file contains :ref:`console.start() <console-start>`, then ``tarantool`` enters interactive mode. There will be a prompt ("``tarantool>``") and it will be possible to enter requests. When used this way, ``tarantool`` can be a client for a remote server. @@ -1155,7 +1155,7 @@ writes are complete (fsync can be used for this purpose). |br| (2) If this is a backup of the whole database, say :codenormal:`box.snapshot()`. |br| (3) Use tar to make a (possibly compressed) copy of the -latest .snap and .xlog files on the :ref:`snap_dir <box-cfg-snap-dir>` and :ref:`wal_dir <box-cfg-wal-dir>` +latest .snap and .xlog files on the :ref:`snap_dir <cfg_basic-snap_dir>` and :ref:`wal_dir <cfg_basic-wal_dir>` directories. |br| (4) If there is a security policy, encrypt the tar file. |br| (5) Copy the tar file to a safe place. |br| @@ -1191,7 +1191,7 @@ changes occur, so that only the new files need to be copied. One such utility is `tarantar <https://github.com/tarantool/tarantool/wiki/Tarantar>`_ but it will require some modifications to work with the latest -Tarantool version. Setting the :ref:`rows_per_wal <box-cfg-rows-per-wal>` configuration +Tarantool version. Setting the :ref:`rows_per_wal <cfg_binary_logging_snapshots-rows_per_wal>` configuration parameter is another option. Note re storage engines: diff --git a/doc/sphinx/book/app/a_errcodes.rst b/doc/sphinx/book/app/a_errcodes.rst index 3eedcd21a697c2ce884264254610b7188ae17542..c1ba07d0616bc46e20eebd385f097abcec8d53c5 100644 --- a/doc/sphinx/book/app/a_errcodes.rst +++ b/doc/sphinx/book/app/a_errcodes.rst @@ -18,40 +18,40 @@ descriptions of some popular codes. A complete list of errors can be found in fi .. rst-class:: left-align-column-1 .. rst-class:: left-align-column-2 - +-------------------+-------------------------------------------+ - | ER_NONMASTER | Can't modify data on a replication slave. | - +-------------------+-------------------------------------------+ - | ER_ILLEGAL_PARAMS | Illegal parameters. Malformed protocol | - | | message. | - +-------------------+-------------------------------------------+ - | ER_MEMORY_ISSUE | Out of memory: | - | | :confval:`slab_alloc_arena` | - | | limit has been reached. | - +-------------------+-------------------------------------------+ - | ER_WAL_IO | Failed to write to disk. May mean: failed | - | | to record a change in the | - | | write-ahead log. Some sort of disk error. | - +-------------------+-------------------------------------------+ - | ER_KEY_PART_COUNT | Key part count is not the same as | - | | index part count | - +-------------------+-------------------------------------------+ - | ER_NO_SUCH_SPACE | The specified space does not exist. | - | | | - +-------------------+-------------------------------------------+ - | ER_NO_SUCH_INDEX | The specified index in the specified | - | | space does not exist. | - +-------------------+-------------------------------------------+ - | ER_PROC_LUA | An error occurred inside a Lua procedure. | - | | | - +-------------------+-------------------------------------------+ - | ER_FIBER_STACK | The recursion limit was reached when | - | | creating a new fiber. This usually | - | | indicates that a stored procedure is | - | | recursively invoking itself too often. | - +-------------------+-------------------------------------------+ - | ER_UPDATE_FIELD | An error occurred during update of a | - | | field. | - +-------------------+-------------------------------------------+ - | ER_TUPLE_FOUND | A duplicate key exists in a unique | - | | index. | - +-------------------+-------------------------------------------+ \ No newline at end of file + +-------------------+--------------------------------------------------------+ + | ER_NONMASTER | Can't modify data on a replication slave. | + +-------------------+--------------------------------------------------------+ + | ER_ILLEGAL_PARAMS | Illegal parameters. Malformed protocol | + | | message. | + +-------------------+--------------------------------------------------------+ + | ER_MEMORY_ISSUE | Out of memory: | + | | :ref:`slab_alloc_arena <cfg_storage-slab_alloc_arena>` | + | | limit has been reached. | + +-------------------+--------------------------------------------------------+ + | ER_WAL_IO | Failed to write to disk. May mean: failed | + | | to record a change in the | + | | write-ahead log. Some sort of disk error. | + +-------------------+--------------------------------------------------------+ + | ER_KEY_PART_COUNT | Key part count is not the same as | + | | index part count | + +-------------------+--------------------------------------------------------+ + | ER_NO_SUCH_SPACE | The specified space does not exist. | + | | | + +-------------------+--------------------------------------------------------+ + | ER_NO_SUCH_INDEX | The specified index in the specified | + | | space does not exist. | + +-------------------+--------------------------------------------------------+ + | ER_PROC_LUA | An error occurred inside a Lua procedure. | + | | | + +-------------------+--------------------------------------------------------+ + | ER_FIBER_STACK | The recursion limit was reached when | + | | creating a new fiber. This usually | + | | indicates that a stored procedure is | + | | recursively invoking itself too often. | + +-------------------+--------------------------------------------------------+ + | ER_UPDATE_FIELD | An error occurred during update of a | + | | field. | + +-------------------+--------------------------------------------------------+ + | ER_TUPLE_FOUND | A duplicate key exists in a unique | + | | index. | + +-------------------+--------------------------------------------------------+ \ No newline at end of file diff --git a/doc/sphinx/book/app/b_internals.rst b/doc/sphinx/book/app/b_internals.rst index 3ca52472fcc1152fe24ef9016f2b554f434a8112..64945ba891de6a2b8b2ad7aecaa5a024e87d4517 100644 --- a/doc/sphinx/book/app/b_internals.rst +++ b/doc/sphinx/book/app/b_internals.rst @@ -15,8 +15,8 @@ Data persistence and the WAL file format To maintain data persistence, Tarantool writes each data change request (INSERT, UPDATE, DELETE, REPLACE) into a write-ahead log (WAL) file in the -:confval:`wal_dir <wal_dir>` directory. A new WAL file is created for every -:confval:`rows_per_wal <rows_per_wal>` records. Each data change request gets +:ref:`wal_dir <cfg_basic-wal_dir>` directory. A new WAL file is created for every +:ref:`rows_per_wal <cfg_binary_logging_snapshots-rows_per_wal>` records. Each data change request gets assigned a continuously growing 64-bit log sequence number. The name of the WAL file is based on the log sequence number of the first record in the file, plus an extension ``.xlog``. @@ -94,10 +94,10 @@ particular, SELECT performance, even for SELECTs running on a connection packed with UPDATEs and DELETEs, remains unaffected by disk load. The WAL writer employs a number of durability modes, as defined in configuration -variable :confval:`wal_mode <wal_mode>`. It is possible to turn the write-ahead -log completely off, by setting :confval:`wal_mode <wal_mode>` to *none*. Even +variable :ref:`wal_mode <wal_mode>`. It is possible to turn the write-ahead +log completely off, by setting :ref:`wal_mode <cfg_binary_logging_snapshots-wal_mode>` to *none*. Even without the write-ahead log it's still possible to take a persistent copy of the -entire data set with the :func:`box.snapshot() <box.snapshot()>` request. +entire data set with the :ref:`box.snapshot() <admin-snapshot>` request. An .xlog file always contains changes based on the primary key. Even if the client requested an update or delete using @@ -142,9 +142,10 @@ as the snapshot file.) Step 1 Read the configuration parameters in the ``box.cfg{}`` request. - Parameters which affect recovery may include :confval:`work_dir`, - :confval:`wal_dir`, :confval:`snap_dir`, :confval:`sophia_dir`, - :confval:`panic_on_snap_error`, and :confval:`panic_on_wal_error`. + Parameters which affect recovery may include :ref:`work_dir <cfg_basic-work_dir>`, + :ref:`wal_dir <cfg_basic-wal_dir>`, :ref:`snap_dir <cfg_basic-snap_dir>`, :ref:`sophia_dir <cfg_basic-sophia_dir>`, + :ref:`panic_on_snap_error <cfg_binary_logging_snapshots-panic_on_snap_error>`, + and :ref:`panic_on_wal_error <cfg_binary_logging_snapshots-panic_on_wal_error>`. Step 2 Find the latest snapshot file. Use its data to reconstruct the in-memory @@ -190,7 +191,7 @@ additional steps and precautions if :ref:`replication <box-replication>` is enabled. Once again the startup procedure is initiated by the ``box.cfg{}`` request. -One of the box.cfg parameters may be :confval:`replication_source`. We will +One of the box.cfg parameters may be :ref:`replication_source <cfg_replication-replication_source>`. We will refer to this server, which is starting up due to box.cfg, as the "local" server to distinguish it from the other servers in a cluster, which we will refer to as "distant" servers. diff --git a/doc/sphinx/book/app/c_lua_tutorial.rst b/doc/sphinx/book/app/c_lua_tutorial.rst index 56727a9c66e2e46d5415f8688a7167f55a8fc666..e7058fe75503fc99bb638018245c1973b847f0ac 100644 --- a/doc/sphinx/book/app/c_lua_tutorial.rst +++ b/doc/sphinx/book/app/c_lua_tutorial.rst @@ -275,7 +275,7 @@ The first field is numeric: 1. The second field is a random string. Once again the ``string_function()`` can be invoked from ``main_function()`` which can be invoked with ``main_function()``. -For more about Tarantool tuples see Tarantool manual section :mod:`Package box.tuple <box.tuple>`. +For more about Tarantool tuples see Tarantool manual section :ref:`Package box.tuple <box_tuple>`. The screen now looks like this: @@ -333,7 +333,7 @@ a SELECT request. box.space.tester:select{1} For more about Tarantool insert and replace calls, see Tarantool manual section -:mod:`Package box.space <box.space>`. +:ref:`Package box.space <box_space>`. The screen now looks like this: @@ -473,7 +473,7 @@ procedures in some SQL DBMSs), and that it's straightforward to combine Lua-library functions and Tarantool-library functions. What has also been shown is that inserting a million tuples took 37 seconds. The -host computer was a Linux laptop. By changing :confval:`wal_mode <wal_mode>` to 'none' before +host computer was a Linux laptop. By changing :ref:`wal_mode <cfg_binary_logging_snapshots-wal_mode>` to 'none' before running the test, one can reduce the elapsed time to 4 seconds. .. _tutorial-sum-a-json-field: @@ -513,7 +513,7 @@ undeclared variable is "global". That's not desirable for any of the variables that are declared in line 1, because all of them are for use only within the function. **LINE 5: WHY "PAIRS()".** Our job is to go through all the rows and there are two -ways to do it: with :func:`box.space.space_object:pairs() <space_object.pairs>` or with +ways to do it: with :ref:`box.space.space_object:pairs() <box_space-pairs>` or with ``variable = select(...)`` followed by :samp:`for i, {n}, 1 do {some-function}(variable[i]) end`. We preferred ``pairs()`` for this example. @@ -528,7 +528,7 @@ JSON string - a missing colon, for example. By putting the function inside "``pc there's a problem just set ``is_valid_json = false`` and we will know what to do about it later. -**LINE 6: MEANING.** The function is :func:`json.decode` which means decode a JSON +**LINE 6: MEANING.** The function is :ref:`json.decode <json-decode>` which means decode a JSON string, and the parameter is t[2] which is a reference to a JSON string. There's a bit of hard coding here, we're assuming that the second field in the tuple is where the JSON string was inserted. For example, we're assuming a tuple looks like diff --git a/doc/sphinx/book/box/admin.rst b/doc/sphinx/book/box/admin.rst index c2accd3f1c6e97fa1ecd09991fa3175b4b860d7f..d54f78d64c48b89aad828e144d694e8f455406cf 100644 --- a/doc/sphinx/book/box/admin.rst +++ b/doc/sphinx/book/box/admin.rst @@ -5,9 +5,11 @@ To learn which functions are considered to be administrative, type ``help()``. A reference description also follows below: +.. _admin-snapshot: + .. function:: box.snapshot() - Take a snapshot of all data and store it in :confval:`snap_dir`:samp:`/{<latest-lsn>}.snap`. + Take a snapshot of all data and store it in :ref:`snap_dir <cfg_basic-snap_dir>`:samp:`/{<latest-lsn>}.snap`. To take a snapshot, Tarantool first enters the delayed garbage collection mode for all data. In this mode, tuples which were allocated before the snapshot has started are not freed until the snapshot has finished. To @@ -24,7 +26,7 @@ A reference description also follows below: saved in a matter of minutes. Note: as long as there are any changes to the parent index memory through concurrent updates, there are going to be page splits, and therefore one needs to have some extra free memory to run - this command. 10% of :confval:`slab_alloc_arena` is, on average, sufficient. + this command. 10% of :ref:`slab_alloc_arena <cfg_storage-slab_alloc_arena>` is, on average, sufficient. This statement waits until a snapshot is taken and returns operation result. Change Notice: prior to Tarantool version 1.6.6, the snapshot process caused diff --git a/doc/sphinx/book/box/atomic.rst b/doc/sphinx/book/box/atomic.rst index a70592439f8e6fba9163277201afc2322f8dd121..72a72ef52e81e4e4ca52a623a32b85c9202c8870 100644 --- a/doc/sphinx/book/box/atomic.rst +++ b/doc/sphinx/book/box/atomic.rst @@ -36,10 +36,10 @@ scheduling, when a single client throttles the rest of the system, or to apparent stalls in request processing. Avoiding this situation is the responsibility of the function's author. For the default memtx storage engine some of the box calls, including the data-change requests -:func:`box.space...insert <space_object.insert>` or -:func:`box.space...update <space_object.update>` or -:func:`box.space...delete <space_object.delete>`, will usually cause yielding; -however, :func:`box.space...select <space_object.select>` will not. +:ref:`box.space...insert <box_space-insert>` or +:ref:`box.space...update <box_space-update>` or +:ref:`box.space...delete <box_space-delete>`, will usually cause yielding; +however, :ref:`box.space...select <box_space-select>` will not. A fuller description will appear in section :ref:`The Implicit Yield Rules <the-implicit-yield-rules>`. Note re storage engine: sophia has different rules: insert or update or delete @@ -128,15 +128,15 @@ but many other requests "imply" yields because Tarantool is designed to avoid blocking. The implicit yield requests are: -:ref:`insert <space_insert>` :ref:`replace <space_replace>` -:ref:`update <space_update>` :ref:`upsert <space_update>` :ref:`delete <space_delete>` (the "data-change" requests), +:ref:`insert <box_space-insert>` :ref:`replace <box_space-replace>` +:ref:`update <box_space-update>` :ref:`upsert <box_space-upsert>` :ref:`delete <box_space-delete>` (the "data-change" requests), and functions in package :ref:`fio <fio-section>`, :ref:`net_box <package_net_box>`, :ref:`console <package-console>`, or :ref:`socket <package-socket>` (the "os" and "network" requests). -Note re storage engine: with sophia :ref:`select <space-select>` is +Note re storage engine: with sophia :ref:`select <box_space-select>` is an implicit yield request, but data-change requests may not be. The yield occurs just before a blocking syscall, such as a write to the Write-Ahead Log (WAL) @@ -156,13 +156,13 @@ The commit request is not itself an implicit yield request, it only enables yields caused by earlier implicit yield requests. Despite their resemblance to implicit yield requests, -:ref:`truncate <space_truncate>` and :ref:`drop <space_drop>` do not cause implicit yield. +:ref:`truncate <box_space-truncate>` and :ref:`drop <box_space-drop>` do not cause implicit yield. Despite their resemblance to functions of the fio package, functions of the :ref:`os <package-os>` package do not cause implicit yield. Despite its resemblance to commit, :ref:`rollback <box-rollback>` does not enable yields. -If :ref:`wal_mode <confval-wal-mode>` = 'none', then implicit yielding is disabled, +If :ref:`wal_mode <cfg_binary_logging_snapshots-wal_mode>` = 'none', then implicit yielding is disabled, because there are no writes to the WAL. If a task is interactive -- sending requests to the server diff --git a/doc/sphinx/book/box/box_index.rst b/doc/sphinx/book/box/box_index.rst index 332f5ab09a23d915fce256fc718a33729ee50db6..02d6112a2c48fcc5f72e41628c80808f779a28a8 100644 --- a/doc/sphinx/book/box/box_index.rst +++ b/doc/sphinx/book/box/box_index.rst @@ -79,7 +79,7 @@ API is a direct binding to corresponding methods of index objects of type there is a "context switch": which may happen due to :ref:`the-implicit-yield-rules <the-implicit-yield-rules>`, or by an - explicit call to :func:`fiber.yield`. When the execution flow returns + explicit call to :ref:`fiber.yield <fiber-yield>`. When the execution flow returns to the yielded procedure, the data set could have changed significantly. Iteration, resumed after a yield point, does not preserve the read view, but continues with the new content of the database. @@ -388,7 +388,7 @@ API is a direct binding to corresponding methods of index objects of type .. method:: select(key, options) - This is an alternative to :func:`box.space...select() <space_object.select>` + This is an alternative to :ref:`box.space...select() <box_space-select>` which goes via a particular index and can make use of additional parameters that specify the iterator type, and the limit (that is, the maximum number of tuples to return) and the offset (that is, which @@ -652,7 +652,7 @@ API is a direct binding to corresponding methods of index objects of type Update a tuple. - Same as :func:`box.space...update() <space_object.update>`, + Same as :ref:`box.space...update() <box_space-update>`, but key is searched in this index instead of primary key. This index ought to be unique. @@ -662,7 +662,7 @@ API is a direct binding to corresponding methods of index objects of type * :samp:`{key}` (type = Lua table or scalar) = key to be matched against the index key; * :samp:`{operator, field_no, value}` (type = Lua table) = update - operations (see: :func:`box.space...update() <space_object.update>`). + operations (see: :ref:`box.space...update() <box_space-update>`). :return: the updated tuple. :rtype: tuple @@ -671,7 +671,7 @@ API is a direct binding to corresponding methods of index objects of type Delete a tuple identified by a key. - Same as :func:`box.space...delete() <space_object.delete>`, but key is + Same as :ref:`box.space...delete() <box_space-delete>`, but key is searched in this index instead of in the primary-key index. This index ought to be unique. @@ -694,7 +694,7 @@ API is a direct binding to corresponding methods of index objects of type * :samp:`{index_object}` = an :ref:`object reference <object-reference>`; * :samp:`{options}` = options list, same as the options list for - :func:`create_index <space_object.create_index>`. + :ref:`create_index <box_space-create_index>`. :return: nil @@ -787,9 +787,9 @@ function will: * Return the formatted value. The function uses Tarantool box functions -:func:`box.space...select <space_object.select>`, -:func:`box.space...replace <space_object.replace>`, :func:`fiber.time`, -:func:`uuid.str`. The function uses +:ref:`box.space...select <box_space-select>`, +:ref:`box.space...replace <box_space-replace>`, :ref:`fiber.time <fiber-time>`, +:ref:`uuid.str <uuid-str>`. The function uses Lua functions `os.date()`_ and `string.sub()`_. .. _os.date(): http://www.lua.org/pil/22.1.html @@ -888,7 +888,7 @@ additional criteria. Package `box.index` with index type = RTREE for spatial searches ============================================================================= -The :mod:`box.index` package may be used for spatial searches if the index type +The :ref:`box.index <box_index>` package may be used for spatial searches if the index type is RTREE. There are operations for searching *rectangles* (geometric objects with 4 corners and 4 sides) and *boxes* (geometric objects with more than 4 corners and more than 4 sides, sometimes called hyperrectangles). This manual diff --git a/doc/sphinx/book/box/box_introspection.rst b/doc/sphinx/book/box/box_introspection.rst index 122c36b23fa5cbddd03bcd0405c680676ae9dcfa..29233dd9a4ccb32f86ced1ec5a885fc9ad162d58 100644 --- a/doc/sphinx/book/box/box_introspection.rst +++ b/doc/sphinx/book/box/box_introspection.rst @@ -2,6 +2,8 @@ Server introspection ------------------------------------------------------------------------------- +.. _box_introspection-box_cfg: + ===================================================================== Package `box.cfg` ===================================================================== @@ -37,13 +39,15 @@ The ``box.info`` package provides access to information about server variables. Some important ones: * **server.uuid** holds the unique identifier of the server. This value is also - in the :data:`box.space._cluster` system space. + in the :ref:`box.space._cluster <box_space-cluster>` system space. * **pid** is the process ID of the server. This value is also shown by the :ref:`tarantool <tarantool-build>` package. * **version** is the Tarantool version. This value is also shown by :ref:`tarantool --version <tarantool-version>`. * **uptime** is the number of seconds since the server started. +.. _box_introspection-box_info: + .. function:: box.info() Since ``box.info`` contents are dynamic, it's not possible to iterate over @@ -109,7 +113,7 @@ so bytes_used = 1024); there is 1 item stored in the 136-byte slab the bytes_used values (1024+136 = 1160); the arena_size value is the arena_used value plus the total of all the bytes_free values (1160+4193200+4194088 = 8388448). The arena_size and arena_used values are the amount of the % of -:confval:`slab_alloc_arena` that is already distributed to the slab allocator. +:ref:`slab_alloc_arena <cfg_storage-slab_alloc_arena>` that is already distributed to the slab allocator. **Example:** diff --git a/doc/sphinx/book/box/box_schema.rst b/doc/sphinx/book/box/box_schema.rst index 73ae8be55bca4a0d5d8ec08399959d7ac3fca7ce..fa14eb79745a8fba2b0a02115174f6610f8fa2fe 100644 --- a/doc/sphinx/book/box/box_schema.rst +++ b/doc/sphinx/book/box/box_schema.rst @@ -9,7 +9,7 @@ The ``box.schema`` package has data-definition functions for spaces, users, roles, and function tuples. -.. _schema-space-create: +.. _box_schema-space_create: .. function:: box.schema.space.create(space-name [, {options} ]) @@ -58,7 +58,7 @@ for spaces, users, roles, and function tuples. space objects, for example :samp:`box.schema.space.drop({space-id})` will drop a space. However, the common approach is to use functions attached to the space objects, for example - :func:`space_object:drop() <space_object.drop>`. + :ref:`space_object:drop() <box_space-drop>`. Note re storage engine: sophia does not support temporary spaces. @@ -83,11 +83,11 @@ for spaces, users, roles, and function tuples. > }) For an illustration with the :code:`format` clause, see -:data:`box.space._space <box.space._space>` example. +:ref:`box.space._space <box_space-space>` example. After a space is created, usually the next step is to -:func:`create an index <space_object.create_index>` for it, and then it is -available for insert, select, and all the other :mod:`box.space` functions. +:ref:`create an index <box_space-create_index>` for it, and then it is +available for insert, select, and all the other :ref:`box.space <box_space>` functions. .. function:: box.schema.user.create(user-name [, {options} ]) diff --git a/doc/sphinx/book/box/box_session.rst b/doc/sphinx/book/box/box_session.rst index 1c1a3ea0e2959616e2ec5417a9a0351d05d7dd28..a8a1159b7e0ce707fb2e658470b2f7a2cc3e1fad 100644 --- a/doc/sphinx/book/box/box_session.rst +++ b/doc/sphinx/book/box/box_session.rst @@ -45,6 +45,8 @@ client connection. :rtype: number +.. _box_session-storage: + .. data:: storage A Lua table that can hold arbitrary unordered session-specific diff --git a/doc/sphinx/book/box/box_space.rst b/doc/sphinx/book/box/box_space.rst index 9dc2b7df86af542e26f15fd22c0d5901b02f3252..39fdd07a3b6806db26e2cfab8cb4317bfbc2f864 100644 --- a/doc/sphinx/book/box/box_space.rst +++ b/doc/sphinx/book/box/box_space.rst @@ -1,3 +1,5 @@ +.. _box_space: + ------------------------------------------------------------------------------- Package `box.space` ------------------------------------------------------------------------------- @@ -21,90 +23,99 @@ A list of all ``box.space`` functions follows, then comes a list of all +--------------------------------------+---------------------------------+ | Name | Use | +======================================+=================================+ - | :func:`space_object:create_index() | Create an index | - | <space_object.create_index>` | | + | :ref:`space_object:create_index() | Create an index | + | <box_space-create_index>` | | +--------------------------------------+---------------------------------+ - | :func:`space_object:insert() | Insert a tuple | - | <space_object.insert>` | | + | :ref:`space_object:insert() | Insert a tuple | + | <box_space-insert>` | | +--------------------------------------+---------------------------------+ - | :func:`space_object:select() | Select one or more tuples | - | <space_object.select>` | | + | :ref:`space_object:select() | Select one or more tuples | + | <box_space-select>` | | +--------------------------------------+---------------------------------+ - | :func:`space_object:get() | Select a tuple | - | <space_object.get>` | | + | :ref:`space_object:get() | Select a tuple | + | <box_space-get>` | | +--------------------------------------+---------------------------------+ - | :func:`space_object:drop() | Destroy a space | - | <space_object.drop>` | | + | :ref:`space_object:drop() | Destroy a space | + | <box_space-drop>` | | +--------------------------------------+---------------------------------+ - | :func:`space_object:rename() | Rename a space | - | <space_object.rename>` | | + | :ref:`space_object:rename() | Rename a space | + | <box_space-rename>` | | +--------------------------------------+---------------------------------+ - | :func:`space_object:replace() | Insert or replace a tuple | - | <space_object.replace>` | | + | :ref:`space_object:replace() | Insert or replace a tuple | + | <box_space-replace>` | | +--------------------------------------+---------------------------------+ - | :func:`space_object:put() | Insert or replace a tuple | - | <space_object.replace>` | | + | :ref:`space_object:put() | Insert or replace a tuple | + | <box_space-replace>` | | +--------------------------------------+---------------------------------+ - | :func:`space_object:update() | Update a tuple | - | <space_object.update>` | | + | :ref:`space_object:update() | Update a tuple | + | <box_space-update>` | | +--------------------------------------+---------------------------------+ - | :func:`space_object:upsert() | Update a tuple | - | <space_object.upsert>` | | + | :ref:`space_object:upsert() | Update a tuple | + | <box_space-upsert>` | | +--------------------------------------+---------------------------------+ - | :func:`space_object:delete() | Delete a tuple | - | <space_object.delete>` | | + | :ref:`space_object:delete() | Delete a tuple | + | <box_space-delete>` | | +--------------------------------------+---------------------------------+ - | :func:`space_object:count() | Get count of tuples | - | <space_object.count>` | | + | :ref:`space_object:count() | Get count of tuples | + | <box_space-count>` | | +--------------------------------------+---------------------------------+ - | :func:`space_object:len() | Get count of tuples | - | <space_object.len>` | | + | :ref:`space_object:len() | Get count of tuples | + | <box_space-len>` | | +--------------------------------------+---------------------------------+ - | :func:`space_object:truncate() | Delete all tuples | - | <space_object.truncate>` | | + | :ref:`space_object:truncate() | Delete all tuples | + | <box_space-truncate>` | | +--------------------------------------+---------------------------------+ - | :func:`space_object:inc() | Increment a tuple's counter | - | <space_object.inc>` | | + | :ref:`space_object:inc() | Increment a tuple's counter | + | <box_space-inc>` | | +--------------------------------------+---------------------------------+ - | :func:`space_object:dec() | Decrement a tuple's counter | - | <space_object.dec>` | | + | :ref:`space_object:dec() | Decrement a tuple's counter | + | <box_space-dec>` | | +--------------------------------------+---------------------------------+ - | :func:`space_object:auto_increment() | Generate key + Insert a tuple | - | <space_object.auto_increment>` | | + | :ref:`space_object:auto_increment() | Generate key + Insert a tuple | + | <box_space-auto_increment>` | | +--------------------------------------+---------------------------------+ - | :func:`space_object:pairs() | Prepare for iterating | - | <space_object.pairs>` | | + | :ref:`space_object:pairs() | Prepare for iterating | + | <box_space-pairs>` | | +--------------------------------------+---------------------------------+ - | :func:`space_object.id | .Numeric identifier of space | - | <space_object.id>` | | + | :ref:`space_object.id | .Numeric identifier of space | + | <box_space-id>` | | +--------------------------------------+---------------------------------+ - | :func:`space_object.enabled | .Flag, true if space is enabled | - | <space_object.enabled>` | | + | :ref:`space_object.enabled | .Flag, true if space is enabled | + | <box_space-enabled>` | | +--------------------------------------+---------------------------------+ - | :func:`space_object.field_count | .Required number of fields | - | <space_object.field_count>` | | + | :ref:`space_object.field_count | .Required number of fields | + | <box_space-field_count>` | | +--------------------------------------+---------------------------------+ - | :func:`space_object.index | .Container of space's indexes | - | <space_object.field_count>` | | + | :ref:`space_object.index | .Container of space's indexes | + | <box_space-field_count>` | | +--------------------------------------+---------------------------------+ - | :class:`box.space._schema` | .(Metadata) List of schemas | + | :ref:`box.space._schema | .(Metadata) List of schemas | + | <box_space-schema>` | | +--------------------------------------+---------------------------------+ - | :class:`box.space._space` | .(Metadata) List of spaces | + | :ref:`box.space._space | .(Metadata) List of spaces | + | <box_space-space>` | | +--------------------------------------+---------------------------------+ - | :class:`box.space._index` | .(Metadata) List of indexes | + | :ref:`box.space._index | .(Metadata) List of indexes | + | <box_space-index>` | | +--------------------------------------+---------------------------------+ - | :class:`box.space._user` | .(Metadata) List of users | + | :ref:`box.space._user | .(Metadata) List of users | + | <box_space-user>` | | +--------------------------------------+---------------------------------+ - | :class:`box.space._priv` | .(Metadata) List of privileges | + | :ref:`box.space._priv | .(Metadata) List of privileges | + | <box_space-priv>` | | +--------------------------------------+---------------------------------+ - | :class:`box.space._cluster` | .(Metadata) List of clusters | + | :ref:`box.space._cluster | .(Metadata) List of clusters | + | <box_space-cluster>` | | +--------------------------------------+---------------------------------+ + .. module:: box.space .. class:: space_object + .. _box_space-create_index: + .. method:: create_index(index-name [, {options} ]) Create an index. It is mandatory to create an index for a tuple set @@ -166,7 +177,7 @@ A list of all ``box.space`` functions follows, then comes a list of all --- ... - .. _space_insert: + .. _box_space-insert: .. method:: insert(tuple) @@ -192,7 +203,7 @@ A list of all ``box.space`` functions follows, then comes a list of all - [5000, 'tuple number five thousand'] ... - .. _space-select: + .. _box_space-select: .. method:: select(key) @@ -265,6 +276,8 @@ A list of all ``box.space`` functions follows, then comes a list of all instead of "equal to") and how many tuples to return, see the later section :ref:`index_object:select <index_object_select>`. + .. _box_space-get: + .. method:: get(key) Search for a tuple in the given space. @@ -295,7 +308,7 @@ A list of all ``box.space`` functions follows, then comes a list of all box.space.tester:get{1} - .. _space_drop: + .. _box_space-drop: .. method:: drop() @@ -316,6 +329,8 @@ A list of all ``box.space`` functions follows, then comes a list of all box.space.space_that_does_not_exist:drop() + .. _box_space-rename: + .. method:: rename(space-name) Rename a space. @@ -338,7 +353,7 @@ A list of all ``box.space`` functions follows, then comes a list of all --- ... - .. _space_replace: + .. _box_space-replace: .. method:: replace(tuple) put(tuple) @@ -371,7 +386,7 @@ A list of all ``box.space`` functions follows, then comes a list of all box.space.tester:replace{5000, 'tuple number five thousand'} - .. _space_update: + .. _box_space-update: .. method:: update(key, {{operator, field_no, value}, ...}) @@ -537,17 +552,17 @@ A list of all ``box.space`` functions follows, then comes a list of all The seventh argument is ``'!!'``, because ``'!!'`` is to be added at this position. Therefore, after this update, ``field[1]`` = ``999``, ``field[2]`` = ``'X!!Z'``. - .. _space_upsert: + .. _box_space-upsert: .. method:: upsert(tuple_value, {{operator, field_no, value}, ...}, ) Update or insert a tuple. If there is an existing tuple which matches the key fields of ``tuple_value``, then the - request has the same effect as :func:`space_object:update() <space_object.update>` and the + request has the same effect as :ref:`space_object:update() <box_space-update>` and the ``{{operator, field_no, value}, ...}`` parameter is used. If there is no existing tuple which matches the key fields of ``tuple_value``, then the - request has the same effect as :func:`space_object:insert() <space_object.insert>` and the + request has the same effect as :ref:`space_object:insert() <box_space-insert>` and the ``{tuple_value}`` parameter is used. However, unlike ``insert`` or ``update``, ``upsert`` will not read a tuple and perform error checks before returning -- this is a design feature which @@ -576,7 +591,7 @@ A list of all ``box.space`` functions follows, then comes a list of all box.space.tester:upsert({12,'c'}, {{'=', 3, 'a'}, {'=', 4, 'b'}}) - .. _space_delete: + .. _box_space-delete: .. method:: delete(key) @@ -610,6 +625,8 @@ A list of all ``box.space`` functions follows, then comes a list of all expected NUM' ... + .. _box_space-id: + .. data:: id Ordinal space number. Spaces can be referenced by either name or @@ -628,6 +645,8 @@ A list of all ``box.space`` functions follows, then comes a list of all - 512 ... + .. _box_space-enabled: + .. data:: enabled Whether or not this space is enabled. @@ -635,7 +654,7 @@ A list of all ``box.space`` functions follows, then comes a list of all Parameters: :samp:`{space_object}` = an :ref:`object reference <object-reference>`. - .. _space-object-field-count: + .. _box_space-field_count: .. data:: field_count @@ -687,6 +706,8 @@ A list of all ``box.space`` functions follows, then comes a list of all - TREE ... + .. _box_space-count: + .. method:: count([key], [iterator]) Parameters: :samp:`{space_object}` = an :ref:`object reference <object-reference>`; @@ -707,6 +728,7 @@ A list of all ``box.space`` functions follows, then comes a list of all Note re storage engine: sophia does not support :codenormal:`count(...)`. One possible workaround is to say :codenormal:`#select(...)`. + .. _box_space-len: .. method:: len() @@ -723,7 +745,7 @@ A list of all ``box.space`` functions follows, then comes a list of all - 2 ... - .. _space_truncate: + .. _box_space-truncate: .. method:: truncate() @@ -749,6 +771,8 @@ A list of all ``box.space`` functions follows, then comes a list of all - 0 ... + .. _box_space-inc: + .. method:: inc{field-value [, field-value ...]} Increments a counter in a tuple whose primary key matches the @@ -788,6 +812,8 @@ A list of all ``box.space`` functions follows, then comes a list of all - 2 ... + .. _box_space-dec: + .. method:: dec{field-value [, field-value ...]} Decrements a counter in a tuple whose primary key matches the @@ -830,7 +856,7 @@ A list of all ``box.space`` functions follows, then comes a list of all - 998 ... - .. _space_auto_increment: + .. _box_space-auto_increment: .. method:: auto_increment{field-value [, field-value ...]} @@ -863,6 +889,8 @@ A list of all ``box.space`` functions follows, then comes a list of all - [2, 'Fld#3'] ... + .. _box_space-pairs: + .. method:: pairs() A helper function to prepare for iterating over all tuples in a space. @@ -901,6 +929,8 @@ A list of all ``box.space`` functions follows, then comes a list of all - Hello my Lua world ... +.. _box_space-schema: + .. data:: _schema ``_schema`` is a system tuple set. Its single tuple contains these fields: @@ -938,11 +968,13 @@ A list of all ``box.space`` functions follows, then comes a list of all - 'version 1 6 ' ... +.. _box_space-space: + .. data:: _space ``_space`` is a system tuple set. Its tuples contain these fields: ``id``, ``uid``, ``space-name``, ``engine``, ``field_count``, ``temporary``, ``format``. - These fields are established by :func:`space.create() <box.schema.space.create>`. + These fields are established by :ref:`space.create() <box_schema-space_create>`. **Example:** @@ -1020,6 +1052,8 @@ A list of all ``box.space`` functions follows, then comes a list of all - - [522, 1, 'TM', 'memtx', 0, '', [{'name': 'field#1'}, {'type': 'num'}]] ... +.. _box_space-index: + .. data:: _index ``_index`` is a system tuple set. Its tuples contain these fields: @@ -1076,16 +1110,22 @@ A list of all ``box.space`` functions follows, then comes a list of all - '514 0 first tree 1 1 0 STR ' ... +.. _box_space-user: + .. data:: _user ``_user`` is a system tuple set for support of the :ref:`authorization feature <box-authentication>`. +.. _box_space-priv: + .. data:: _priv ``_priv`` is a system tuple set for support of the :ref:`authorization feature <box-authentication>`. +.. _box_space-cluster: + .. data:: _cluster ``_cluster`` is a system tuple set diff --git a/doc/sphinx/book/box/box_tuple.rst b/doc/sphinx/book/box/box_tuple.rst index 75823796fc66e3ccba32d3c04088fedcd8ef3f1a..73d2856545480804ad256e6c7a266adc021eb971 100644 --- a/doc/sphinx/book/box/box_tuple.rst +++ b/doc/sphinx/book/box/box_tuple.rst @@ -1,4 +1,4 @@ -.. _box-tuple: +.. _box_tuple: ------------------------------------------------------------------------------- Package `box.tuple` @@ -14,9 +14,9 @@ and conversion to a Lua table. .. function:: new(value) Construct a new tuple from either a scalar or a Lua table. Alternatively, - one can get new tuples from tarantool's :func:`select <space_object.select>` - or :func:`insert <space_object.insert>` or :func:`replace <space_object.replace>` - or :func:`update <space_object.update>` requests, + one can get new tuples from tarantool's :ref:`select <box_space-select>` + or :ref:`insert <box_space-insert>` or :ref:`replace <box_space-replace>` + or :ref:`update <box_space-update>` requests, which can be regarded as statements that do ``new()`` implicitly. @@ -256,7 +256,7 @@ and conversion to a Lua table. as 'B' for a new assignable value = 'B'. For details: see the description for ``format``, ``field_number``, and ``value`` in - the section :func:`box.space.space-name:update{key, format, {field_number, value}...) <space_object.update>`. + the section :ref:`box.space.space-name:update{key, format, {field_number, value}...) <box_space-update>`. :return: new tuple :rtype: tuple diff --git a/doc/sphinx/book/box/index.rst b/doc/sphinx/book/box/index.rst index 431d45f5216ac71d8103b3b412cb24b909c2eae3..2308c22975a9c2560f2c49d12e8f1f1780cd3d71 100644 --- a/doc/sphinx/book/box/index.rst +++ b/doc/sphinx/book/box/index.rst @@ -167,7 +167,7 @@ Tarantool will try to store a number as floating-point if the value contains a decimal point or is very large (greater than 100 quadrillion = 1e14), otherwise Tarantool will store it as an integer. To ensure that even very large numbers will be treated as -integers, use the :func:`tonumber64 <tonumber64>` +integers, use the :ref:`tonumber64 <other-tonumber64>` function, or the LL (Long Long) suffix, or the ULL (Unsigned Long Long) suffix. Here are examples of numbers using regular notation, exponential notation, the ULL suffix, @@ -188,15 +188,15 @@ A *boolean* is either ``true`` or ``false``. A *nil* type has only one possible value, also called *nil*, but often displayed as *null*. Nils may be compared to values of any types with == (is-equal) or ~= (is-not-equal), but other operations will not work. Nils may not be used in -Lua tables; the workaround is to use :data:`yaml.NULL` or :data:`json.NULL` or -:data:`msgpack.NULL`. +Lua tables; the workaround is to use :ref:`yaml.NULL <yaml-null>` or :ref:`json.NULL <json-null>` or +:ref:`msgpack.NULL <msgpack-null>`. A *tuple* is returned in YAML format like ``- [120, 'a', 'b', 'c']``. A few functions may return tables with multiple tuples. A scalar may be converted to a tuple with only one field. A Lua table may contain all of a tuple's fields, but not nil. -For more tuple examples see :ref:`box.tuple <box-tuple>`. +For more tuple examples see :ref:`box.tuple <box_tuple>`. ---------- Operations @@ -360,7 +360,7 @@ is lost when the power goes off, Tarantool recovers it automatically when it starts up again, by reading the WAL files and redoing the requests (this is called the "recovery process"). Users can change the timing of the WAL writer, -or turn it off, by setting :ref:`wal_mode <confval-wal-mode>`. +or turn it off, by setting :ref:`wal_mode <cfg_binary_logging_snapshots-wal_mode>`. Tarantool also maintains a set of snapshot files. A snapshot file is an on-disk copy of the entire data set for a given moment. @@ -369,7 +369,7 @@ the recovery process can load the latest snapshot and then read only the WAL files that were produced after the snapshot was made. A snapshot can be made even if there is no WAL file. Some snapshots are automatic, or users can make them at any time -with the :func:`box.snapshot() <box.snapshot()>` request. +with the :ref:`box.snapshot() <admin-snapshot>` request. Details about the WAL writer and the recovery process are in the :ref:`Internals <box-internals>` section. @@ -603,35 +603,35 @@ introspection (inspecting contents of spaces, accessing server configuration). .. rst-class:: left-align-column-1 .. rst-class:: left-align-column-2 - +-------------------+-----------------------------------------------------+ - | Index size | The number of index keys is the same as the number | - | | of tuples in the data set. For a TREE index, if | - | | there are more keys then the lookup time will be | - | | greater, although of course the effect is not | - | | linear. For a HASH index, if there are more keys | - | | then there is more RAM use, but the number of | - | | low-level steps tends to remain constant. | - +-------------------+-----------------------------------------------------+ - | Index type | Typically a HASH index is faster than a TREE index | - | | if the number of tuples in the tuple set is greater | - | | than one. | - +-------------------+-----------------------------------------------------+ - | Number of indexes | Ordinarily only one index is accessed to retrieve | - | accessed | one tuple. But to update the tuple, there must be N | - | | accesses if the tuple set has N different indexes. | - +-------------------+-----------------------------------------------------+ - | Number of tuples | A few requests, for example select, can retrieve | - | accessed | multiple tuples. This factor is usually less | - | | important than the others. | - +-------------------+-----------------------------------------------------+ - | WAL settings | The important setting for the write-ahead log is | - | | :ref:`wal_mode <confval-wal-mode>`. If the setting | - | | causes no writing or | - | | delayed writing, this factor is unimportant. If the | - | | setting causes every data-change request to wait | - | | for writing to finish on a slow device, this factor | - | | is more important than all the others. | - +-------------------+-----------------------------------------------------+ + +-------------------+----------------------------------------------------------+ + | Index size | The number of index keys is the same as the number | + | | of tuples in the data set. For a TREE index, if | + | | there are more keys then the lookup time will be | + | | greater, although of course the effect is not | + | | linear. For a HASH index, if there are more keys | + | | then there is more RAM use, but the number of | + | | low-level steps tends to remain constant. | + +-------------------+----------------------------------------------------------+ + | Index type | Typically a HASH index is faster than a TREE index | + | | if the number of tuples in the tuple set is greater | + | | than one. | + +-------------------+----------------------------------------------------------+ + | Number of indexes | Ordinarily only one index is accessed to retrieve | + | accessed | one tuple. But to update the tuple, there must be N | + | | accesses if the tuple set has N different indexes. | + +-------------------+----------------------------------------------------------+ + | Number of tuples | A few requests, for example select, can retrieve | + | accessed | multiple tuples. This factor is usually less | + | | important than the others. | + +-------------------+----------------------------------------------------------+ + | WAL settings | The important setting for the write-ahead log is | + | | :ref:`wal_mode <cfg_binary_logging_snapshots-wal_mode>`. | + | | If the setting causes no writing or | + | | delayed writing, this factor is unimportant. If the | + | | setting causes every data-change request to wait | + | | for writing to finish on a slow device, this factor | + | | is more important than all the others. | + +-------------------+----------------------------------------------------------+ In the discussion of each data-manipulation function there will be a note about which Complexity Factors might affect the function's resource usage. diff --git a/doc/sphinx/book/box/limitations.rst b/doc/sphinx/book/box/limitations.rst index 8b3070ea886e1bc7494960ecddad9904a725ced1..cd00b22360e898aa0b179ac6e03e694e386b5810 100644 --- a/doc/sphinx/book/box/limitations.rst +++ b/doc/sphinx/book/box/limitations.rst @@ -27,14 +27,14 @@ The theoretical maximum is 2147483647 (``box.schema.FIELD_MAX``). The practical maximum is whatever is specified by the space's - :ref:`field_count <space-object-field-count>` + :ref:`field_count <box_space-field_count>` member, or the maximum tuple length. .. _lim_bytes_in_tuple: **Number of bytes in a tuple** - By default the value of :confval:`slab_alloc_maximal` + By default the value of :ref:`slab_alloc_maximal <cfg_storage-slab_alloc_maximal>` is 1048576, and the maximum tuple length is approximately one quarter of that: approximately 262,000 bytes. To increase it, when starting the server, specify a larger value. For example @@ -58,7 +58,7 @@ **Space size** The total maximum size for all spaces is in effect set by - :confval:`slab_alloc_arena`, which in turn + :ref:`slab_alloc_arena <cfg_storage-slab_alloc_arena>`, which in turn is limited by the total available memory. .. _lim_update_ops: diff --git a/doc/sphinx/book/box/sophia_diff.rst b/doc/sphinx/book/box/sophia_diff.rst index f6f22ed92d1ad5be16cf53d2595254a499aab209..ea4f76931cab811f9f5a880cdf6fa357e686b3b8 100644 --- a/doc/sphinx/book/box/sophia_diff.rst +++ b/doc/sphinx/book/box/sophia_diff.rst @@ -42,8 +42,8 @@ With memtx, the :ref:`alter() <index_alter>` and :ref:`count() <index_count>` and :ref:`min() <index_min>` and :ref:`max() <index_max>` and - :ref:`random() <index_random>` and :ref:`auto_increment() <space_auto_increment>` - and :ref:`truncate() <space_truncate>` functions are supported. |br| + :ref:`random() <index_random>` and :ref:`auto_increment() <box_space-auto_increment>` + and :ref:`truncate() <box_space-truncate>` functions are supported. |br| With sophia, they are not. With memtx, insert and replace and update will return a tuple, if successful. |br| diff --git a/doc/sphinx/book/box/triggers.rst b/doc/sphinx/book/box/triggers.rst index 33ac73de8cfa76d01cf8a1dbd14c41b23c56a53a..d1f4fbd807c98feede19042b1363b7768fa24674 100644 --- a/doc/sphinx/book/box/triggers.rst +++ b/doc/sphinx/book/box/triggers.rst @@ -44,7 +44,7 @@ All triggers have the following characteristics: .. function:: box.session.on_connect(trigger-function [, old-trigger-function-name]) Define a trigger for execution when a new session is created due to an event - such as :func:`console.connect`. The trigger function will be the first thing + such as :ref:`console.connect <console-connect>`. The trigger function will be the first thing executed after a new session is created. If the trigger fails by raising an error, the error is sent to the client and the connection is closed. @@ -95,7 +95,7 @@ All triggers have the following characteristics: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ After the following series of requests, the server will write a message -using the :mod:`log` package whenever any user connects or disconnects. +using the :ref:`log <log>` package whenever any user connects or disconnects. .. code-block:: lua_tarantool @@ -130,7 +130,7 @@ Here is what might appear in the log file in a typical installation: Define a trigger for execution during authentication. The on_auth trigger function is invoked in these circumstances: - (1) The :func:`console.connect` function includes an authentication check for all users except 'guest'; + (1) The :ref:`console.connect <console-connect>` function includes an authentication check for all users except 'guest'; for this case the on_auth trigger function is invoked after the on_connect trigger function, if and only if the connection has succeeded so far. (2) The binary protocol has a separate :ref:`authentication packet <iproto-authentication>` -- diff --git a/doc/sphinx/book/configuration/cfg_basic.rst b/doc/sphinx/book/configuration/cfg_basic.rst index d4b6257b55e79e06842970e186ced88ea37da7d2..069e264f6d736630eaf0ec357b24e3adb4108b64 100644 --- a/doc/sphinx/book/configuration/cfg_basic.rst +++ b/doc/sphinx/book/configuration/cfg_basic.rst @@ -1,8 +1,8 @@ .. confval:: background - Run the server as a background task. The :ref:`logger <log-label>` and - :ref:`pid_file <box-cfg-pid-file>` parameters must be non-null for this to work. + Run the server as a background task. The :ref:`logger <cfg_logging-logger>` and + :ref:`pid_file <cfg_basic-pid_file>` parameters must be non-null for this to work. Type: boolean |br| Default: false |br| @@ -16,6 +16,8 @@ Default: false |br| Dynamic: no |br| +.. _cfg_basic-custom_proc_title: + .. confval:: custom_proc_title Add the given string to the server's :ref:`Process title <book-proctitle>` @@ -40,7 +42,7 @@ Default: null |br| Dynamic: yes |br| -.. _box-cfg-listen: +.. _cfg_basic-listen: .. confval:: listen @@ -59,18 +61,18 @@ Default: null |br| Dynamic: yes |br| -.. _box-cfg-pid-file: +.. _cfg_basic-pid_file: .. confval:: pid_file - Store the process id in this file. Can be relative to :ref:`work_dir <box-cfg-work-dir>`. + Store the process id in this file. Can be relative to :ref:`work_dir <cfg_basic-work_dir>`. A typical value is “:file:`tarantool.pid`â€. Type: string |br| Default: null |br| Dynamic: no |br| -.. _box-cfg-read-only: +.. _cfg_basic-read_only: .. confval:: read_only @@ -81,22 +83,24 @@ Default: false |br| Dynamic: yes |br| -.. _box-cfg-snap-dir: +.. _cfg_basic-snap_dir: .. confval:: snap_dir A directory where snapshot (.snap) files will be stored. Can be relative to - :ref:`work_dir <box-cfg-work-dir>`. If not specified, defaults to work_dir. - See also :ref:`wal_dir <box-cfg-wal-dir>`. + :ref:`work_dir <cfg_basic-work_dir>`. If not specified, defaults to work_dir. + See also :ref:`wal_dir <cfg_basic-wal_dir>`. Type: string |br| Default: "." |br| Dynamic: no |br| +.. _cfg_basic-sophia_dir: + .. confval:: sophia_dir A directory where sophia files or sub-directories will be stored. Can be relative to - :ref:`work_dir <box-cfg-work-dir>`. If not specified, defaults to work_dir. + :ref:`work_dir <cfg_basic-work_dir>`. If not specified, defaults to work_dir. Type: string |br| Default: "." |br| @@ -110,13 +114,13 @@ Default: null |br| Dynamic: no |br| -.. _box-cfg-wal-dir: +.. _cfg_basic-wal_dir: .. confval:: wal_dir A directory where write-ahead log (.xlog) files are stored. Can be - relative to :ref:`work_dir <box-cfg-work-dir>`. Sometimes wal_dir - and :ref:`snap_dir <box-cfg-snap-dir>` are specified with different values, so that + relative to :ref:`work_dir <cfg_basic-work_dir>`. Sometimes wal_dir + and :ref:`snap_dir <cfg_basic-snap_dir>` are specified with different values, so that write-ahead log files and snapshot files can be stored on different disks. If not specified, defaults to work_dir. @@ -124,7 +128,7 @@ Default: "." |br| Dynamic: no |br| -.. _box-cfg-work-dir: +.. _cfg_basic-work_dir: .. confval:: work_dir diff --git a/doc/sphinx/book/configuration/cfg_binary_logging_snapshots.rst b/doc/sphinx/book/configuration/cfg_binary_logging_snapshots.rst index d77e49d5d04b68616c7d78b9cd91e2cbc7495c99..84689401ec61ba1ebc2e09f9b977c2c6107ec15d 100644 --- a/doc/sphinx/book/configuration/cfg_binary_logging_snapshots.rst +++ b/doc/sphinx/book/configuration/cfg_binary_logging_snapshots.rst @@ -1,9 +1,11 @@ - :confval:`panic_on_snap_error`, |br| - :confval:`panic_on_wal_error`, |br| - :confval:`rows_per_wal`, |br| - :confval:`snap_io_rate_limit`, |br| - :confval:`wal_mode`, |br| - :confval:`wal_dir_rescan_delay` |br| + :ref:`panic_on_snap_error <cfg_binary_logging_snapshots-panic_on_snap_error>`, |br| + :ref:`panic_on_wal_error <cfg_binary_logging_snapshots-panic_on_wal_error>`, |br| + :ref:`rows_per_wal <cfg_binary_logging_snapshots-rows_per_wal>`, |br| + :ref:`snap_io_rate_limit <cfg_binary_logging_snapshots-snap_io_rate_limit>`, |br| + :ref:`wal_mode <cfg_binary_logging_snapshots-wal_mode>`, |br| + :ref:`wal_dir_rescan_delay <cfg_binary_logging_snapshots-wal_dir_rescan_delay>` |br| + +.. _cfg_binary_logging_snapshots-panic_on_snap_error: .. confval:: panic_on_snap_error @@ -14,6 +16,8 @@ Default: true |br| Dynamic: no |br| +.. _cfg_binary_logging_snapshots-panic_on_wal_error: + .. confval:: panic_on_wal_error If there is an error while reading a write-ahead log @@ -23,7 +27,7 @@ Default: true |br| Dynamic: yes |br| -.. _box-cfg-rows-per-wal: +.. _cfg_binary_logging_snapshots-rows_per_wal: .. confval:: rows_per_wal @@ -36,19 +40,21 @@ Default: 500000 |br| Dynamic: no |br| +.. _cfg_binary_logging_snapshots-snap_io_rate_limit: + .. confval:: snap_io_rate_limit - Reduce the throttling effect of :func:`box.snapshot` on + Reduce the throttling effect of :ref:`box.snapshot <admin-snapshot>` on INSERT/UPDATE/DELETE performance by setting a limit on how many megabytes per second it can write to disk. The same can be - achieved by splitting :confval:`wal_dir` and :confval:`snap_dir` + achieved by splitting :ref:`wal_dir <cfg_basic-wal_dir>` and :ref:`snap_dir <cfg_basic-snap_dir>` locations and moving snapshots to a separate disk. Type: float |br| Default: null |br| Dynamic: **yes** |br| -.. _confval-wal-mode: +.. _cfg_binary_logging_snapshots-wal_mode: .. confval:: wal_mode @@ -64,6 +70,8 @@ Default: "write" |br| Dynamic: **yes** |br| +.. _cfg_binary_logging_snapshots-wal_dir_rescan_delay: + .. confval:: wal_dir_rescan_delay Number of seconds between periodic scans of the write-ahead-log diff --git a/doc/sphinx/book/configuration/cfg_logging.rst b/doc/sphinx/book/configuration/cfg_logging.rst index 2b1affa5920236687d6eac77bf3e16f0424171ed..d2b535da4c5dbb4f426722daf912cb85b248de18 100644 --- a/doc/sphinx/book/configuration/cfg_logging.rst +++ b/doc/sphinx/book/configuration/cfg_logging.rst @@ -1,3 +1,5 @@ +.. _cfg_logging-log_level: + .. confval:: log_level How verbose the logging is. There are six log verbosity classes: @@ -11,14 +13,14 @@ By setting log_level, one can enable logging of all classes below or equal to the given level. Tarantool prints its logs to the standard - error stream by default, but this can be changed with the :ref:`logger <log-label>` + error stream by default, but this can be changed with the :ref:`logger <cfg_logging-logger>` configuration parameter. Type: integer |br| Default: 5 |br| Dynamic: **yes** |br| -.. _log-label: +.. _cfg_logging-logger: .. confval:: logger @@ -77,18 +79,20 @@ The ``facility`` setting is currently ignored but will be used in the future. When logging to a file, tarantool reopens the log on SIGHUP. When log is - a program, its pid is saved in the :func:`log.logger_pid` variable. You need + a program, its pid is saved in the :ref:`log.logger_pid <log-logger_pid>` variable. You need to send it a signal to rotate logs. Type: string |br| Default: null |br| Dynamic: no |br| +.. _cfg_logging-logger_nonblock: + .. confval:: logger_nonblock If ``logger_nonblock`` equals true, Tarantool does not block on the log file descriptor when it’s not ready for write, and drops the message - instead. If :confval:`log_level` is high, and a lot of messages go to the + instead. If :ref:`log_level <cfg_logging-log_level>` is high, and a lot of messages go to the log file, setting ``logger_nonblock`` to true may improve logging performance at the cost of some log messages getting lost. @@ -96,10 +100,12 @@ Default: true |br| Dynamic: no |br| +.. _cfg_logging-too_long_threshold: + .. confval:: too_long_threshold If processing a request takes longer than the given value (in seconds), - warn about it in the log. Has effect only if :confval:`log_level` is + warn about it in the log. Has effect only if :ref:`log_level <cfg_logging-log_level>` is more than or equal to 4 (WARNING). Type: float |br| diff --git a/doc/sphinx/book/configuration/cfg_networking.rst b/doc/sphinx/book/configuration/cfg_networking.rst index 9a62b78e15b6695c866b2f797628d447e1fce9fe..1029b825aec359287a5f3225f2e2a90e22e44dc1 100644 --- a/doc/sphinx/book/configuration/cfg_networking.rst +++ b/doc/sphinx/book/configuration/cfg_networking.rst @@ -1,5 +1,7 @@ - :confval:`io_collect_interval`, |br| - :confval:`readahead` |br| + :ref:`io_collect_interval <cfg_networking-io_collect_interval>`, |br| + :ref:`readahead <cfg_networking-readahead>` |br| + +.. _cfg_networking-io_collect_interval: .. confval:: io_collect_interval @@ -12,6 +14,8 @@ Default: null |br| Dynamic: **yes** |br| +.. _cfg_networking-readahead: + .. confval:: readahead The size of the read-ahead buffer associated with a client connection. The diff --git a/doc/sphinx/book/configuration/cfg_replication.rst b/doc/sphinx/book/configuration/cfg_replication.rst index ad61b7a958d576a76584fb72a10eb441e58df0a0..c4de4ca276d1133e83d2535dce587779ca591840 100644 --- a/doc/sphinx/book/configuration/cfg_replication.rst +++ b/doc/sphinx/book/configuration/cfg_replication.rst @@ -1,4 +1,4 @@ -.. _box-cfg-replication-source: +.. _cfg_replication-replication_source: .. confval:: replication_source @@ -17,7 +17,7 @@ specification on multiple servers. The default user name is ‘guest’. - A replica server does not accept data-change requests on the :confval:`listen` port. + A replica server does not accept data-change requests on the :ref:`listen <cfg_basic-listen>` port. The replication_source parameter is dynamic, that is, to enter master mode, simply set replication_source to an empty string and issue :code:`box.cfg{replication_source=`:samp:`{new-value}`:code:`}`. diff --git a/doc/sphinx/book/configuration/cfg_snapshot_daemon.rst b/doc/sphinx/book/configuration/cfg_snapshot_daemon.rst index cf5bd58e53f0d127243daf06298244ab6795261a..b4829204473195f64d4f0f18d996c2528005af45 100644 --- a/doc/sphinx/book/configuration/cfg_snapshot_daemon.rst +++ b/doc/sphinx/book/configuration/cfg_snapshot_daemon.rst @@ -9,16 +9,18 @@ snapshot file and contain information that is present in the snapshot file. - The :confval:`snapshot_period` and :confval:`snapshot_count` + The :ref:`snapshot_period <cfg_snapshot_daemon-snapshot_period>` and :ref:`snapshot_count <cfg_snapshot_daemon-snapshot_count>` configuration settings determine how long the intervals are, and how many snapshots should exist before removals occur. +.. _cfg_snapshot_daemon-snapshot_period: + .. confval:: snapshot_period The interval between actions by the snapshot daemon, in seconds. If ``snapshot_period`` is set to a value greater than zero, and there is activity which causes change to a database, - then the snapshot daemon will call :func:`box.snapshot` every + then the snapshot daemon will call :ref:`box.snapshot <admin-snapshot>` every ``snapshot_period`` seconds, creating a new snapshot file each time. For example: ``box.cfg{snapshot_period=3600}`` @@ -29,6 +31,8 @@ Default: 0 |br| Dynamic: yes |br| +.. _cfg_snapshot_daemon-snapshot_count: + .. confval:: snapshot_count The maximum number of snapshots that may exist on the snap_dir diff --git a/doc/sphinx/book/configuration/cfg_storage.rst b/doc/sphinx/book/configuration/cfg_storage.rst index 606a0dc83b0f26323e1ce564712532e8ed4dbac1..d18e420d931768e7aa4f9724170dad2bbbf3fc99 100644 --- a/doc/sphinx/book/configuration/cfg_storage.rst +++ b/doc/sphinx/book/configuration/cfg_storage.rst @@ -1,3 +1,5 @@ +.. _cfg_storage-slab_alloc_arena: + .. confval:: slab_alloc_arena How much memory Tarantool allocates to actually store tuples, in gigabytes. @@ -11,6 +13,8 @@ Default: 1.0 |br| Dynamic: no |br| +.. _cfg_storage-slab_alloc_factor: + .. confval:: slab_alloc_factor Use slab_alloc_factor as the multiplier for computing the sizes of memory @@ -22,6 +26,8 @@ Default: 1.1 |br| Dynamic: no |br| +.. _cfg_storage-slab_alloc_maximal: + .. confval:: slab_alloc_maximal Size of the largest allocation unit. It can be increased if it @@ -31,6 +37,8 @@ Default: 1048576 |br| Dynamic: no |br| +.. _cfg_storage-slab_alloc_minimal: + .. confval:: slab_alloc_minimal Size of the smallest allocation unit. It can be decreased if most @@ -40,6 +48,8 @@ Default: 16 |br| Dynamic: no |br| +.. _cfg_storage-sophia: + .. confval:: sophia The default sophia configuration can be changed with diff --git a/doc/sphinx/book/configuration/index.rst b/doc/sphinx/book/configuration/index.rst index 0035fa03467be78b43ab43039dcc688cb5089997..1a5325eca3190c73cb64dc403a28558e9eccd356 100644 --- a/doc/sphinx/book/configuration/index.rst +++ b/doc/sphinx/book/configuration/index.rst @@ -150,7 +150,7 @@ Then the screen might look like this: ... main C> entering the event loop If one wishes to start an interactive session on the same terminal after -initialization is complete, one can use :func:`console.start()`. +initialization is complete, one can use :ref:`console.start() <console-start>`. .. _local_hot_standby: .. _replication_port: @@ -241,7 +241,7 @@ for binary logging and snapshots, for replication, for networking, and for loggi Local hot standby is a feature which provides a simple form of failover without replication. To initiate it, start a second instance of the Tarantool server on -the same computer with the same :func:`box.cfg` configuration settings - +the same computer with the same :ref:`box.cfg <box_introspection-box_cfg>` configuration settings - including the same directories and same non-null URIs. A warning should appear with a message like diff --git a/doc/sphinx/book/replication/index.rst b/doc/sphinx/book/replication/index.rst index 77ee692033fb15f355c5d21aa25eda8bfa2e346c..54805256305653a6ca1f69e27e8cb1f308e88f5f 100644 --- a/doc/sphinx/book/replication/index.rst +++ b/doc/sphinx/book/replication/index.rst @@ -36,7 +36,7 @@ not cause replication to go out of sync. ===================================================================== To prepare the master for connections from the replica, it's only necessary -to include ":ref:`listen <box-cfg-listen>`" in the initial ``box.cfg`` request, for example +to include ":ref:`listen <cfg_basic-listen>`" in the initial ``box.cfg`` request, for example ``box.cfg{listen=3301}``. A master with enabled "listen" URI can accept connections from as many replicas as necessary on that URI. Each replica has its own replication state. @@ -52,7 +52,7 @@ server is a master and starts its own new cluster with a new unique UUID. If this first ``box.cfg`` request occurs with a "replication source" clause, then the server is a replica and its snapshot file, along with the cluster information, is constructed from the write-ahead logs of the master. -Therefore, to start replication, specify :confval:`replication_source` +Therefore, to start replication, specify :ref:`replication_source <cfg_replication-replication_source>` in a ``box.cfg`` request. When a replica contacts a master for the first time, it becomes part of a cluster. On subsequent occasions, it should always contact a master in the same cluster. @@ -67,7 +67,7 @@ Again, this procedure works only if the master's WAL files are present. NOTE: Replication parameters are "dynamic", which allows the replica to become -a master and vice versa with the help of the :func:`box.cfg` statement. +a master and vice versa with the help of the :ref:`box.cfg <box_introspection-box_cfg>` statement. NOTE: The replica does not inherit the master's configuration parameters, such @@ -114,7 +114,7 @@ Step 1. Start the first server thus: ... Now a new cluster exists. Step 2. Check where the second server's files will go by looking at its -directories (:confval:`snap_dir` for snapshot files, :confval:`wal_dir` for .xlog files). +directories (:ref:`snap_dir <cfg_basic-snap_dir>` for snapshot files, :ref:`wal_dir <cfg_basic-wal_dir>` for .xlog files). They must be empty - when the second server joins for the first time, it has to be working with a clean slate so that the initial copy of the first server's databases can happen without conflicts. @@ -140,19 +140,19 @@ computer and the replica on a different computer is very common and provides two benefits: FAILOVER (because if the master goes down then the replica can take over), or LOAD BALANCING (because clients can connect to either the master or the replica for select requests). Sometimes the replica may be configured with -the additional parameter :ref:`read_only = true <box-cfg-read-only>`. +the additional parameter :ref:`read_only = true <cfg_basic-read_only>`. ===================================================================== Monitoring a Replica's Actions ===================================================================== -In :func:`box.info` there is a :code:`box.info.replication.status` field: +In :ref:`box.info <box_introspection-box_info>` there is a :code:`box.info.replication.status` field: "off", "stopped", "connecting", "auth", "follow", or "disconnected". |br| If a replica's status is "follow", then there will be two more fields: |br| :code:`box.info.replication.idle` = the number of seconds the replica has been idle, |br| :code:`box.info.replication.lag` = the number of seconds the replica is behind the master. -In the :mod:`log` there is a record of replication activity. +In the :ref:`log <log>` there is a record of replication activity. If a primary server is started with: .. cssclass:: highlight @@ -212,7 +212,7 @@ Starting with the simple configuration, the first server has to say: box.cfg{ replication_source = *uri#2* } This request can be performed at any time -- -:ref:`replication_source <box-cfg-replication-source>` is a dynamic parameter. +:ref:`replication_source <cfg_replication-replication_source>` is a dynamic parameter. In this configuration, both servers are "masters" and both servers are "replicas". Henceforth every change that happens on either server will @@ -231,7 +231,7 @@ servers will end up with different contents. ===================================================================== Q: What if there are more than two servers with master-master? |br| -A: On each server, specify the :confval:`replication_source` for all the +A: On each server, specify the :ref:`replication_source <cfg_replication-replication_source>` for all the others. For example, server #3 would have a request: |br| :codenormal:`box.cfg{` |br| |nbsp| |nbsp| |nbsp| :codenormal:`replication_source = {`:codeitalic:`uri#1, uri#2`:codenormal:`}` |br| @@ -264,7 +264,7 @@ saying ``box.cfg{replication_source=''}``. Q: What if it's necessary to know what cluster a server is in? |br| A: The identification of the cluster is a UUID which is generated when the first master starts for the first time. This UUID is stored in a tuple -of the :data:`box.space._schema` system space. So to see it, say: +of the :ref:`box.space._schema <box_space-schema>` system space. So to see it, say: ``box.space._schema:select{'cluster'}`` Q: What if it's necessary to know what other servers belong in the cluster? |br| @@ -285,7 +285,7 @@ Q: What if replication causes security concerns? |br| A: Prevent unauthorized replication sources by associating a password with every user that has access privileges for the relevant spaces, and every user that has a replication :ref:`role <rep-role>`. That way, -the :ref:`URI` for the :confval:`replication_source` parameter will +the :ref:`URI` for the ref:`replication_source <cfg_replication-replication_source>` parameter will always have to have the long form |br| ``replication_source='username:password@host:port'`` diff --git a/doc/sphinx/book/user_guide_getting_started.rst b/doc/sphinx/book/user_guide_getting_started.rst index f435a7ef6f2f4d2bd4d3ce013fb1758479a5b98a..90ba30c0130aec5a36b44f6102f024c3a7d6bff7 100644 --- a/doc/sphinx/book/user_guide_getting_started.rst +++ b/doc/sphinx/book/user_guide_getting_started.rst @@ -67,7 +67,7 @@ Start the server. The server name is tarantool. $ ~/tarantool/src/tarantool The server starts in interactive mode and outputs a command prompt. -To turn on the database, :mod:`configure <box.cfg>` it. This minimal example is sufficient: +To turn on the database, :ref:`configure <box_introspection-box_cfg>` it. This minimal example is sufficient: .. code-block:: tarantoolsession diff --git a/doc/sphinx/reference/clock.rst b/doc/sphinx/reference/clock.rst index eeeaebf456bf4fc2436fdb8b75ae3942d4caf718..d5fdf49d9aebd89646946b2c7776794fe40a0574 100644 --- a/doc/sphinx/reference/clock.rst +++ b/doc/sphinx/reference/clock.rst @@ -17,7 +17,7 @@ functions whose names end in "64" return a 64-bit number of nanoseconds. The wall clock time. Derived from C function clock_gettime(CLOCK_REALTIME). This is the best function for knowing what the official time is, as determined by the system administrator. |br| - See also :func:`fiber.time64 <fiber.time64>` and :ref:`os.clock() <os-clock>`. + See also :ref:`fiber.time64 <fiber-time64>` and :ref:`os.clock() <os-clock>`. :return: seconds or nanoseconds since epoch (1970-01-01 00:00:00), adjusted. :rtype: number or number64 diff --git a/doc/sphinx/reference/console.rst b/doc/sphinx/reference/console.rst index 2325b4469c6ba8663f8ab7530fbb53d897e3f37a..6095bea16cfb1c965bdce9c533ae5d31860b6087 100644 --- a/doc/sphinx/reference/console.rst +++ b/doc/sphinx/reference/console.rst @@ -10,6 +10,8 @@ host/port. .. module:: console +.. _console-connect: + .. function:: connect(uri) Connect to the server at :ref:`URI`, change the prompt from ':samp:`tarantool>`' to @@ -54,6 +56,8 @@ host/port. ... 198.18.44.44:3301> -- prompt is telling us that server is remote +.. _console-listen: + .. function:: listen(uri) Listen on :ref:`URI`. The primary way of listening for incoming requests @@ -93,6 +97,8 @@ host/port. port: /tmp/X.sock ... +.. _console-start: + .. function:: start() Start the console on the current interactive terminal. diff --git a/doc/sphinx/reference/csv.rst b/doc/sphinx/reference/csv.rst index 7b5e4f03542d30d9785a7bd94f0a94d83a5056bc..d8cdb9366ad8e934c247e9fadb18a47192b3f279 100644 --- a/doc/sphinx/reference/csv.rst +++ b/doc/sphinx/reference/csv.rst @@ -28,6 +28,8 @@ The possible options which can be passed to csv functions are: * :samp:`chunk-size = {number}` -- number of characters to read at once (usually for file-IO efficiency), default = 4096 * :samp:`skip_head_lines = {number}` -- number of lines to skip at the start (usually for a header), default 0 +.. _csv-load: + .. function:: load(readable[, {options}]) Get CSV-formatted input from ``readable`` and return a table as output. @@ -103,13 +105,15 @@ The possible options which can be passed to csv functions are: - true ... +.. _csv-dump: + .. function:: dump(csv-table[, options, writable]) Get table input from ``csv-table`` and return a CSV-formatted string as output. Or, get table input from ``csv-table`` and put the output in ``writable``. Usually :samp:`{options}` is not specified. Usually ``writable``, if specified, is a file opened for writing. - :func:`csv.dump()` is the reverse of :func:`csv.load()`. + :ref:`csv.dump() <csv-dump>` is the reverse of :ref:`csv.load() <csv-load>`. :param table csv-table: a table which can be formatted according to the CSV rules. :param table options: optional. see :ref:`above <csv-options>` @@ -147,6 +151,7 @@ The possible options which can be passed to csv functions are: ' ... +.. _csv-iterate: .. function:: iterate(input, {options}) @@ -160,8 +165,8 @@ The possible options which can be passed to csv functions are: **Example:** - func:`csv.iterate()` is the low level of func:`csv.load()` and :func:`csv.dump()`. - To illustrate that, here is a function which is the same as the :func:`csv.load()` + :ref:`csv.iterate() <csv-iterate>` is the low level of :ref:`csv.load() <csv-load>` and :ref:`csv.dump() <csv-dump>`. + To illustrate that, here is a function which is the same as the :ref:`csv.load() <csv-load>` function, as seen in `the Tarantool source code`_. .. code-block:: tarantoolsession diff --git a/doc/sphinx/reference/expirationd.rst b/doc/sphinx/reference/expirationd.rst index 54a1472fc516a7d2fa12b91f300f0720972852d1..49e9b4d1d1427e9c04cb5a80315cc4829a390f26 100644 --- a/doc/sphinx/reference/expirationd.rst +++ b/doc/sphinx/reference/expirationd.rst @@ -54,7 +54,7 @@ Remembering that :codenormal:`index[0]` is always the space's primary key, and :codenormal:`index[0].parts[`:codeitalic:`N`:codenormal:`].fieldno` is always the field number for key part :codeitalic:`N`, fun.map() is creating a table from the primary-key values of the tuple. -The result of fun.map() is passed to :func:`space_object:delete() <space_object.delete>`. +The result of fun.map() is passed to :ref:`space_object:delete() <box_space-delete>`. .. code-block:: lua @@ -103,8 +103,8 @@ expirationd through the test. os.exit() The database-specific requests (``cfg``, -:ref:`space.create <schema-space-create>`, -:func:`create_index <space_object.create_index>`) +:ref:`space.create <box_schema-space_create>`, +:ref:`create_index <box_space-create_index>`) should already be familiar. The function which will be supplied to expirationd is diff --git a/doc/sphinx/reference/fiber.rst b/doc/sphinx/reference/fiber.rst index 1f4e8505f5fd4498f20a1855762e950c389b040e..7645a0966b6dc763308469655559ee37e9239713 100644 --- a/doc/sphinx/reference/fiber.rst +++ b/doc/sphinx/reference/fiber.rst @@ -8,27 +8,27 @@ A fiber is a set of instructions which are executed with cooperative multitasking. Fibers managed by the fiber package are associated with a user-supplied function called the *fiber function*. A fiber has three possible states: **running**, **suspended** or **dead**. -When a fiber is created with :func:`fiber.create()`, it is running. -When a fiber yields control with :func:`fiber.sleep()`, it is suspended. +When a fiber is created with :ref:`fiber.create() <fiber-create>`, it is running. +When a fiber yields control with :ref:`fiber.sleep() <fiber-sleep>`, it is suspended. When a fiber ends (because the fiber function ends), it is dead. All fibers are part of the fiber registry. This registry can be searched -with :func:`fiber.find()` - via fiber id (fid), which is a numeric identifier. - -A runaway fiber can be stopped with :func:`fiber_object.cancel`. However, -:func:`fiber_object.cancel` is advisory — it works only if the runaway fiber -calls :func:`fiber.testcancel()` occasionally. Most ``box.*`` functions, such -as :func:`box.space...delete() <space_object.delete>` or -:func:`box.space...update() <space_object.update>`, do call -:func:`fiber.testcancel()` but :func:`box.space...select{} <space_object.select>` +with :ref:`fiber.find() <fiber-find>` - via fiber id (fid), which is a numeric identifier. + +A runaway fiber can be stopped with :ref:`fiber_object.cancel <fiber-cancel>`. However, +:ref:`fiber_object.cancel <fiber-cancel>` is advisory — it works only if the runaway fiber +calls :ref:`fiber.testcancel() <fiber-testcancel>` occasionally. Most ``box.*`` functions, such +as :ref:`box.space...delete() <box_space-delete>` or +:ref:`box.space...update() <box_space-update>`, do call +:ref:`fiber.testcancel() <fiber-testcancel>` but :ref:`box.space...select{} <box_space-select>` does not. In practice, a runaway fiber can only become unresponsive if it does many computations and does not check whether it has been cancelled. The other potential problem comes from fibers which never get scheduled, because they are not subscribed to any events, or because no relevant -events occur. Such morphing fibers can be killed with :func:`fiber.kill()` -at any time, since :func:`fiber.kill()` sends an asynchronous wakeup event -to the fiber, and :func:`fiber.testcancel()` is checked whenever such a +events occur. Such morphing fibers can be killed with :ref:`fiber.kill() <fiber-kill>` +at any time, since :ref:`fiber.kill() <fiber-kill>` sends an asynchronous wakeup event +to the fiber, and :ref:`fiber.testcancel() <fiber-testcancel>` is checked whenever such a wakeup event occurs. Like all Lua objects, dead fibers are garbage collected. The garbage collector @@ -45,6 +45,8 @@ recommended. .. module:: fiber +.. _fiber-create: + .. function:: create(function [, function-arguments]) Create and start a fiber. The fiber is created and begins to run immediately. @@ -72,6 +74,8 @@ recommended. ... +.. _fiber-self: + .. function:: self() :Return: fiber object for the currently scheduled fiber. @@ -88,6 +92,8 @@ recommended. id: 101 ... +.. _fiber-find: + .. function:: find(id) :param id: numeric identifier of the fiber. @@ -127,7 +133,7 @@ recommended. .. function:: yield() - Yield control to the scheduler. Equivalent to :func:`fiber.sleep(0) <fiber.sleep>`. + Yield control to the scheduler. Equivalent to :ref:`fiber.sleep(0) <fiber-sleep>`. Example: @@ -137,6 +143,8 @@ recommended. --- ... +.. _fiber-status: + .. function:: status() Return the status of the current fiber. @@ -153,6 +161,8 @@ recommended. - running ... +.. _fiber-info: + .. function:: info() Return information about all fibers. @@ -177,11 +187,13 @@ recommended. name: interactive ... +.. _fiber-kill: + .. function:: kill(id) Locate a fiber by its numeric id and cancel it. In other words, - :func:`fiber.kill()` combines :func:`fiber.find()` and - :func:`fiber_object:cancel() <fiber_object.cancel>`. + :ref:`fiber.kill() <fiber-kill>` combines :ref:`fiber.find() <fiber-find>` and + :ref:`fiber_object:cancel() <fiber-cancel>`. :param id: the id of the fiber to be cancelled. :Exception: the specified fiber does not exist or cancel is not permitted. @@ -213,10 +225,12 @@ recommended. .. class:: fiber_object + .. _fiber-id: + .. method:: id() :param self: fiber object, for example the fiber object returned - by :func:`fiber.create` + by :ref:`fiber.create <fiber-create>` :Return: id of the fiber. :Rtype: number @@ -235,7 +249,7 @@ recommended. .. method:: name() :param self: fiber object, for example the fiber object returned - by :func:`fiber.create` + by :ref:`fiber.create <fiber-create>` :Return: name of the fiber. :Rtype: string @@ -252,12 +266,12 @@ recommended. Change the fiber name. By default the Tarantool server's interactive-mode fiber is named 'interactive' and new - fibers created due to :func:`fiber.create` are named 'lua'. + fibers created due to :ref:`fiber.create <fiber-create>` are named 'lua'. Giving fibers distinct names makes it easier to - distinguish them when using :func:`fiber.info`. + distinguish them when using :ref:`fiber.info <fiber-info>`. :param self: fiber object, for example the fiber - object returned by :func:`fiber.create` + object returned by :ref:`fiber.create <fiber-create>` :param string name: the new name of the fiber. :Return: nil @@ -270,12 +284,14 @@ recommended. --- ... + .. _fiber-status: + .. method:: status() Return the status of the specified fiber. :param self: fiber object, for example the fiber object returned by - :func:`fiber.create` + :ref:`fiber.create <fiber-create>` :Return: the status of fiber. One of: “deadâ€, “suspendedâ€, or “runningâ€. :Rtype: string @@ -289,15 +305,17 @@ recommended. - running ... + .. _fiber-cancel: + .. method:: cancel() Cancel a fiber. Running and suspended fibers can be cancelled. After a fiber has been cancelled, attempts to operate on it will - cause errors, for example :func:`fiber_object:id() <fiber_object.id>` + cause errors, for example :ref:`fiber_object:id() <fiber-id>` will cause ``error: the fiber is dead``. :param self: fiber object, for example the fiber - object returned by :func:`fiber.create` + object returned by :ref:`fiber.create <fiber-create>` :Return: nil @@ -312,6 +330,8 @@ recommended. - error: fiber is cancelled ... + .. _fiber-storage: + .. data:: storage Local storage within the fiber. The storage can contain any number of @@ -320,7 +340,7 @@ recommended. or with a number :samp:`{fiber_object}.storage[{number}]`. Values may be either numbers or strings. The storage is garbage-collected when :samp:`{fiber_object}:cancel()` happens. |br| - See also :data:`box.session.storage <box.session.storage>`. + See also :ref:`box.session.storage <box_session-storage>`. **Example:** @@ -375,6 +395,8 @@ recommended. - 1448466279.2415 ... +.. _fiber-time64: + .. function:: time64() :Return: current system time (in microseconds since the epoch) @@ -392,10 +414,6 @@ recommended. - 1448466351270762 ... -.. function:: info() - - Show all running fibers, with their stack. Mainly useful for debugging. - ================================================= Example Of Fiber Use ================================================= @@ -403,7 +421,7 @@ recommended. Make the function which will be associated with the fiber. This function contains an infinite loop (``while 0 == 0`` is always true). Each iteration of the loop adds 1 to a global variable named gvar, then goes to sleep for -2 seconds. The sleep causes an implicit :func:`fiber.yield()`. +2 seconds. The sleep causes an implicit :ref:`fiber.yield() <fiber-yield>`. .. code-block:: tarantoolsession diff --git a/doc/sphinx/reference/json.rst b/doc/sphinx/reference/json.rst index 22a7a68737387ad5a7a8352e9361fc8ca5499ad2..ffb057ca3ac36211ddc80483805cf34544c9ab4d 100644 --- a/doc/sphinx/reference/json.rst +++ b/doc/sphinx/reference/json.rst @@ -10,6 +10,8 @@ The json package provides JSON manipulation routines. It is based on the .. module:: json +.. _json-encode: + .. function:: encode(lua-value) Convert a Lua object to a JSON string. @@ -46,6 +48,8 @@ The json package provides JSON manipulation routines. It is based on the - '{"hello":["world"]}' ... +.. _json-decode: + .. function:: decode(string) Convert a JSON string to a Lua object. @@ -74,6 +78,8 @@ The json package provides JSON manipulation routines. It is based on the - world ... +.. _json-null: + .. data:: NULL A value comparable to Lua "nil" which may be useful as a placeholder in a tuple. diff --git a/doc/sphinx/reference/log.rst b/doc/sphinx/reference/log.rst index 9b5e32ed65559ab011da55552cf9533dea40e6ef..0332c4024c463201c90eb569ba1630b6b03729b7 100644 --- a/doc/sphinx/reference/log.rst +++ b/doc/sphinx/reference/log.rst @@ -1,3 +1,5 @@ +.. _log: + ------------------------------------------------------------------------------- Package `log` ------------------------------------------------------------------------------- @@ -5,7 +7,7 @@ .. module:: log The Tarantool server puts all diagnostic messages in a log file specified by -the :ref:`logger <log-label>` configuration parameter. Diagnostic messages may be either +the :ref:`logger <cfg_logging-logger>` configuration parameter. Diagnostic messages may be either system-generated by the server's internal code, or user-generated with the ``log.log_level_function_name`` function. @@ -14,7 +16,7 @@ system-generated by the server's internal code, or user-generated with the info(message) debug(message) - Output a user-generated message to the :ref:`log file <log-label>`, given + Output a user-generated message to the :ref:`log file <cfg_logging-logger>`, given log_level_function_name = ``error`` or ``warn`` or ``info`` or ``debug``. :param string message: The actual output will be a line containing the @@ -22,12 +24,14 @@ system-generated by the server's internal code, or user-generated with the 'I' or 'D' or 'R' depending on ``log_level_function_name``, and ``message``. Output will not occur if ``log_level_function_name`` - is for a type greater than :ref:`log_level <log-label>`. + is for a type greater than :ref:`log_level <cfg_logging-log_level>`. Messages may contain C-style format specifiers %d or %s, so :samp:`log.error('...%d...%s',{x},{y})` will work if x is a number and y is a string. :return: nil +.. _log-logger_pid: + .. function:: logger_pid() .. function:: rotate() diff --git a/doc/sphinx/reference/msgpack.rst b/doc/sphinx/reference/msgpack.rst index 77c7ce2d5e77698fe9d5862422c13acb1a1f37e8..950fd58c3537c3f62619e0b78035f1000cebe6ac 100644 --- a/doc/sphinx/reference/msgpack.rst +++ b/doc/sphinx/reference/msgpack.rst @@ -25,6 +25,8 @@ takes a series of non-MsgPack values and encodes them. :return: the original contents formatted as a Lua table. :rtype: table +.. _msgpack-null: + .. data:: NULL A value comparable to Lua "nil" which may be useful as a placeholder in a tuple. diff --git a/doc/sphinx/reference/net_box.rst b/doc/sphinx/reference/net_box.rst index f15b159973310378195d9c6d1fc85be1bef5673c..a2b3e91ed33ba827a72c3e3074ed198c7beb8e37 100644 --- a/doc/sphinx/reference/net_box.rst +++ b/doc/sphinx/reference/net_box.rst @@ -14,7 +14,7 @@ Call ``require('net.box')`` to get a ``net.box`` object, which will be called ``net_box`` for examples in this section. Call ``net_box.new()`` to connect and get a connection object, which will be called ``conn`` for examples in this section. Call the other ``net.box()`` routines, passing ``conn:``, to execute requests on -the remote box. Call :func:`conn:close <socket_object.close>` to disconnect. +the remote box. Call :ref:`conn:close <socket-close>` to disconnect. All ``net.box`` methods are fiber-safe, that is, it is safe to share and use the same connection object across multiple concurrent fibers. In fact, it's perhaps diff --git a/doc/sphinx/reference/other.rst b/doc/sphinx/reference/other.rst index 90fcae0dbc7c44e5f0f7c33152152778952a1f1f..05fa0907e3d6fe0acfdc22dd70ad15887b495a36 100644 --- a/doc/sphinx/reference/other.rst +++ b/doc/sphinx/reference/other.rst @@ -2,6 +2,8 @@ Miscellaneous ------------------------------------------------------------------------------- +.. _other-tonumber64: + .. function:: tonumber64(value) Convert a string or a Lua number to a 64-bit integer. The result can be diff --git a/doc/sphinx/reference/socket.rst b/doc/sphinx/reference/socket.rst index 2dff13bf145db1131651b01f728977ca587f4e27..2d0754ffad2b32300c216b43135b5944c9c5b1aa 100644 --- a/doc/sphinx/reference/socket.rst +++ b/doc/sphinx/reference/socket.rst @@ -30,57 +30,57 @@ are ``errno``, ``error``. +================+===============================================================+ | setup | :ref:`socket() <socket-socket>` | +----------------+---------------------------------------------------------------+ - | "" | :func:`socket.tcp_connect() <socket.tcp_connect>` | + | "" | :ref:`socket.tcp_connect() <socket-tcp_connect>` | +----------------+---------------------------------------------------------------+ - | "" | :func:`socket.tcp_server() <socket.tcp_server>` | + | "" | :ref:`socket.tcp_server() <socket-tcp_server>` | +----------------+---------------------------------------------------------------+ - | "" | :func:`socket_object:sysconnect() <socket_object.sysconnect>` | + | "" | :ref:`socket_object:sysconnect() <socket-sysconnect>` | +----------------+---------------------------------------------------------------+ - | "" | :func:`socket_object:send() <socket_object.send>` | + | "" | :ref:`socket_object:send() <socket-send>` | +----------------+---------------------------------------------------------------+ - | sending | :func:`socket_object:sendto() <socket_object.sendto>` | + | sending | :ref:`socket_object:sendto() <socket-sendto>` | +----------------+---------------------------------------------------------------+ - | "" | :func:`socket_object:write() <socket_object.write>` | + | "" | :ref:`socket_object:write() <socket-send>` | +----------------+---------------------------------------------------------------+ - | "" | :func:`socket_object:syswrite() <socket_object.syswrite>` | + | "" | :ref:`socket_object:syswrite() <socket-syswrite>` | +----------------+---------------------------------------------------------------+ - | receiving | :func:`socket_object:recv() <socket_object.recv>` | + | receiving | :ref:`socket_object:recv() <socket-recv>` | +----------------+---------------------------------------------------------------+ - | "" | :func:`socket_object:recvfrom() <socket_object.recvfrom>` | + | "" | :ref:`socket_object:recvfrom() <socket-recvfrom>` | +----------------+---------------------------------------------------------------+ - | "" | :func:`socket_object:read() <socket_object.read>` | + | "" | :ref:`socket_object:read() <socket-read>` | +----------------+---------------------------------------------------------------+ - | flag setting | :func:`socket_object:nonblock() <socket_object.nonblock>` | + | flag setting | :ref:`socket_object:nonblock() <socket-nonblock>` | +----------------+---------------------------------------------------------------+ - | "" | :func:`socket_object:setsockopt() <socket_object.setsockopt>` | + | "" | :ref:`socket_object:setsockopt() <socket-setsockopt>` | +----------------+---------------------------------------------------------------+ - | "" | :func:`socket_object:linger() <socket_object.linger>` | + | "" | :ref:`socket_object:linger() <socket-linger>` | +----------------+---------------------------------------------------------------+ - | client/server | :func:`socket_object:listen() <socket_object.listen>` | + | client/server | :ref:`socket_object:listen() <socket-listen>` | +----------------+---------------------------------------------------------------+ - | "" | :func:`socket_object:accept() <socket_object.accept>` | + | "" | :ref:`socket_object:accept() <socket-accept>` | +----------------+---------------------------------------------------------------+ - | teardown | :func:`socket_object:shutdown() <socket_object.shutdown>` | + | teardown | :ref:`socket_object:shutdown() <socket-shutdown>` | +----------------+---------------------------------------------------------------+ - | "" | :func:`socket_object:close() <socket_object.close>` | + | "" | :ref:`socket_object:close() <socket-close>` | +----------------+---------------------------------------------------------------+ - | error checking | :func:`socket_object:error() <socket_object.error>` | + | error checking | :ref:`socket_object:error() <socket-error>` | +----------------+---------------------------------------------------------------+ - | "" | :func:`socket_object:errno() <socket_object.errno>` | + | "" | :ref:`socket_object:errno() <socket-error>` | +----------------+---------------------------------------------------------------+ - | information | :func:`socket.getaddrinfo() <socket.getaddrinfo>` | + | information | :ref:`socket.getaddrinfo() <socket-getaddrinfo>` | +----------------+---------------------------------------------------------------+ - | "" | :func:`socket_object:getsockopt() <socket_object.getsockopt>` | + | "" | :ref:`socket_object:getsockopt() <socket-getsockopt>` | +----------------+---------------------------------------------------------------+ - | "" | :func:`socket_object:peer() <socket_object.peer>` | + | "" | :ref:`socket_object:peer() <socket-peer>` | +----------------+---------------------------------------------------------------+ - | "" | :func:`socket_object:name() <socket_object.name>` | + | "" | :ref:`socket_object:name() <socket-name>` | +----------------+---------------------------------------------------------------+ - | state checking | :func:`socket_object:readable() <socket_object.readable>` | + | state checking | :ref:`socket_object:readable() <socket-readable>` | +----------------+---------------------------------------------------------------+ - | "" | :func:`socket_object:writable() <socket_object.writable>` | + | "" | :ref:`socket_object:writable() <socket-writable>` | +----------------+---------------------------------------------------------------+ - | "" | :func:`socket_object:wait() <socket_object.wait>` | + | "" | :ref:`socket_object:wait() <socket-wait>` | +----------------+---------------------------------------------------------------+ Typically a socket session will begin with the setup functions, will set one @@ -110,6 +110,8 @@ the function invocations will look like ``sock:function_name(...)``. Example: |br| :codenormal:`socket('AF_INET', 'SOCK_STREAM', 'tcp')` +.. _socket-tcp_connect: + .. function:: tcp_connect(host[, port]) Connect a socket to a remote host. @@ -122,6 +124,7 @@ the function invocations will look like ``sock:function_name(...)``. Example: |br| :codenormal:`tcp_connect('127.0.0.1', 3301)` +.. _socket-getaddrinfo: .. function:: getaddrinfo(host, type, [, {option-list}]) @@ -151,6 +154,8 @@ the function invocations will look like ``sock:function_name(...)``. port: 80 ... +.. _socket-tcp_server: + .. function:: tcp_server(host, port, handler-function) The ``socket.tcp_server()`` function makes Tarantool act as a server that @@ -162,6 +167,8 @@ the function invocations will look like ``sock:function_name(...)``. .. class:: socket_object + .. _socket-sysconnect: + .. method:: sysconnect(host, port) Connect an existing socket to a remote host. The argument values are the same as @@ -191,6 +198,8 @@ the function invocations will look like ``sock:function_name(...)``. :codenormal:`sock = socket('AF_INET', 'SOCK_STREAM', 'tcp')` |br| :codenormal:`sock:sysconnect(0, 3301)` + .. _socket-send: + .. method:: send(data) write(data) @@ -202,11 +211,15 @@ the function invocations will look like ``sock:function_name(...)``. Possible errors: nil on error. + .. _socket-syswrite: + .. method:: syswrite(size) Write as much as possible data to the socket buffer if non-blocking. Rarely used. For details see `this description`_. + .. _socket-recv: + .. method:: recv(size) Read ``size`` bytes from a connected socket. An internal read-ahead @@ -221,6 +234,8 @@ the function invocations will look like ``sock:function_name(...)``. end, returns the remainder read from the socket (possibly an empty string), followed by "eof" status. + .. _socket-read: + .. method:: read(limit [, timeout]) read(delimiter [, timeout]) read({limit=limit} [, timeout]) @@ -245,15 +260,19 @@ the function invocations will look like ``sock:function_name(...)``. expression. :rtype: string + .. _socket-sysread: + .. method:: sysread(size) Return all available data from the socket buffer if non-blocking. Rarely used. For details see `this description`_. + .. _socket-bind: + .. method:: bind(host [, port]) Bind a socket to the given host/port. A UDP socket after binding - can be used to receive data (see :func:`socket_object.recvfrom`). + can be used to receive data (see :ref:`socket_object.recvfrom <socket-recvfrom>`). A TCP socket can be used to accept new connections, after it has been put in listen mode. @@ -265,6 +284,7 @@ the function invocations will look like ``sock:function_name(...)``. Possible errors: Returns nil, status, errno, errstr on error. + .. _socket-listen: .. method:: listen(backlog) @@ -277,6 +297,8 @@ the function invocations will look like ``sock:function_name(...)``. :return: true for success, false for error. :rtype: boolean. + .. _socket-accept: + .. method:: accept() Accept a new client connection and create a new connected socket. @@ -288,6 +310,8 @@ the function invocations will look like ``sock:function_name(...)``. Possible errors: nil. + .. _socket-sendto: + .. method:: sendto(host, port, data) Send a message on a UDP socket to a specified host. @@ -301,6 +325,8 @@ the function invocations will look like ``sock:function_name(...)``. Possible errors: on error, returns status, errno, errstr. + .. _socket-recvfrom: + .. method:: recvfrom(limit) Receive a message on a UDP socket. @@ -320,6 +346,8 @@ the function invocations will look like ``sock:function_name(...)``. ``message_sender.family = 'AF_INET'``, ``message_sender.port = 43065``. + .. _socket-shutdown: + .. method:: shutdown(how) Shutdown a reading end, a writing end, or both ends of a socket. @@ -329,6 +357,8 @@ the function invocations will look like ``sock:function_name(...)``. :return: true or false. :rtype: boolean + .. _socket-close: + .. method:: close() Close (destroy) a socket. A closed socket should not be used any more. @@ -338,6 +368,8 @@ the function invocations will look like ``sock:function_name(...)``. sock is already closed, sock:close() returns false. :rtype: boolean + .. _socket-error: + .. method:: error() errno() @@ -348,6 +380,8 @@ the function invocations will look like ``sock:function_name(...)``. If there is no error, then ``sock:errno()`` will return 0 and ``sock:error()``. :rtype: number, string + .. _socket-setsockopt: + .. method:: setsockopt(level, name, value) Set socket flags. The argument values are the same as in the @@ -382,10 +416,14 @@ the function invocations will look like ``sock:function_name(...)``. Setting SO_LINGER is done with ``sock:linger(active)``. + .. _socket-getsockopt: + .. method:: getsockopt(level, name) Get socket flags. For a list of possible flags see ``sock:setsockopt()``. + .. _socket-linger: + .. method:: linger([active]) Set or clear the SO_LINGER flag. For a description of the flag, see @@ -395,6 +433,8 @@ the function invocations will look like ``sock:function_name(...)``. :return: new active and timeout values. + .. _socket-nonblock: + .. method:: nonblock([flag]) ``sock:nonblock()`` returns the current flag value. |br| @@ -403,24 +443,32 @@ the function invocations will look like ``sock:function_name(...)``. This function may be useful before invoking a function which might otherwise block indefinitely. + .. _socket-readable: + .. method:: readable([timeout]) Wait until something is readable, or until a timeout value expires. :return: true if the socket is now readable, false if timeout expired; + .. _socket-writable: + .. method:: writable([timeout]) Wait until something is writable, or until a timeout value expires. :return: true if the socket is now writable, false if timeout expired; + .. _socket-wait: + .. method:: wait([timeout]) Wait until something is either readable or writable, or until a timeout value expires. :return: 'R' if the socket is now readable, 'W' if the socket is now writable, 'RW' if the socket is now both readable and writable, '' (empty string) if timeout expired; + .. _socket-name: + .. method:: name() The ``sock:name()`` function is used to get information about the @@ -431,6 +479,8 @@ the function invocations will look like ``sock:function_name(...)``. :return: A table containing these fields: "host", "family", "type", "protocol", "port". :rtype: table + .. _socket-peer: + .. method:: peer() The ``sock:peer()`` function is used to get information about the far side of a connection. diff --git a/doc/sphinx/reference/tarantool.rst b/doc/sphinx/reference/tarantool.rst index 770f670795a6fb52ffc7f659a030b4a368271e34..f2e0e38711a3935fcbdc09449b0e042d6c4a4085 100644 --- a/doc/sphinx/reference/tarantool.rst +++ b/doc/sphinx/reference/tarantool.rst @@ -11,7 +11,7 @@ version of the compiler". .. _tarantool-build: Additionally one can see the uptime and the server version and the process id. -Those information items can also be accessed with :func:`box.info` but use of +Those information items can also be accessed with :ref:`box.info <box_introspection-box_info>` but use of the tarantool package is recommended. **Example:** diff --git a/doc/sphinx/reference/uuid.rst b/doc/sphinx/reference/uuid.rst index 6415b2320458fd9ca1a2ef22aeef79325b290ec9..c436ec212aded4377c6e3674acf8a8aa48a89c84 100644 --- a/doc/sphinx/reference/uuid.rst +++ b/doc/sphinx/reference/uuid.rst @@ -10,20 +10,20 @@ applications, UUIDs are better. The functions that can return a UUID are: - * :func:`uuid() <uuid.__call>` - * :func:`uuid.bin()` - * :func:`uuid.str()` + * :ref:`uuid() <uuid-__call>` + * :ref:`uuid.bin() <uuid-bin>` + * :ref:`uuid.str() <uuid-str>` The functions that can convert between different types of UUID are: - * :func:`uuid_object:bin() <uuid_object.bin>` - * :func:`uuid_object:str() <uuid_object.str>` - * :func:`uuid.fromstr()` - * :func:`uuid.frombin()` + * :ref:`uuid_object:bin() <uuid-object_bin>` + * :ref:`uuid_object:str() <uuid-object_str>` + * :ref:`uuid.fromstr() <uuid-fromstr>` + * :ref:`uuid.frombin() <uuid-frombin>` The function that can determine whether a UUID is an all-zero value is: - * :func:`uuid_object:isnil() <uuid_object.isnil>` + * :ref:`uuid_object:isnil() <uuid-isnil>` .. module:: uuid @@ -31,27 +31,37 @@ The function that can determine whether a UUID is an all-zero value is: A nil object +.. _uuid-__call: + .. function:: __call() :return: a UUID :rtype: cdata +.. _uuid-bin: + .. function:: bin() :return: a UUID :rtype: 16-byte string +.. _uuid-str: + .. function:: str() :return: a UUID :rtype: 36-byte binary string +.. _uuid-fromstr: + .. function:: fromstr(uuid_str) :param uuid_str: UUID in 36-byte hexadecimal string :return: converted UUID :rtype: cdata +.. _uuid-frombin: + .. function:: frombin(uuid_bin) :param uuid_str: UUID in 16-byte binary string @@ -60,6 +70,8 @@ The function that can determine whether a UUID is an all-zero value is: .. class:: uuid_object + .. _uuid-object_bin: + .. method:: bin([byte-order]) :param byte-order: |br| 'l' - little-endian, @@ -70,11 +82,15 @@ The function that can determine whether a UUID is an all-zero value is: :return: UUID converted from cdata input value. :rtype: 16-byte binary string + .. _uuid-object_str: + .. method:: str() :return: UUID converted from cdata input value. :rtype: 36-byte hexadecimal string + .. _uuid-isnil: + .. method:: isnil() The all-zero UUID value can be expressed as uuid.NULL, or as diff --git a/doc/sphinx/reference/yaml.rst b/doc/sphinx/reference/yaml.rst index 98aa7c93e45a798b58685914c29a6e34919e3992..1f8f4f7fa8dad0243dec15318cac90936f07b2ca 100644 --- a/doc/sphinx/reference/yaml.rst +++ b/doc/sphinx/reference/yaml.rst @@ -25,6 +25,8 @@ series of non-YAML values and encodes them. :return: the original contents formatted as a Lua table. :rtype: table +.. _yaml-null: + .. data:: NULL A value comparable to Lua "nil" which may be useful as a placeholder in a tuple.