Implement net.replicaset base watcher API
That's a MVP so only part of the design document is implemented. Only `watch_leader` method is implemented. Watch leader is a net.box-like subscription that receives events only from known leader. If the leader is changed - there's a short-time probability to receive a notification from the previous one, but there's a guarantee that once a new leader becomes known for the net.replicaset - a new update with the new leader will be called. While the leader is not known (no or more than one RW instance is known) - the subscription callback is not called. The usage is quite simple: ``` local net_replicaset = require('internal.net.replicaset') local rs = net_replicaset.connect(replicaset_name) -- Define event handling function. local function func(key, value, instance_name) ... end -- Watch some_key. local watcher = rs:watch_leader(some_key, func) -- Stop watch. watcher:unregister() ``` Closes #9823 NO_DOC=internal NO_CHANGELOG=internal
Loading
Please register or sign in to comment