Skip to content

Commit

Permalink
twom: a new database
Browse files Browse the repository at this point in the history
  • Loading branch information
brong committed Jan 5, 2025
1 parent ca3f583 commit a0615b2
Show file tree
Hide file tree
Showing 8 changed files with 2,624 additions and 9 deletions.
1 change: 1 addition & 0 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -1474,6 +1474,7 @@ lib_libcyrus_la_SOURCES = \
lib/cyrusdb_quotalegacy.c \
lib/cyrusdb_skiplist.c \
lib/cyrusdb_twoskip.c \
lib/cyrusdb_twom.c \
lib/glob.c \
lib/htmlchar.c \
lib/htmlchar.h \
Expand Down
2 changes: 1 addition & 1 deletion cunit/aaa-db.testc
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ struct binary_result
size_t datalen;
};

static const char *backend = CUNIT_PARAM("skiplist,flat,twoskip,zeroskip");
static const char *backend = CUNIT_PARAM("skiplist,flat,twom,twoskip,zeroskip");
static char *filename;
static char *filename2;

Expand Down
2 changes: 2 additions & 0 deletions imap/global.c
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,8 @@ EXPORTED int cyrus_init(const char *alt_config, const char *ident, unsigned flag
config_getswitch(IMAPOPT_SKIPLIST_ALWAYS_CHECKPOINT));
libcyrus_config_setswitch(CYRUSOPT_ACL_ADMIN_IMPLIES_WRITE,
config_getswitch(IMAPOPT_ACL_ADMIN_IMPLIES_WRITE));
libcyrus_config_setstring(CYRUSOPT_TWOM_CHECKSUM_ENGINE,
config_getstring(IMAPOPT_TWOM_CHECKSUM_ENGINE));

/* Not until all configuration parameters are set! */
libcyrus_init();
Expand Down
5 changes: 5 additions & 0 deletions lib/cyrusdb.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ extern struct cyrusdb_backend cyrusdb_flat;
extern struct cyrusdb_backend cyrusdb_skiplist;
extern struct cyrusdb_backend cyrusdb_quotalegacy;
extern struct cyrusdb_backend cyrusdb_sql;
extern struct cyrusdb_backend cyrusdb_twom;
extern struct cyrusdb_backend cyrusdb_twoskip;
extern struct cyrusdb_backend cyrusdb_zeroskip;

Expand All @@ -81,6 +82,7 @@ static struct cyrusdb_backend *_backends[] = {
#if defined USE_CYRUSDB_SQL
&cyrusdb_sql,
#endif
&cyrusdb_twom,
&cyrusdb_twoskip,
#if defined HAVE_ZEROSKIP
&cyrusdb_zeroskip,
Expand Down Expand Up @@ -622,6 +624,9 @@ EXPORTED const char *cyrusdb_detect(const char *fname)
if (!strncmp(buf, "\241\002\213\015twoskip file\0\0\0\0", 16))
return "twoskip";

if (!strncmp(buf, "\241\002\213\015twomfile", 12))
return "twom";

/* unable to detect SQLite databases or flat files explicitly here */
return NULL;
}
Expand Down
Loading

0 comments on commit a0615b2

Please sign in to comment.