Coder Social home page Coder Social logo

Comments (9)

armink avatar armink commented on July 26, 2024

可以用,blob KV API,如 fdb_kv_set_blob API

from flashdb.

ivan7wl avatar ivan7wl commented on July 26, 2024

可以用,blob KV API,如 fdb_kv_set_blob API

fdb_kv_set_blob调用了set_kv,set_kv里面使用了static变量kv和sector,就是不可重入的。

from flashdb.

armink avatar armink commented on July 26, 2024

fdb_kv_set_blob 里有 lock

from flashdb.

ivan7wl avatar ivan7wl commented on July 26, 2024

fdb_kv_set_blob 里有 lock

lock的设计意图是避免多个进程访问同一个kvdb实例产生冲突,但是现在不同的进程访问不同的kvdb实例,仍可能在static变量上产生冲突,所以即使是不同的实例,也要加全局锁。

from flashdb.

armink avatar armink commented on July 26, 2024

明白你的意思了,可以移除掉 set_kv/del_kv 中的 static 修饰,方便提交一个 PR 改进下吗

from flashdb.

ivan7wl avatar ivan7wl commented on July 26, 2024

我这边修改比较简单,就直接说了吧:

  1. del_kv()里用到的last_is_complete_del,把last_is_complete_del放在struct fdb_tsdb结构体里,通过db->last_is_complete_del引用;
  2. set_kv()里的kv和sector变量,去掉static修饰,直接定义在栈上,会稍微多消耗一些栈空间

from flashdb.

armink avatar armink commented on July 26, 2024

我这边修改比较简单,就直接说了吧:

  1. del_kv()里用到的last_is_complete_del,把last_is_complete_del放在struct fdb_tsdb结构体里,通过db->last_is_complete_del引用;
  2. set_kv()里的kv和sector变量,去掉static修饰,直接定义在栈上,会稍微多消耗一些栈空间

完全可以的,可以尝试提交一下 PR 吗

from flashdb.

likyo avatar likyo commented on July 26, 2024

fdb_kv_get()这个函数不可重入,并且没法读取汉字字符串。因为加了ascii判断

from flashdb.

armink avatar armink commented on July 26, 2024

fixed in b3041a1

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.