2016-09-13 18:54:26 -07:00
|
|
|
#include "common.h"
|
|
|
|
#include "db.h"
|
|
|
|
|
2016-09-20 17:02:56 -07:00
|
|
|
/* The callback that is called when the result of a lookup
|
|
|
|
* in the object table comes back. The callback should free
|
|
|
|
* the manager_vector array, but NOT the strings they are pointing to. */
|
|
|
|
typedef void (*lookup_callback)(object_id object_id,
|
|
|
|
int manager_count,
|
2016-10-18 12:38:30 -07:00
|
|
|
const char *manager_vector[],
|
|
|
|
void *context);
|
2016-09-13 18:54:26 -07:00
|
|
|
|
|
|
|
/* Register a new object with the directory. */
|
2016-09-20 17:02:56 -07:00
|
|
|
/* TODO(pcm): Retry, print for each attempt. */
|
2016-09-25 21:52:06 -07:00
|
|
|
void object_table_add(db_handle *db, object_id object_id);
|
2016-09-13 18:54:26 -07:00
|
|
|
|
2016-09-20 17:02:56 -07:00
|
|
|
/* Remove object from the directory. */
|
2016-09-25 21:52:06 -07:00
|
|
|
void object_table_remove(db_handle *db,
|
|
|
|
object_id object_id,
|
|
|
|
const char *manager);
|
2016-09-13 18:54:26 -07:00
|
|
|
|
|
|
|
/* Look up entry from the directory */
|
2016-09-25 21:52:06 -07:00
|
|
|
void object_table_lookup(db_handle *db,
|
2016-09-20 17:02:56 -07:00
|
|
|
object_id object_id,
|
2016-10-18 12:38:30 -07:00
|
|
|
lookup_callback callback,
|
|
|
|
void *context);
|