X-Git-Url: http://git.bytex64.net/?a=blobdiff_plain;f=database%2Fdatabase.h;h=6dfcf9dddabe2675566f55599a1fad8b7be53d03;hb=3e3138025852408ef03f3213972e042e12841bed;hp=412d6c740cbf2f4339f4ecb7d1c8155d752c7d12;hpb=a3b400b3d5eff0027efe12936b08d80c93e0273a;p=blerg.git diff --git a/database/database.h b/database/database.h index 412d6c7..6dfcf9d 100644 --- a/database/database.h +++ b/database/database.h @@ -20,8 +20,15 @@ struct record { struct meta { uint64_t sequence; uint64_t subscription_mark; + uint32_t status; }; +/* meta.status is a bitfield of these options */ +/* Muted - if set, tags/refs and subscriptions are not calculated */ +#define BLERGSTATUS_MUTED 0x00000001 +/* Mentioned - if set, user has been mentioned. */ +#define BLERGSTATUS_MENTIONED 0x00000002 + struct blerg { int meta_fd; int index_fd; @@ -35,14 +42,19 @@ struct blerg { int data_size; }; -int blerg_exists(const char *); -struct blerg *blerg_open(const char *); -int blerg_close(struct blerg *); -int blerg_store(struct blerg *, const char *, int); -int blerg_fetch(struct blerg *, int, char **, int *); +#define BLERG_INVALID_RECORD 0xFFFFFFFFFFFFFFFF + +int blerg_init(); +int blerg_exists(const char *name); +struct blerg *blerg_open(const char *name); +int blerg_close(struct blerg *blerg); +uint64_t blerg_store(struct blerg *blerg, const char *data, int length); +int blerg_fetch(struct blerg *blerg, uint64_t record, char **data, int *length); uint64_t blerg_get_record_count(struct blerg *); -time_t blerg_get_timestamp(struct blerg *blerg, int record); -int blerg_set_subscription_mark(struct blerg *blerg); +time_t blerg_get_timestamp(struct blerg *blerg, uint64_t record); +int blerg_set_subscription_mark(struct blerg *blerg); uint64_t blerg_get_subscription_mark(struct blerg *blerg); +int blerg_set_status(struct blerg *blerg, uint32_t status, int v); +int blerg_get_status(struct blerg *blerg, uint32_t status); #endif //_DATABASE_H