-
Notifications
You must be signed in to change notification settings - Fork 43
Add config.storage
client and config.storage TTL option
#5116
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: latest
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -395,12 +395,16 @@ The ``config.storage`` API allows you to interact with a Tarantool-based :ref:`c | |
|
||
.. _config_storage_api_reference_put: | ||
|
||
.. function:: put(path, value) | ||
.. function:: put(path, value, opts) | ||
|
||
Put a value by the specified path. | ||
|
||
:param string path: a path to put the value by | ||
:param string value: a value to put | ||
:param table opts: a table containing the following optional fields: | ||
|
||
* ``ttl`` (since :doc:`3.2.0 </release/3.2.0>`, default: unset): time-to-live in seconds, if nil or not set the key won't expire, may issue an error if set on config.storage running old schema, see :ref:`config.storage.info <config_storage_api_reference_info>`. | ||
Comment on lines
+404
to
+406
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
||
|
||
:return: a table containing the following fields: | ||
|
||
|
@@ -516,9 +520,25 @@ The ``config.storage`` API allows you to interact with a Tarantool-based :ref:`c | |
* ``connected``: if any instance from the quorum is available to the current instance | ||
* ``disconnected``: if the current instance doesn't have a connection with the quorum | ||
|
||
* ``features`` (since :doc:`3.2.0 </release/3.2.0>`): a table of features config.storage supports, may include the following: | ||
|
||
* ``ttl``: true if key TTL (time-to-live) is supported, false otherwise if the schema hasn't been upgraded yet | ||
Comment on lines
+523
to
+525
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
||
|
||
:rtype: table | ||
|
||
|
||
**Example:** | ||
|
||
The example below shows how to check whether config.storage supports keys TTL: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The example below shows how to check whether |
||
|
||
.. code-block:: lua | ||
|
||
local info = config.storage.info | ||
if info.features == nil or not info.features.ttl then | ||
error('...') | ||
end | ||
|
||
.. _config_storage_api_reference_txn: | ||
|
||
.. function:: txn(request) | ||
|
@@ -542,6 +562,17 @@ The ``config.storage`` API allows you to interact with a Tarantool-based :ref:`c | |
|
||
* ``on_failure``: a list with operations to execute if any of a predicate evaluates to ``false`` | ||
|
||
Operations in ``on_success`` and ``on_failure`` follow the format: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Operations in |
||
|
||
.. code-block:: none | ||
|
||
{operation, key_or_path[, value][, opts]} | ||
|
||
* ``operation``: one of ``'put'``, ``'get'``, ``'delete'`` | ||
* ``opts``: a table containing optional fields for the operations: | ||
|
||
* ``ttl`` (since :doc:`3.2.0 </release/3.2.0>`, default: unset): time-to-live for a key in seconds, if nil or not set the key won't expire | ||
Comment on lines
+571
to
+574
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
||
:return: a table containing the following fields: | ||
|
||
* ``data``: a table containing response data: | ||
|
@@ -608,12 +639,17 @@ Examples on GitHub: `config_storage <https://github.com/tarantool/doc/tree/lates | |
|
||
.. _config_storage_client_api_reference_put: | ||
|
||
.. function:: <config.storage client>:put(path, value) | ||
.. function:: <config.storage client>:put(path, value, opts) | ||
|
||
Put a value by the specified path to remote config.storage. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Put a value by the specified path to a remote |
||
|
||
:param string path: a path to put the value by | ||
:param string value: a value to put | ||
:param table opts: a table containing the following optional fields: | ||
|
||
* ``ttl`` (since :doc:`3.2.0 </release/3.2.0>`, default: unset): time-to-live in seconds, if nil or not set the key won't expire, may issue an error if set on config.storage running old schema, see :ref:`<config.storage client>.info <config_storage_client_api_reference_info>`. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
||
|
||
|
||
:return: a table containing the following fields: | ||
|
||
|
@@ -727,9 +763,26 @@ Get information about a connection state to the config.storage cluster. | |
* ``connected``: if any instance from the quorum is available to the current instance | ||
* ``disconnected``: if the current instance doesn't have a connection with the quorum | ||
|
||
* ``features`` (since :doc:`3.2.0 </release/3.2.0>`): a table of features config.storage supports, may include the following: | ||
|
||
* ``ttl``: true if key TTL (time-to-live) is supported, false otherwise if the schema hasn't been upgraded yet | ||
Comment on lines
+766
to
+768
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
||
|
||
:rtype: table | ||
|
||
|
||
**Example:** | ||
|
||
The example below shows how to check whether remote config.storage supports keys TTL: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The example below shows how to check whether the remote |
||
|
||
.. code-block:: lua | ||
|
||
local info = storage_client.info | ||
if info.features == nil or not info.features.ttl then | ||
error('...') | ||
end | ||
|
||
|
||
.. _config_storage_client_api_reference_txn: | ||
|
||
.. function:: <config.storage client>:txn(request) | ||
|
@@ -753,6 +806,18 @@ Make an atomic request on remote config.storage. | |
|
||
* ``on_failure``: a list with operations to execute if any of a predicate evaluates to ``false`` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
||
Operations in ``on_success`` and ``on_failure`` follow the format: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
||
.. code-block:: none | ||
|
||
{operation, key_or_path[, value][, opts]} | ||
|
||
* ``operation``: one of ``'put'``, ``'get'``, ``'delete'`` | ||
* ``opts``: a table containing optional fields for the operations: | ||
|
||
* ``ttl`` (since :doc:`3.2.0 </release/3.2.0>`, default: unset): time-to-live for a key in seconds, if nil or not set the key won't expire | ||
Comment on lines
+815
to
+818
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
||
|
||
:return: a table containing the following fields: | ||
|
||
* ``data``: a table containing response data: | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AFAIR, we discussed a lot the following corner cases:
put
of this key with TTL do?put
of this key without TTL do?put
this key with a TTL that expires at time T1 < T, whether the expire occurs on T1 or T? How about T2 > T?I would like if the API documentation would describe a behavior in these scenarios.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have changed the doc as follows.