mirror of
https://github.com/fumiama/fumidb.git
synced 2026-06-07 09:40:34 +08:00
add more api
This commit is contained in:
@@ -16,8 +16,8 @@ void* create_table(int fd, char* buf, const char* name, int row_len, ...);
|
||||
// 加载 ptr 位置的表
|
||||
// len(buf) >= 4096+8+2=4106
|
||||
// 返回:
|
||||
// NULL 失败,详见 errno
|
||||
// table 指向表头的指针
|
||||
// 0 失败,详见 errno
|
||||
// ptr 指向表头的指针
|
||||
void* load_table(int fd, char* buf, uint64_t ptr);
|
||||
|
||||
// 获得表名长度,包含结尾0
|
||||
@@ -27,11 +27,14 @@ uint16_t get_table_name_length(void* table);
|
||||
// 返回:buf
|
||||
char* get_table_name(void* table, char* buf);
|
||||
|
||||
// 获得第 pos 项的索引 ptr
|
||||
uint64_t get_index_ptr(void* table, uint16_t pos);
|
||||
|
||||
// 为 pos 位置的列创建索引。不可用于 0 列,即 pk 列,因为 pk 必有索引
|
||||
// 返回:
|
||||
// NULL 失败,详见 errno
|
||||
// index 指向索引头的指针
|
||||
void* add_table_index(int fd, void* table, uint16_t pos);
|
||||
// NULL 失败,详见 errno
|
||||
// ptr 指向索引头的指针
|
||||
uint64_t add_table_index(int fd, void* table, uint16_t pos);
|
||||
|
||||
// 删除 pos 位置的列的索引。不可用于 0 列,即 pk 列,因为 pk 必有索引
|
||||
// 返回:
|
||||
@@ -44,6 +47,10 @@ int remove_table_index(int fd, void* table, uint16_t pos);
|
||||
// 加一个 int isavailable,标记本项是否有值
|
||||
// 如果 isavailable==0,后面不再跟有本项数据
|
||||
// 如果 isavailable!=0,则在后面附加数据
|
||||
// 如果 val 不为 string,直接装填其值
|
||||
// 否则,值是指向 string 的指针 (const char*)
|
||||
// 如果是 binary,需要在指针之前提供一个 uint32 参数
|
||||
// 说明 binary 的大小
|
||||
// 返回:
|
||||
// 0 失败,详见 errno
|
||||
// ptr 本行插入的位置
|
||||
|
||||
Reference in New Issue
Block a user