Code Monkey home page Code Monkey logo

Comments (4)

domenic avatar domenic commented on June 12, 2024

I'm not quite sure I understand this. In particular, what IndexedDB operations do you suggest this maps to?

from kv-storage.

kaizhu256 avatar kaizhu256 commented on June 12, 2024

there is no existing IndexedDB operation to "append" data to an entry. this would be a new operation in kv-storage, for example:

// persist nedb as logfile
tx.objectStore(store).add("nedb", "");
// log set-operation to table1
tx.objectStore(store).append("nedb", 'table1 set { "id": 1, "field1": "foo", "field2": "bar" }\n');
// log set-operation to table1
tx.objectStore(store).append("nedb", 'table1 set { "id": 2, "field1": "baz", "field2": "quz" }\n');
// log delete-operation to table1
tx.objectStore(store).append("nedb", 'table1 delete { "id": 1 }\n');

...

// restart browser, and restore nedb by replaying logfile
var logfile = tx.objectStore(store).get("nedb");
var myDb = replay(logfile);
// myDb = { table1: [{id: 2, field1: "baz", field2: "qux"}] }

because IndexedDB has no append feature, nedb currently has to inefficiently set the entire logfile for write-persists.

from kv-storage.

domenic avatar domenic commented on June 12, 2024

Ah, OK. Since KV Storage is just a higher-level interface on top of IndexedDB, I think you'd be best off opening the issue on the IndexedDB specification instead: https://github.com/w3c/IndexedDB/issues/. It's not within scope here to add things which are impossible to accomplish with IndexedDB.

Closing, but happy to continue discussing in the closed thread!

from kv-storage.

kaizhu256 avatar kaizhu256 commented on June 12, 2024

ok, thx for clarifying scope of kv-storage as just mapping of indexeddb.

from kv-storage.

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.