#ifndef DICT_H
#define DICT_H
struct timespec;
struct dict;
struct dict_iterate_context;
enum dict_iterate_flags {
/* Recurse to all the sub-hierarchies (e.g. iterating "foo/" will
return "foo/a", but should it return "foo/a/b"?) */
/* Sort returned results by key */
/* Sort returned results by value */
/* Don't return values, only keys */
/* Don't recurse at all. This is basically the same as dict_lookup(),
but it'll return all the rows instead of only the first one. */
/* Perform iteration asynchronously. */
};
enum dict_data_type {
};
struct dict_settings {
const char *username;
const char *base_dir;
/* home directory for the user, if known */
const char *home_dir;
};
struct dict_lookup_result {
int ret;
/* First returned value (ret > 0) */
const char *value;
/* NULL-terminated list of all returned values (ret > 0) */
const char *const *values;
/* Error message for a failed lookup (ret < 0) */
const char *error;
};
enum dict_commit_ret {
/* write may or may not have succeeded (e.g. write timeout or
disconnected from server) */
};
struct dict_commit_result {
const char *error;
};
void *context);
typedef void
void *context);
void dict_drivers_register_builtin(void);
void dict_drivers_unregister_builtin(void);
void dict_drivers_register_all(void);
void dict_drivers_unregister_all(void);
/* Open dictionary with given URI (type:data).
Returns 0 if ok, -1 if URI is invalid. */
/* Close dictionary. */
/* Wait for all pending asynchronous operations to finish. */
/* Switch the dict to the current ioloop. This can be used to do dict_wait()
among other IO work. Returns TRUE if there is actually some work that can
be waited on. */
/* Lookup value for key. Set it to NULL if it's not found.
Returns 1 if found, 0 if not found and -1 if lookup failed. */
/* Iterate through all values in a path. flag indicates how iteration
is carried out */
struct dict_iterate_context *
enum dict_iterate_flags flags);
struct dict_iterate_context *
enum dict_iterate_flags flags);
/* Set async callback. Note that if dict_iterate_init() already did all the
work, this callback may never be called. So after dict_iterate_init() you
should call dict_iterate() in any case to see if all the results are
already available. */
void *context);
/* Limit how many rows will be returned by the iteration (0 = unlimited).
This allows backends to optimize the query (e.g. use LIMIT 1 with SQL). */
/* If dict_iterate() returns FALSE, the iteration may be finished or if this
is an async iteration it may be waiting for more data. If this function
returns TRUE, the dict callback is called again with more data. */
/* Returns 0 = ok, -1 = iteration failed */
/* Start a new dictionary transaction. */
/* Don't log a warning if the transaction commit took a long time.
This is needed if there are no guarantees that an asynchronous commit will
finish up anytime soon. Mainly useful for transactions which aren't
especially important whether they finish or not. */
/* Set write timestamp for the entire transaction. This must be set before
any changes are done and can't be changed afterwards. Currently only
dict-sql with Cassandra backend does anything with this. */
/* Commit the transaction. Returns 1 if ok, 0 if dict_atomic_inc() was used
on a nonexistent key, -1 if failed. */
const char **error_r);
/* Commit the transaction, but don't wait to see if it finishes successfully.
If callback isn't NULL, it's called eventually. If it's not called by the
time you want to deinitialize dict, call dict_flush() to wait for the
result. */
/* Rollback all changes made in transaction. */
/* Set key=value in dictionary. */
/* Unset a record in dictionary, identified by key*/
const char *key);
changed when transaction is being committed, so you can't know beforehand
what the value will become. The value is updated only if it already exists,
otherwise commit() will return 0. */
into path components in dict keys. */
const char *dict_escape_string(const char *str);
const char *dict_unescape_string(const char *str);
#endif