Skip to content

Commit c5636b2

Browse files
committed
cyrusdb: add a twom database backend
A cyrusdb wrapper around twom library
1 parent 38d30e7 commit c5636b2

File tree

8 files changed

+434
-8
lines changed

8 files changed

+434
-8
lines changed

Makefile.am

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1475,6 +1475,7 @@ lib_libcyrus_la_SOURCES = \
14751475
lib/cyrusdb_quotalegacy.c \
14761476
lib/cyrusdb_skiplist.c \
14771477
lib/cyrusdb_twoskip.c \
1478+
lib/cyrusdb_twom.c \
14781479
lib/glob.c \
14791480
lib/htmlchar.c \
14801481
lib/htmlchar.h \

cunit/aaa-db.testc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ struct binary_result
1919
size_t datalen;
2020
};
2121

22-
static const char *backend = CUNIT_PARAM("skiplist,flat,twoskip,zeroskip");
22+
static const char *backend = CUNIT_PARAM("skiplist,flat,twom,twoskip,zeroskip");
2323
static char *filename;
2424
static char *filename2;
2525

imap/global.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -409,6 +409,8 @@ EXPORTED int cyrus_init(const char *alt_config, const char *ident, unsigned flag
409409
config_getswitch(IMAPOPT_SKIPLIST_ALWAYS_CHECKPOINT));
410410
libcyrus_config_setswitch(CYRUSOPT_ACL_ADMIN_IMPLIES_WRITE,
411411
config_getswitch(IMAPOPT_ACL_ADMIN_IMPLIES_WRITE));
412+
libcyrus_config_setstring(CYRUSOPT_TWOM_CHECKSUM_ENGINE,
413+
config_getstring(IMAPOPT_TWOM_CHECKSUM_ENGINE));
412414

413415
/* Not until all configuration parameters are set! */
414416
libcyrus_init();

lib/cyrusdb.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ extern struct cyrusdb_backend cyrusdb_flat;
7171
extern struct cyrusdb_backend cyrusdb_skiplist;
7272
extern struct cyrusdb_backend cyrusdb_quotalegacy;
7373
extern struct cyrusdb_backend cyrusdb_sql;
74+
extern struct cyrusdb_backend cyrusdb_twom;
7475
extern struct cyrusdb_backend cyrusdb_twoskip;
7576
extern struct cyrusdb_backend cyrusdb_zeroskip;
7677

@@ -81,6 +82,7 @@ static struct cyrusdb_backend *_backends[] = {
8182
#if defined USE_CYRUSDB_SQL
8283
&cyrusdb_sql,
8384
#endif
85+
&cyrusdb_twom,
8486
&cyrusdb_twoskip,
8587
#if defined HAVE_ZEROSKIP
8688
&cyrusdb_zeroskip,
@@ -622,6 +624,9 @@ EXPORTED const char *cyrusdb_detect(const char *fname)
622624
if (!strncmp(buf, "\241\002\213\015twoskip file\0\0\0\0", 16))
623625
return "twoskip";
624626

627+
if (!strncmp(buf, "\241\002\213\015twomfile", 12))
628+
return "twom";
629+
625630
/* unable to detect SQLite databases or flat files explicitly here */
626631
return NULL;
627632
}

0 commit comments

Comments
 (0)