Files
PaulDB/include/pauldb/storage.h
T
2026-06-20 20:46:49 +02:00

119 lines
1.1 KiB
C

/* 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 */