Coder Social home page Coder Social logo

KV数据库,写满如何处理 about flashdb HOT 6 OPEN

armink avatar armink commented on August 30, 2024
KV数据库,写满如何处理

from flashdb.

Comments (6)

armink avatar armink commented on August 30, 2024

KV 你都用来存什么数据了?

from flashdb.

joechenchen avatar joechenchen commented on August 30, 2024

朱工:
static struct fdb_kvdb kvdb = { 0 };
static uint32_t boot_count = 0;
static time_t boot_time[10] = {0, 1, 2, 3};
static uint8_t test[4000] = {0};
static struct fdb_default_kv_node default_kv_table[] = {
{"username", "armink", 0}, /* string KV /
{"password", "123456", 0}, /
string KV /
{"boot_count", &boot_count, sizeof(boot_count)}, /
int type KV /
{"boot_time", &boot_time, sizeof(boot_time)}, /
int array type KV /
{"test", &test, sizeof(test)}, /
测试写满后的操作*/
};

stErr = fdb_kv_set_blob(kvdb, "test", fdb_blob_make(&blob, &test, sizeof(test)));
用来存储系统参数,想验证下写满后,能否继续写入,于是做了个实验,每次存4000个数据,发现第二次调用fdb_kv_set_blob写入4000个数据时,返回FDB_SAVED_FULL,第三次调用fdb_kv_set_blob又能够正常写入,目前将分区大小增大到12K,连续调用10次fdb_kv_set_blob都没出现FDB_SAVED_FULL。我想咨询下KV操作时,当写满时,是否需要用户去执行fdb_kv_set_default操作。

from flashdb.

armink avatar armink commented on August 30, 2024

不需要的,fdb_kv_set_default 相当于格式化,用户的数据都被清空了

from flashdb.

joechenchen avatar joechenchen commented on August 30, 2024

你好,也就是说KV数据库写满后,能够自动支持重新从起始地址开始,写入最新参数是吧,如果这样的话,就很方便了。

from flashdb.

wwm2021 avatar wwm2021 commented on August 30, 2024

目前的文件结构有点复杂,计划何时规整?

from flashdb.

joechenchen avatar joechenchen commented on August 30, 2024

from flashdb.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.