opendkim/opendkim-db.c restructure

From: Daniel Black <daniel.subs_at_internode.on.net>
Date: Sun, 27 Jun 2010 19:48:01 +1000

I'm thinking about restructuring opendkim-db.c to be a bit more modular. I was
going to use the same principle as the linux kernel - structs of function
poiiinrters.

I think there should be a structure for the functions provided for each
dataset type.

struct DKIMF_DB {
        char **schema;
        int (*open)(DKIMF_DB *, char *, u_int , pthread_mutex_t *);
        int delete)(DKIMF_DB *, void *, size_t );
        int (*put)(DKIMF_DB*, void *, size_t ,void *, size_t );
        int (*get)(DKIMF_DB*, void *, size_t, DKIMF_DBDATA, unsigned int , _Bool
*exists);
        int (*close)(DKIMF_DB *);
        int (*strerror)(DKIMF_DB *, char *, size_t )
        int (*walk)(DKIMF_DB*, _Bool , void *, size_t *, DKIMF_DBDATA , unsigned
int );
        void *private;
}

the dataset types would each be in their own file with a struct declared like
const struct DKIMF_DB ldap_ops = {
        .schema = [ "ldap", "ldapi", "ldaps", 0 ],
        .open = ldap_open,
        .get = ldap_get,
        .close = ldap_close,
        .strerror = ldap_strerror,
}

All other functions get explicitly as language definition defined to NULL so
there doesn't need to be handlers for each function.

Each dataset type is therefore constrained to its own file and is a bit more
readable.

In this move i'd like to see the ldap cache go to its own dataset type defined
as follows so it can cache other datasets. Of use could be lua, database and
file formats where latency could be issues:

cache:{storagedataset} {querydataset} [cachetime=X purgetime=Y ...]

Any objections?
Received on Sun Jun 27 2010 - 09:49:04 PST

This archive was generated by hypermail 2.3.0 : Mon Oct 29 2012 - 23:32:53 PST