quota-dict.c revision 1f166c4a7498b4b6bdf6f072edeaebb388cc53eb
/* Copyright (c) 2005-2017 Dovecot authors, see the included COPYING file */
#include "lib.h"
#include "ioloop.h"
#include "str.h"
#include "dict.h"
#include "mail-user.h"
#include "mail-namespace.h"
#include "quota-private.h"
struct dict_quota_root {
struct quota_root root;
bool disable_unset;
};
extern struct quota_backend quota_backend_dict;
static struct quota_root *dict_quota_alloc(void)
{
struct dict_quota_root *root;
}
{
}
const char **error_r)
{
struct dict_settings set;
const struct quota_param_parser dict_params[] = {
{.param_name = NULL}
};
if (p == NULL) {
*error_r = "URI missing from parameters";
return -1;
}
args = p+1;
if (*username == '\0')
i_debug("dict quota: user=%s, uri=%s, noenforcing=%d",
}
/* FIXME: we should use 64bit integer as datatype instead but before
it can actually be used don't bother */
return -1;
}
return 0;
}
{
}
}
static const char *const *
{
static const char *resources[] = {
};
return resources;
}
static int
{
struct dict_transaction_context *dt;
return -1;
T_BEGIN {
/* these unsets are mainly necessary for pgsql, because its
trigger otherwise increases quota without deleting it.
but some people with other databases want to store the
quota usage among other data in the same row, which
shouldn't be deleted. */
if (!root->disable_unset) {
}
} T_END;
return 1;
}
static int
{
bool want_bytes;
int ret;
want_bytes = TRUE;
want_bytes = FALSE;
else
return 0;
T_BEGIN {
if (ret < 0) {
*value_r = 0;
} else {
/* recalculate quota if it's negative or if it
wasn't found */
tmp = -1;
if (tmp >= 0)
else {
value_r);
}
}
} T_END;
return ret;
}
{
}
void *context)
{
/* row doesn't exist, need to recalculate it */
i_error("dict quota: Quota update failed: %s "
}
}
static int
struct quota_transaction_context *ctx)
{
struct dict_transaction_context *dt;
return -1;
} else {
if (ctx->bytes_used != 0) {
ctx->bytes_used);
}
if (ctx->count_used != 0) {
ctx->count_used);
}
root);
}
return 0;
}
{
}
}
struct quota_backend quota_backend_dict = {
"dict",
{
NULL,
NULL,
NULL,
NULL,
}
};