diff mbox series

[13/16] reftable/table: add `reftable_table` to the public interface

Message ID 20250331-pks-reftable-polishing-v1-13-ebed5247434c@pks.im (mailing list archive)
State New
Headers show
Series reftable: overhaul the API to expose access to blocks | expand

Commit Message

Patrick Steinhardt March 31, 2025, 8:41 a.m. UTC
The `reftable_table` interface is an internal implementation detail that
callers have no access to. Having direct access to this structure is
important though for a subsequent patch series that will implement
consistency checks for the reftable backend.

Move the structure into "reftable-table.h" so that it part of the public
interface.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
 reftable/reftable-table.h | 32 +++++++++++++++++++++++++++++++-
 reftable/table.h          | 33 ---------------------------------
 2 files changed, 31 insertions(+), 34 deletions(-)
diff mbox series

Patch

diff --git a/reftable/reftable-table.h b/reftable/reftable-table.h
index 94379026727..a78db9eea7e 100644
--- a/reftable/reftable-table.h
+++ b/reftable/reftable-table.h
@@ -20,8 +20,38 @@ 
  * reftable_merged_table and struct reftable_stack.
  */
 
+/* Metadata for a block type. */
+struct reftable_table_offsets {
+	int is_present;
+	uint64_t offset;
+	uint64_t index_offset;
+};
+
 /* The table struct is a handle to an open reftable file. */
-struct reftable_table;
+struct reftable_table {
+	/* for convenience, associate a name with the instance. */
+	char *name;
+	struct reftable_block_source source;
+
+	/* Size of the file, excluding the footer. */
+	uint64_t size;
+
+	/* The hash function used for ref records. */
+	enum reftable_hash hash_id;
+
+	uint32_t block_size;
+	uint64_t min_update_index;
+	uint64_t max_update_index;
+	/* Length of the OID keys in the 'o' section */
+	int object_id_len;
+	int version;
+
+	struct reftable_table_offsets ref_offsets;
+	struct reftable_table_offsets obj_offsets;
+	struct reftable_table_offsets log_offsets;
+
+	uint64_t refcount;
+};
 
 /* reftable_table_new opens a reftable for reading. If successful,
  * returns 0 code and sets pp. The name is used for creating a
diff --git a/reftable/table.h b/reftable/table.h
index e15d58d8e9e..c54703e6210 100644
--- a/reftable/table.h
+++ b/reftable/table.h
@@ -14,39 +14,6 @@ 
 #include "reftable-iterator.h"
 #include "reftable-table.h"
 
-/* metadata for a block type */
-struct reftable_table_offsets {
-	int is_present;
-	uint64_t offset;
-	uint64_t index_offset;
-};
-
-/* The state for reading a reftable file. */
-struct reftable_table {
-	/* for convenience, associate a name with the instance. */
-	char *name;
-	struct reftable_block_source source;
-
-	/* Size of the file, excluding the footer. */
-	uint64_t size;
-
-	/* The hash function used for ref records. */
-	enum reftable_hash hash_id;
-
-	uint32_t block_size;
-	uint64_t min_update_index;
-	uint64_t max_update_index;
-	/* Length of the OID keys in the 'o' section */
-	int object_id_len;
-	int version;
-
-	struct reftable_table_offsets ref_offsets;
-	struct reftable_table_offsets obj_offsets;
-	struct reftable_table_offsets log_offsets;
-
-	uint64_t refcount;
-};
-
 const char *reftable_table_name(struct reftable_table *t);
 
 int table_init_iter(struct reftable_table *t,