Next: , Previous: , Up: Storing peer-specific data using the PEERSTORE service   [Contents]


4.6.3 Monitoring records

PEERSTORE offers the functionality of monitoring for new records stored under a specific key combination (subsystem, peerid, key). To start the monitoring, use the following function:

struct GNUNET_PEERSTORE_WatchContext *
GNUNET_PEERSTORE_watch (struct GNUNET_PEERSTORE_Handle *h,
                        const char *sub_system,
                        const struct GNUNET_PeerIdentity *peer,
                        const char *key,
                        GNUNET_PEERSTORE_Processor callback,
                        void *callback_cls);

Whenever a new record is stored under the given key combination, the callback function will be called with this new record. This will continue until the connection to the PEERSTORE service is broken or the watch operation is canceled:

void
GNUNET_PEERSTORE_watch_cancel (struct GNUNET_PEERSTORE_WatchContext
                               *wc);