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


4.6.2 Retrieving records

To retrieve stored records, use the following function:

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

The values of peer and key can be NULL. This allows the iteration over values stored under any of the following key combinations:

The callback function will be called once with each retrieved record and once more with a NULL record to signal the end of results.

The GNUNET_PEERSTORE_iterate function returns a handle to the iterate operation. This handle can be used to cancel the iterate operation only before the callback function is called with a NULL record.