Comments (14)
程序一般做法为删除之前的 9:00-10:00 的数据
from flashdb.
建议用单调时钟作为时间戳,不要直接用系统时间
from flashdb.
程序一般做法为删除之前的 9:00-10:00 的数据
如果用所谓的单调时间而不是系统时间,那么通过数据的时间查询就没有意义了
from flashdb.
程序一般做法为删除之前的 9:00-10:00 的数据
按照你之前的回答,不能直接删除数据,所谓删除只能是修改tsl的状态,是吗?
from flashdb.
程序一般做法为删除之前的 9:00-10:00 的数据
按照你之前的回答,不能直接删除数据,所谓删除只能是修改tsl的状态,是吗?
是的,改为删除状态,应用用的时候就可以有所区分
from flashdb.
谢谢朱工!
from flashdb.
朱工你好,请问,是否是这样做:
static bool set_status_cb(fdb_tsl_t tsl, void *arg)
{
fdb_tsdb_t db = arg;
FDB_INFO("set the TSL (time %ld) status from %d to %d\n", tsl->time, tsl->status, FDB_TSL_USER_STATUS1);
fdb_tsl_set_status(db, tsl, FDB_TSL_USER_STATUS1);
return false;
}
static void delete_preTime_hisData(uint32_t tsl_time,uint8_t datatype)
{
uint32_t Last_tsl_time = 0;
/* read last saved time for simulated timestamp */
fdb_tsdb_control(&RainHs_tsdb, FDB_TSDB_CTRL_GET_LAST_TIME, &Last_tsl_time);
if (tsl_time < Last_tsl_time)
{
fdb_tsl_iter_by_time(&RainHs_tsdb, tsl_time-1, Last_tsl_time, set_status_cb, &RainHs_tsdb);
}
}
然后在每次运行插入tsl前,首先判断时间,如果小于上一条记录时间,就删除:
delete_preTime_hisData(RainHs_tsdb.get_time(),Rain);
result = fdb_tsl_append(&RainHs_tsdb, fdb_blob_make(&blob, p_element, sizeof(hrv_history_key)));
---请问,朱工,以上的流程对吗?
from flashdb.
另外一个问题,如果不删除之前的数据会导致什么后果?因为如果是日志信息,所有的我都不想删除。
from flashdb.
- 1、删除不是用
FDB_TSL_USER_STATUS1
而是用FDB_TSL_DELETE
- 2、在每次运行插入tsl前都判断会不会有些繁琐,第一次启动时候判断下应该就行了
- 3、不删除会导致数据库时间轴出现紊乱,查询的结果也会乱套
- 4、如果只是日志,可以不用设置 RTC 时间戳,参考我前两天新改的 demo,每次启动时,读取上次保存的 last_time ,这样是可以保证记录的有序性
from flashdb.
朱工你好,谢谢你的回复,你在例程中这样写道:
- NOTE: The actions to modify the state must be in order.
* FDB_TSL_WRITE -> FDB_TSL_USER_STATUS1 -> FDB_TSL_DELETED -> FDB_TSL_USER_STATUS2
是否必须按照这个顺序来设置TSL的状态,比如需要设置tsl为 FDB_TSL_DELETED ,首先要设置为FDB_TSL_USER_STATUS1,再次设置FDB_TSL_DELETED?
from flashdb.
是得按照顺序,但可以跳过中间状态
from flashdb.
嗯,好的,谢谢朱工!
FlashDB很好用,在其进行初始化时,需要对每一个secotr写一个控制信息,如果分区空间比较大,比如3M Bytes,那么初始化时间就比较长,有没有办法改进一下,以减少初始化时间?
from flashdb.
第一次格式化的时间好像没法省吧,这个也就只有第一次才存在问题
from flashdb.
第一次格式化的时间好像没法省吧,这个也就只有第一次才存在问题
谢谢朱工,谢谢!
from flashdb.
Related Issues (20)
- FlashDB 中tsdb如何实现log存储,需要用easylogger配合吗?
- [FlashDB][tsl][log] Error: this TSL (0x004002E8) size (724249387) is out of bound.remain = 3972857
- 出现crc32 failed, 测试程序boot_count总是读取失败, 但是测试程序temp的read/write是正常的 HOT 2
- KVDB在写满后再次写入失败,需要写入第二次 HOT 1
- 请教 KVDB 掉电异常后的恢复方法
- 测试tsdb连续保存累计数达一定数量后出现前面部分数据丢失的现象 HOT 2
- 用文件作为存储后端,有锁首次初始化时,_fdb_kv_load 中调用 fdb_kv_set_default 死锁 HOT 2
- 老化擦写Flash的KV后,读取一个不存在的KV或者写一个不存在的KV,Flash耗时长
- check the current timestamp, MUST more than the last save timestamp HOT 4
- 是否支持STM32G0B1RCT6 HOT 6
- 分区越大,插入速度越慢 HOT 2
- sfud_flash_def.h 部分有误 HOT 4
- KVDB Demo 运行出错 HOT 1
- linux的demo程序第一次运行都会卡住 HOT 2
- Error: The KV (@0x0000FF4F) CRC32 check failed!
- Support wear balance
- tsdb
- FR:tsdb读取最新一条数据内容 HOT 1
- TSDB能否调整为递增序列式。 HOT 1
- V2.1.0使用tsdb遇到一个问题,假如tsdb刚好全部写满的时候重启了,再次开机 初始化tsdb的时候,会出现oldest sectors is 0x00000FFF, current using sector is 0xFFFFFFFF, 导致后续无法写入 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from flashdb.