summaryrefslogtreecommitdiff
path: root/src/storage/store.h
diff options
context:
space:
mode:
authortanaka takashi <isazaka@gmail.com>2026-06-29 02:36:40 +0900
committertanaka takashi <isazaka@gmail.com>2026-06-29 02:36:40 +0900
commit4c6a831aa2a57e2bcc20aa3fc2f1b7172f5be285 (patch)
tree074021381abf57cad434430f25027115b681b8a9 /src/storage/store.h
parent8d38b06f11c713e547d70468340242f23322152c (diff)
feat: 会話メモリのプロトタイプを実装
- 6種類のMCPツールと入力検証を追加 - バイナリログ、スナップショット、復旧、圧縮処理を実装 - Unicode n-gram検索とドメインモデルを追加 - 単体テストと統合テストを追加 - アーキテクチャと実装状況を文書化 - Cコードの記述スタイルを統一
Diffstat (limited to 'src/storage/store.h')
-rw-r--r--src/storage/store.h64
1 files changed, 64 insertions, 0 deletions
diff --git a/src/storage/store.h b/src/storage/store.h
new file mode 100644
index 0000000..cc14a80
--- /dev/null
+++ b/src/storage/store.h
@@ -0,0 +1,64 @@
+#ifndef TINY_CONVMEM_STORAGE_STORE_H
+#define TINY_CONVMEM_STORAGE_STORE_H
+
+#include <stdbool.h>
+#include <stddef.h>
+#include <stdint.h>
+#include <wchar.h>
+
+#include "domain/message.h"
+
+typedef enum tiny_store_status
+{
+ TINY_STORE_OK = 0,
+ TINY_STORE_NOT_FOUND,
+ TINY_STORE_BUSY,
+ TINY_STORE_IO_ERROR,
+ TINY_STORE_CORRUPT,
+ TINY_STORE_NO_MEMORY
+} tiny_store_status_t;
+
+typedef struct tiny_store_entry
+{
+ tiny_message_t message;
+ bool deleted;
+ uint64_t sequence;
+} tiny_store_entry_t;
+
+typedef struct tiny_store tiny_store_t;
+
+typedef struct tiny_rebuild_report
+{
+ uint64_t messages_indexed;
+ uint64_t records_removed;
+ uint64_t bytes_before;
+ uint64_t bytes_after;
+} tiny_rebuild_report_t;
+
+typedef struct tiny_store_health
+{
+ uint64_t log_size;
+ uint64_t snapshot_size;
+ uint64_t active_messages;
+ uint64_t deleted_messages;
+ uint64_t last_sequence;
+ bool recovered_tail;
+ bool snapshot_valid;
+ char last_error[160];
+} tiny_store_health_t;
+
+tiny_store_status_t tiny_store_open(tiny_store_t **store, const wchar_t *directory);
+void tiny_store_close(tiny_store_t *store);
+const char *tiny_store_status_name(tiny_store_status_t status);
+
+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_rebuild(tiny_store_t *store, tiny_rebuild_report_t *report);
+void tiny_store_health(const tiny_store_t *store, tiny_store_health_t *health);
+
+size_t tiny_store_entry_count(const tiny_store_t *store);
+const tiny_store_entry_t *tiny_store_entry(const tiny_store_t *store, size_t index);
+
+#endif