iproto: add watchers support
Part of #6257 @TarantoolBot document Title: Document IPROTO watchers There are three new commands to support asynchronous server->client notifications signaled with `box.broadcast()`: - `IPROTO_WATCH` (code 74). Registers a new watcher for the given notification key or acknowledges a notification if a watcher is already registered. The key name is passed in `IPROTO_EVENT_KEY` (code 0x56). The watcher will be notified unconditionally after registration and then every time the key is updated with `box.broadcast()` provided the last notification was acknowledged. The server doesn't reply to the request unless it fails to parse the packet. - `IPROTO_UNWATCH` (code 75). Unregisters a watcher registered for the given notification key. The key name is passed in `IPROTO_EVENT_KEY` (code 0x56). A server doesn't reply to the request unless it fails to parse the packet. - `IPROTO_EVENT` (code 76). Sent by the server to notify a client about a key update. The key name is passed in `IPROTO_EVENT_KEY` (code 0x56). The key data (optional) is passed in `IPROTO_EVENT_DATA` (code 0x57). When a connection is closed, all watchers registered for it are unregistered. Servers that support the new feature set the `IPROTO_FEATURE_WATCHERS` feature bit (bit 3) in reply to the `IPROTO_ID` command.
Showing
- changelogs/unreleased/gh-6257-iproto-watcher.md 3 additions, 0 deletionschangelogs/unreleased/gh-6257-iproto-watcher.md
- src/box/iproto.cc 55 additions, 4 deletionssrc/box/iproto.cc
- src/box/iproto_constants.c 4 additions, 0 deletionssrc/box/iproto_constants.c
- src/box/iproto_constants.h 25 additions, 0 deletionssrc/box/iproto_constants.h
- src/box/iproto_features.c 2 additions, 0 deletionssrc/box/iproto_features.c
- src/box/iproto_features.h 6 additions, 1 deletionsrc/box/iproto_features.h
- src/box/lua/net_box.lua 1 addition, 0 deletionssrc/box/lua/net_box.lua
- src/box/session.cc 94 additions, 0 deletionssrc/box/session.cc
- src/box/session.h 28 additions, 0 deletionssrc/box/session.h
- src/box/xrow.c 88 additions, 0 deletionssrc/box/xrow.c
- src/box/xrow.h 35 additions, 0 deletionssrc/box/xrow.h
- test/box-py/iproto.result 49 additions, 2 deletionstest/box-py/iproto.result
- test/box-py/iproto.test.py 98 additions, 3 deletionstest/box-py/iproto.test.py
- test/box/net.box_iproto_id.result 8 additions, 3 deletionstest/box/net.box_iproto_id.result
Loading
Please register or sign in to comment