summaryrefslogtreecommitdiff
path: root/src/storage/store.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/storage/store.h')
-rw-r--r--src/storage/store.h25
1 files changed, 24 insertions, 1 deletions
diff --git a/src/storage/store.h b/src/storage/store.h
index 619f86f..3ddd24d 100644
--- a/src/storage/store.h
+++ b/src/storage/store.h
@@ -14,7 +14,8 @@ typedef enum tiny_store_status
TINY_STORE_BUSY,
TINY_STORE_IO_ERROR,
TINY_STORE_CORRUPT,
- TINY_STORE_NO_MEMORY
+ TINY_STORE_NO_MEMORY,
+ TINY_STORE_CONFLICT
} tiny_store_status_t;
typedef struct tiny_store_entry
@@ -36,16 +37,33 @@ typedef struct tiny_rebuild_report
typedef struct tiny_store_health
{
+ uint32_t format_version;
uint64_t log_size;
uint64_t snapshot_size;
uint64_t active_messages;
uint64_t deleted_messages;
uint64_t last_sequence;
+ uint64_t update_records;
+ uint64_t dead_bytes;
+ uint64_t write_bytes;
+ uint64_t write_calls;
+ uint64_t flush_calls;
+ uint64_t truncate_calls;
+ uint64_t replace_calls;
bool recovered_tail;
bool snapshot_valid;
char last_error[160];
} tiny_store_health_t;
+typedef struct tiny_message_patch
+{
+ const char *content;
+ const tiny_metadata_t *metadata;
+ tiny_metadata_mask_t metadata_mask;
+ uint64_t expected_revision;
+ bool has_expected_revision;
+} tiny_message_patch_t;
+
tiny_store_status_t tiny_store_open(tiny_store_t **store, const char *directory);
void tiny_store_close(tiny_store_t *store);
const char *tiny_store_status_name(tiny_store_status_t status);
@@ -54,6 +72,11 @@ tiny_store_status_t
tiny_store_write(tiny_store_t *store, const tiny_message_t *input, tiny_message_t *written);
tiny_store_status_t
tiny_store_delete(tiny_store_t *store, const char *message_id, const char *session_id);
+tiny_store_status_t tiny_store_update(tiny_store_t *store,
+ const char *message_id,
+ const tiny_message_patch_t *patch,
+ tiny_message_t *updated,
+ bool *changed);
tiny_store_status_t tiny_store_rebuild(tiny_store_t *store, tiny_rebuild_report_t *report);
void tiny_store_health(const tiny_store_t *store, tiny_store_health_t *health);