1
0
mirror of https://github.com/fumiama/fumidb.git synced 2026-06-05 16:50:33 +08:00
Files
fumidb/include/types.h
2022-05-01 23:21:09 +08:00

42 lines
976 B
C
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#ifndef _TYPES_H_
#define _TYPES_H_
#include <stdint.h>
#include <errno.h>
#define TYPE_INT8 0
#define TYPE_INT16 1
#define TYPE_INT32 2
#define TYPE_INT64 3
#define TYPE_FLOAT 4
#define TYPE_DOUBLE 5
#define TYPE_STRING 6
#define TYPE_BINARY 7
#define EXTYPE_NULL 0x00
#define EXTYPE_UNIQUE 0x40
#define EXTYPE_NONNULL 0x80
#define EXTYPE_FOREIGNKEY 0xc0
typedef uint8_t type_t;
typedef uint64_t key_t;
// 为类型 type 创建索引
// 返回:索引头节点的指针 index
void* create_index(int fd, type_t t);
// 加载类型 type 的索引
// 返回:索引头节点的指针 index
void* load_index(int fd, type_t t, uint64_t ptr);
// 插入一条索引
int insert_item(int fd, type_t t, void* index, key_t k, uint64_t ptr);
// 使用索引查找目标
// 返回ptr
uint64_t find_item_by_key(int fd, type_t t, void* index, key_t k);
// 使用索引删除项
int remove_item_by_key(int fd, type_t t, void* index, key_t k);
#endif