@@ -31,6 +31,8 @@ Router API
31
31
| | * :ref: `vshard.router.discovery_set() <router_api-discovery_set >` |
32
32
| | * :ref: `vshard.router.info() <router_api-info >` |
33
33
| | * :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 >` |
34
36
| | * :ref: `replicaset_object:call() <router_api-replicaset_call >` |
35
37
| | * :ref: `replicaset_object:callro() <router_api-replicaset_callro >` |
36
38
| | * :ref: `replicaset_object:callrw() <router_api-replicaset_callrw >` |
@@ -768,6 +770,46 @@ Router public API
768
770
status: available_rw
769
771
...
770
772
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
771
813
772
814
.. class :: replicaset_object
773
815
0 commit comments