Coder Social home page Coder Social logo

Comments (3)

xujiajun avatar xujiajun commented on June 14, 2024

@xww ,谢谢关注。你好,
1 关于你说的 func (tx *Tx) Commit() error {} 这边的数据在持久化到磁盘前,肯定是做了数据结构区分的,不然怎么做索引。
2 关于你说的 同时tx.buildIdxes(writesLen)又会把数据全部写在内存的list链表里面一次 这个是根据不同的数据结构建立对应的索引,不你说的会把数据全部写在内存的list链表里面一次

另外 nutsdb 的确还存在很多不足 ,欢迎指出,一起讨论,改善。

from nutsdb.

xww avatar xww commented on June 14, 2024

但是你看下面的代码,你为list类型的数据创建索引,确实是吧key和value都在内存中保存了一份啊?这个我没有理解错吧?也就是说磁盘有一份,内存的索引其实还有一份,这个索引并不是key+value的地址,而是直接就是key+value,对吧?
func (tx *Tx) buildListIdx(bucket string, entry *Entry) {
if _, ok := tx.db.ListIdx[bucket]; !ok {
tx.db.ListIdx[bucket] = list.New()
}

key, value := entry.Key, entry.Value

switch entry.Meta.Flag {
case DataLPushFlag:
	_, _ = tx.db.ListIdx[bucket].LPush(string(key), value)

from nutsdb.

xujiajun avatar xujiajun commented on June 14, 2024

是的。对于list类型的确是内存和磁盘都存了一份。

from nutsdb.

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.