From 12e2a91ca78dcd32ee3adb431e2c9c133ec75ca3 Mon Sep 17 00:00:00 2001 From: Carl Niklas Rydberg Date: Sun, 21 Dec 2025 21:09:01 +0100 Subject: [PATCH] Added the snapshot/epoch type and getter in the public API, plus the store wrapper implementation: --- include/amduat/tgk/store.h | 6 ++++++ src/tgk_stack/store/store.c | 8 ++++++++ 2 files changed, 14 insertions(+) diff --git a/include/amduat/tgk/store.h b/include/amduat/tgk/store.h index 527911a..5ba6278 100644 --- a/include/amduat/tgk/store.h +++ b/include/amduat/tgk/store.h @@ -20,6 +20,8 @@ typedef enum { GS_ERR_INTEGRITY = 4 } amduat_tgk_graph_error_t; +typedef uint64_t amduat_tgk_snapshot_id_t; + typedef struct { amduat_tgk_edge_type_id_t *types; size_t types_len; @@ -83,6 +85,7 @@ typedef struct { typedef struct { bool (*get_config)(void *ctx, amduat_tgk_store_config_t *out_config); + bool (*snapshot_id)(void *ctx, amduat_tgk_snapshot_id_t *out_id); amduat_tgk_graph_error_t (*resolve_edge)(void *ctx, amduat_reference_t ref, amduat_tgk_edge_body_t *out_body); @@ -124,6 +127,9 @@ void amduat_tgk_store_init(amduat_tgk_store_t *store, bool amduat_tgk_store_get_config(amduat_tgk_store_t *store, amduat_tgk_store_config_t *out_config); +bool amduat_tgk_store_snapshot_id(amduat_tgk_store_t *store, + amduat_tgk_snapshot_id_t *out_id); + amduat_tgk_graph_error_t amduat_tgk_store_resolve_edge( amduat_tgk_store_t *store, amduat_reference_t ref, diff --git a/src/tgk_stack/store/store.c b/src/tgk_stack/store/store.c index 8320a6c..8bbf659 100644 --- a/src/tgk_stack/store/store.c +++ b/src/tgk_stack/store/store.c @@ -31,6 +31,14 @@ bool amduat_tgk_store_get_config(amduat_tgk_store_t *store, return store->ops.get_config(store->ctx, out_config); } +bool amduat_tgk_store_snapshot_id(amduat_tgk_store_t *store, + amduat_tgk_snapshot_id_t *out_id) { + if (store == NULL || store->ops.snapshot_id == NULL) { + return false; + } + return store->ops.snapshot_id(store->ctx, out_id); +} + amduat_tgk_graph_error_t amduat_tgk_store_resolve_edge( amduat_tgk_store_t *store, amduat_reference_t ref,