re-implement chunk_table b-tree function callbacks

This commit is contained in:
2025-02-24 15:55:26 +00:00
parent 10e031ba9e
commit 4808a8abe7
2 changed files with 202 additions and 103 deletions

View File

@@ -7,41 +7,20 @@
#include <blue/core/hash.h>
#include <stdio.h>
struct ec3_tag_reader;
struct ec3_tag_writer;
enum chunk_table_mode {
CHUNK_TABLE_READ,
CHUNK_TABLE_WRITE,
};
struct ec3_tag_ioctx;
struct chunk_table {
enum chunk_table_mode tab_mode;
unsigned int tab_cluster_size;
enum ec3_cluster_size tab_cluster_size;
b_btree tab_cache;
union {
struct {
struct ec3_tag_reader *ctab;
struct ec3_tag_reader *cdat;
} tab_read;
struct {
struct ec3_tag_writer *ctab;
struct ec3_tag_writer *cdat;
} tab_write;
};
struct ec3_tag_ioctx *tab_ctab;
struct ec3_tag_ioctx *tab_cdat;
};
extern enum ec3_status chunk_table_init_read(
struct ec3_tag_reader *ctab,
struct ec3_tag_reader *cdat,
size_t cluster_size,
struct chunk_table *tab);
extern enum ec3_status chunk_table_init_write(
struct ec3_tag_writer *ctab,
struct ec3_tag_writer *cdat,
size_t cluster_size,
extern enum ec3_status chunk_table_init(
struct ec3_tag_ioctx *ctab,
struct ec3_tag_ioctx *cdat,
enum ec3_cluster_size cluster_size,
struct chunk_table *tab);
extern void chunk_table_finish(struct chunk_table *tab);