storage.h added to VCS

This commit is contained in:
paulhorn
2026-06-20 20:15:18 +02:00
parent 748daf8236
commit 57b503028d
+50
View File
@@ -0,0 +1,50 @@
/* storage.h - C-ABI boundary between Storage Engine (C) and Engine Logic (C++) */
#ifndef PAULDB_STORAGE_H
#define PAULDB_STORAGE_H
#include <stdint.h>
#include <stddef.h>
#ifdef __cplusplus
extern "C" {
#endif
/* --- Page Management --- */
typedef struct Page Page;
Page *page_create(uint32_t page_id);
int page_insert(Page *p, const void *data, size_t len);
void *page_get(Page *p, uint16_t slot_id, size_t *out_len);
void page_free(Page *p);
/* --- Heap (Multi-Page Row Store / Delta) --- */
typedef struct Heap Heap;
Heap *heap_create(void);
int heap_insert(Heap *h, const void *data, size_t len);
void heap_full_scan(Heap *h, void (*callback)(const void *, size_t));
void heap_free(Heap *h);
/* --- B+Tree Index --- */
typedef struct BTree BTree;
BTree *btree_create(void);
int btree_insert(BTree *bt, int64_t key, uint32_t page_id, uint16_t slot_id);
int btree_lookup(BTree *bt, int64_t key, uint32_t *out_page, uint16_t *out_slot);
void btree_free(BTree *bt);
#ifdef __cplusplus
}
#endif
#endif /* PAULDB_STORAGE_H */