/* Copyright (c) 2006-2018 Dovecot authors, see the included COPYING file */
#include "lib.h"
#include "dict-private.h"
#ifdef BUILD_DB
#include <db.h>
struct db_dict {
};
struct db_dict_iterate_context {
char *path;
bool failed;
};
struct db_dict_transaction_context {
};
{
return 0;
}
{
}
const char *username)
{
const char *dir;
int ret;
else
dir = ".";
DB_INIT_MPOOL | DB_INIT_TXN, 0);
if (ret != 0) {
return -1;
}
if (ret != 0) {
return -1;
}
/* create both primary and secondary databases */
if (ret != 0) {
return -1;
}
if (ret != 0) {
return -1;
}
return -1;
}
return -1;
/* by default keys are compared as strings. if we store uint32_t,
we need a customized compare function */
return -1;
}
return -1;
}
associate_key, DB_CREATE)) != 0) {
return -1;
}
return 0;
}
static int
enum dict_data_type value_type,
{
i_error("Berkeley DB version mismatch: "
"Compiled against %d.%d.%d headers, "
"run-time linked against %d.%d.%d library",
return -1;
}
/* prepare the environment */
if (ret != 0) {
pool_unref(&pool);
return -1;
}
return -1;
}
return 0;
}
{
}
{
if (ret == DB_NOTFOUND)
return 0;
else if (ret != 0)
return -1;
switch (dict->value_type) {
case DICT_DATA_TYPE_UINT32:
/* data may not be aligned, so use memcpy() */
break;
case DICT_DATA_TYPE_STRING:
break;
}
return 1;
}
{
int ret;
if (ret == DB_NOTFOUND)
return 0;
else if (ret != 0)
return -1;
switch (dict->value_type) {
case DICT_DATA_TYPE_UINT32:
/* data may not be aligned, so use memcpy() */
break;
case DICT_DATA_TYPE_STRING:
break;
}
return 1;
}
{
int ret;
DB_NEXT)) == 0) {
/* make sure the path matches */
break;
break;
}
} else {
DB_NEXT);
/* there are no more matches */
return 0;
}
}
}
{
int ret;
/* iterating through secondary database returns values sorted */
} else {
return 0;
}
}
}
static struct dict_iterate_context *
enum dict_iterate_flags flags)
{
}
{
(struct db_dict_iterate_context *)_ctx;
int ret;
if (ret < 0)
return ret > 0;
}
{
(struct db_dict_iterate_context *)_ctx;
return ret;
}
static struct dict_transaction_context *
{
}
static int
bool async ATTR_UNUSED,
void *context)
{
(struct db_dict_transaction_context *)_ctx;
int ret;
return ret;
}
{
(struct db_dict_transaction_context *)_ctx;
}
{
(struct db_dict_transaction_context *)_ctx;
ivalue = 0;
}
} else {
}
}
const char *key)
{
(struct db_dict_transaction_context *)_ctx;
}
static void
{
/* FIXME */
}
.name = "db",
{
.init = db_dict_init,
.deinit = db_dict_deinit,
.lookup = db_dict_lookup,
.set = db_dict_set,
.unset = db_dict_unset,
}
};
#endif