dict.h (dovecot-2.3.16) | : | dict.h (dovecot-2.3.17) | ||
---|---|---|---|---|
skipping to change at line 35 | skipping to change at line 35 | |||
DICT_ITERATE_FLAG_ASYNC = 0x20 | DICT_ITERATE_FLAG_ASYNC = 0x20 | |||
}; | }; | |||
enum dict_data_type { | enum dict_data_type { | |||
DICT_DATA_TYPE_STRING = 0, | DICT_DATA_TYPE_STRING = 0, | |||
DICT_DATA_TYPE_UINT32, | DICT_DATA_TYPE_UINT32, | |||
DICT_DATA_TYPE_LAST | DICT_DATA_TYPE_LAST | |||
}; | }; | |||
struct dict_settings { | struct dict_settings { | |||
enum dict_data_type value_type; | ||||
const char *username; | ||||
const char *base_dir; | const char *base_dir; | |||
/* home directory for the user, if known */ | ||||
const char *home_dir; | ||||
/* set to parent event, if exists */ | /* set to parent event, if exists */ | |||
struct event *event_parent; | struct event *event_parent; | |||
}; | }; | |||
struct dict_op_settings { | ||||
const char *username; | ||||
/* home directory for the user, if known */ | ||||
const char *home_dir; | ||||
}; | ||||
struct dict_lookup_result { | struct dict_lookup_result { | |||
int ret; | int ret; | |||
/* First returned value (ret > 0) */ | /* First returned value (ret > 0) */ | |||
const char *value; | const char *value; | |||
/* NULL-terminated list of all returned values (ret > 0) */ | /* NULL-terminated list of all returned values (ret > 0) */ | |||
const char *const *values; | const char *const *values; | |||
/* Error message for a failed lookup (ret < 0) */ | /* Error message for a failed lookup (ret < 0) */ | |||
const char *error; | const char *error; | |||
skipping to change at line 101 | skipping to change at line 103 | |||
void dict_deinit(struct dict **dict); | void dict_deinit(struct dict **dict); | |||
/* Wait for all pending asynchronous operations to finish. */ | /* Wait for all pending asynchronous operations to finish. */ | |||
void dict_wait(struct dict *dict); | void dict_wait(struct dict *dict); | |||
/* Switch the dict to the current ioloop. This can be used to do dict_wait() | /* 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 | among other IO work. Returns TRUE if there is actually some work that can | |||
be waited on. */ | be waited on. */ | |||
bool dict_switch_ioloop(struct dict *dict) ATTR_NOWARN_UNUSED_RESULT; | bool dict_switch_ioloop(struct dict *dict) ATTR_NOWARN_UNUSED_RESULT; | |||
/* Lookup value for key. Set it to NULL if it's not found. | /* 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. */ | Returns 1 if found, 0 if not found and -1 if lookup failed. */ | |||
int dict_lookup(struct dict *dict, pool_t pool, | int dict_lookup(struct dict *dict, const struct dict_op_settings *set, pool_t po ol, | |||
const char *key, const char **value_r, const char **error_r); | const char *key, const char **value_r, const char **error_r); | |||
void dict_lookup_async(struct dict *dict, const char *key, | void dict_lookup_async(struct dict *dict, const struct dict_op_settings *set, | |||
dict_lookup_callback_t *callback, void *context); | const char *key, dict_lookup_callback_t *callback, | |||
#define dict_lookup_async(dict, key, callback, context) \ | void *context); | |||
dict_lookup_async(dict, key, (dict_lookup_callback_t *)(callback), \ | #define dict_lookup_async(dict, set, key, callback, context) \ | |||
dict_lookup_async(dict, set, key, (dict_lookup_callback_t *)(callback), \ | ||||
1 ? (context) : \ | 1 ? (context) : \ | |||
CALLBACK_TYPECHECK(callback, \ | CALLBACK_TYPECHECK(callback, \ | |||
void (*)(const struct dict_lookup_result *, typeof(contex t)))) | void (*)(const struct dict_lookup_result *, typeof(contex t)))) | |||
/* Iterate through all values in a path. flag indicates how iteration | /* Iterate through all values in a path. flag indicates how iteration | |||
is carried out */ | is carried out */ | |||
struct dict_iterate_context * | struct dict_iterate_context * | |||
dict_iterate_init(struct dict *dict, const char *path, | dict_iterate_init(struct dict *dict, const struct dict_op_settings *set, | |||
enum dict_iterate_flags flags); | const char *path, enum dict_iterate_flags flags); | |||
struct dict_iterate_context * | ||||
dict_iterate_init_multiple(struct dict *dict, const char *const *paths, | ||||
enum dict_iterate_flags flags); | ||||
/* Set async callback. Note that if dict_iterate_init() already did all the | /* 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 | 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 | should call dict_iterate() in any case to see if all the results are | |||
already available. */ | already available. */ | |||
void dict_iterate_set_async_callback(struct dict_iterate_context *ctx, | void dict_iterate_set_async_callback(struct dict_iterate_context *ctx, | |||
dict_iterate_callback_t *callback, | dict_iterate_callback_t *callback, | |||
void *context); | void *context); | |||
#define dict_iterate_set_async_callback(ctx, callback, context) \ | #define dict_iterate_set_async_callback(ctx, callback, context) \ | |||
dict_iterate_set_async_callback(ctx, (dict_iterate_callback_t *)(callback ), \ | dict_iterate_set_async_callback(ctx, (dict_iterate_callback_t *)(callback ), \ | |||
1 ? (context) : \ | 1 ? (context) : \ | |||
skipping to change at line 148 | skipping to change at line 148 | |||
of them. dict_iterate() returns only the first value and ignores the rest. */ | of them. dict_iterate() returns only the first value and ignores the rest. */ | |||
bool dict_iterate_has_more(struct dict_iterate_context *ctx); | bool dict_iterate_has_more(struct dict_iterate_context *ctx); | |||
bool dict_iterate(struct dict_iterate_context *ctx, | bool dict_iterate(struct dict_iterate_context *ctx, | |||
const char **key_r, const char **value_r); | const char **key_r, const char **value_r); | |||
bool dict_iterate_values(struct dict_iterate_context *ctx, | bool dict_iterate_values(struct dict_iterate_context *ctx, | |||
const char **key_r, const char *const **values_r); | const char **key_r, const char *const **values_r); | |||
/* Returns 0 = ok, -1 = iteration failed */ | /* Returns 0 = ok, -1 = iteration failed */ | |||
int dict_iterate_deinit(struct dict_iterate_context **ctx, const char **error_r) ; | int dict_iterate_deinit(struct dict_iterate_context **ctx, const char **error_r) ; | |||
/* Start a new dictionary transaction. */ | /* Start a new dictionary transaction. */ | |||
struct dict_transaction_context *dict_transaction_begin(struct dict *dict); | struct dict_transaction_context * | |||
dict_transaction_begin(struct dict *dict, const struct dict_op_settings *set); | ||||
/* Don't log a warning if the transaction commit took a long time. | /* 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 | This is needed if there are no guarantees that an asynchronous commit will | |||
finish up anytime soon. Mainly useful for transactions which aren't | finish up anytime soon. Mainly useful for transactions which aren't | |||
especially important whether they finish or not. */ | especially important whether they finish or not. */ | |||
void dict_transaction_no_slowness_warning(struct dict_transaction_context *ctx); | void dict_transaction_no_slowness_warning(struct dict_transaction_context *ctx); | |||
/* Set write timestamp for the entire transaction. This must be set before | /* Set write timestamp for the entire transaction. This must be set before | |||
any changes are done and can't be changed afterwards. Currently only | any changes are done and can't be changed afterwards. Currently only | |||
dict-sql with Cassandra backend does anything with this. */ | dict-sql with Cassandra backend does anything with this. */ | |||
void dict_transaction_set_timestamp(struct dict_transaction_context *ctx, | void dict_transaction_set_timestamp(struct dict_transaction_context *ctx, | |||
const struct timespec *ts); | const struct timespec *ts); | |||
End of changes. 7 change blocks. | ||||
15 lines changed or deleted | 16 lines changed or added |