1# Notify library {#notify} 2The notify library implements an event bus, allowing users to register, generate, 3and listen for events. For example, the bdev library may register a new event type 4for bdev creation. Any time a bdev is created, it "sends" the event. Consumers of 5that event may periodically poll for new events to retrieve them. 6The event bus is implemented as a circular ring of fixed size. If event consumers 7do not poll frequently enough, events may be lost. All events are identified by a 8monotonically increasing integer, so missing events may be detected, although 9not recovered. 10 11# Register event types {#notify_register} 12 13During initialization the sender library should register its own event types using 14`spdk_notify_type_register(const char *type)`. Parameter 'type' is the name of 15notification type. 16 17# Get info about events {#notify_get_info} 18 19A consumer can get information about the available event types during runtime using 20`spdk_notify_get_types`, which iterates over registered notification types and 21calls a callback on each of them, so that user can produce detailed information 22about notification. 23 24# Get new events {#notify_listen} 25 26A consumer can get events by calling function `spdk_notify_get_events`. 27The caller should specify last received event and the maximum number of invocations. 28There might be multiple consumers of each event. The event bus is implemented as a 29circular buffer, so older events may be overwritten by newer ones. 30 31# Send events {#notify_send} 32 33When an event occurs, a library can invoke `spdk_notify_send` with two strings. 34One containing the type of the event, like "spdk_bdev_register", second with context, 35for example "Nvme0n1" 36 37# RPC Calls {#rpc_calls} 38 39See [JSON-RPC documentation](jsonrpc.md/#rpc_get_notification_types) 40