aboutsummaryrefslogtreecommitdiff
path: root/reftable/reftable-basics.h
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2025-04-07 15:16:21 +0200
committerJunio C Hamano <gitster@pobox.com>2025-04-07 14:53:11 -0700
commit655e18d6b4f845090b0ba4761105b32726893ecb (patch)
treecef72db67ee133caed758f3b40f13ba451c38933 /reftable/reftable-basics.h
parentce76cec964ed1c8ad6c9fcee9fd833c0ec8cccf9 (diff)
downloadgit-655e18d6b4f845090b0ba4761105b32726893ecb.tar.xz
reftable/block: create public interface for reading blocks
While users of the reftable library wouldn't generally require access to individual blocks in a reftable table, there are valid usecases where one may require low-level access to them. One such upcoming usecase in the Git codebase is to implement consistency checks for the reftable library where we want to verify each block individually. Create a public interface for reading blocks. The interface isn't yet complete and lacks e.g. a way to read individual records from a block. Such missing functionality will be backfilled in subsequent commits. Note that this change also requires us to expose `reftable_buf`, which is used by the `reftable_block_first_key()` function. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'reftable/reftable-basics.h')
-rw-r--r--reftable/reftable-basics.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/reftable/reftable-basics.h b/reftable/reftable-basics.h
index ed7c7c9ac2..6d73f19c85 100644
--- a/reftable/reftable-basics.h
+++ b/reftable/reftable-basics.h
@@ -11,6 +11,14 @@
#include <stddef.h>
+/* A buffer that contains arbitrary byte slices. */
+struct reftable_buf {
+ size_t alloc;
+ size_t len;
+ char *buf;
+};
+#define REFTABLE_BUF_INIT { 0 }
+
/*
* Hash functions understood by the reftable library. Note that the values are
* arbitrary and somewhat random such that we can easily detect cases where the