Skip to content

Commit 30ff046

Browse files
authored
Add description of vshard.enable/disable() (#3025)
* Add description of enabling/disabling the automatic and manual router APIs Resolves #3012
1 parent 13cfecb commit 30ff046

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

doc/reference/reference_rock/vshard/vshard_router.rst

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ Router API
3131
| | * :ref:`vshard.router.discovery_set() <router_api-discovery_set>` |
3232
| | * :ref:`vshard.router.info() <router_api-info>` |
3333
| | * :ref:`vshard.router.buckets_info() <router_api-buckets_info>` |
34+
| | * :ref:`vshard.router.enable() <router_api-enable>` |
35+
| | * :ref:`vshard.router.disable() <router_api-disable>` |
3436
| | * :ref:`replicaset_object:call() <router_api-replicaset_call>` |
3537
| | * :ref:`replicaset_object:callro() <router_api-replicaset_callro>` |
3638
| | * :ref:`replicaset_object:callrw() <router_api-replicaset_callrw>` |
@@ -768,6 +770,46 @@ Router public API
768770
status: available_rw
769771
...
770772
773+
.. _router_api-enable:
774+
775+
.. function:: vshard.router.enable()
776+
777+
Manually allow access to the router API, revert
778+
:ref:`vshard.router.disable() <router_api-disable>`.
779+
780+
.. note::
781+
782+
``vshard.router.enable()`` cannot be used for enabling a router
783+
API that was automatically disabled due to a running configuration
784+
process.
785+
786+
.. _router_api-disable:
787+
788+
.. function:: vshard.router.disable()
789+
790+
Manually restrict access to the router API. When the API is disabled,
791+
all its methods throw a Lua error, except
792+
:ref:`vshard.router.cfg() <router_api-cfg>`,
793+
:ref:`vshard.router.new() <router_api-new>`,
794+
:ref:`vshard.router.enable() <router_api-enable>` and
795+
:ref:`vshard.router.disable() <router_api-disable>`.
796+
The error object's name attribute is ``ROUTER_IS_DISABLED``.
797+
798+
The router is enabled by default. However, it is automatically and
799+
forcefully disabled until the configuration is finished, as accessing the
800+
router's methods at that time is not safe.
801+
802+
Manual disabling can be used, for example, if some preparatory work needs
803+
to be done after calling :ref:`vshard.router.cfg() <router_api-cfg>` but
804+
before the router's methods are available. It will look like this:
805+
806+
.. code-block:: lua
807+
808+
vshard.router.disable()
809+
vshard.router.cfg(...)
810+
-- Some preparatory work here ...
811+
vshard.router.enable()
812+
-- vshard.router's methods are available now
771813
772814
.. class:: replicaset_object
773815

0 commit comments

Comments
 (0)