Skip to content
Snippets Groups Projects
Commit e8b9dffc authored by Vladimir Davydov's avatar Vladimir Davydov Committed by Vladimir Davydov
Browse files

box: implement watcher infrastructure

Part of #6257

This commit introduces a C module that will later be used for
implementation of the watchers API in both Lua and IPROTO.

Key points:
 - A watcher callback can be registered for an arbitrary string key with
   box_register_watcher().
 - Watcher callbacks are invoked in the background by the worker fiber.
   If a watcher is asynchronous (WATCHER_RUN_ASYNC flag set), the worker
   fiber will invoke the callback in a new fiber.
 - A newly registered watcher callback is scheduled for execution
   unconditionally after registration, and then whenever box_broadcast()
   is called for the specified key.
 - The caller may pass arbitrary data to box_broadcast() which will be
   stored internally and passed to registered callbacks.
 - A callback is not executed again until it acknowledges the last
   notification (explicitly by calling watcher_ack() or implicitly by
   returning if WATCHER_EXPLICIT_ACK is unset).
parent 2a678329
No related branches found
No related tags found
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment