You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

74 lines
1.4 KiB

#pragma once
#include <stdint.h>
#include <stdio.h>
#define DB_VERSION 0xabcd1234 // 如果该数值不一致,则更新清空数据库
typedef struct {
const char* name;
uint32_t add;
uint32_t itermSize;
uint32_t itermMaxNum;
} zhdb_table_t;
typedef struct {
uint32_t version;
} zhdb_header_t;
void zhdb_init();
void zhdb_reg_table_info(const char* name, uint32_t itermSize, uint32_t itermMaxNum);
void zhdb_before_run_prepare();
void zhdb_read_table(const char* name, void* cache, uint32_t cachelen);
void zhdb_write_item(uint32_t add, const char* data, size_t len);
// add
// --> readall
// --> findNextPos
// --> forceFindNextPos
// --> write
// void
// void writetostorage();
// readall()
// sort
// update()
//+++++++++++++++++++++++++++++++++
// cache (dirty)
//+++++++++++++++++++++++++++++++++
// storage
//+++++++++++++++++++++++++++++++++
//
// Dao
// find
// getALL() -> table_add, table_size, iterm_size, iterm_num (预留的空间越大,则查询的时间越长),
// 但这样反而能保证设备的一致性
// delete
//
//
//
// 上电之后,遍历所有存储,记录一些速查标记,记录在table结构体里面
// 分页查询,
//
// 纯内存数据结果呢?上千条记录
// 遍查询,遍筛选数据(可用于分页????)
// 分页实现方案,通过条总数
// 如何实现按顺序分页
//
// tabl
// table_add
// table_size
//
// search all
//
// delete