orbit-db-docstore icon indicating copy to clipboard operation
orbit-db-docstore copied to clipboard

[Feature Request] Ability to query history for an entry.

Open vaultec81 opened this issue 6 years ago • 5 comments

Currently docstore Index only keeps track of whether a docstore entry exists or not and the current value coinciding to it. There could be a toggle that turns on and off the past history tracking when the store instance is created. History would contain pasts queryable values, deletion, creation. This would be essentially converting events from the oplog into a useable format.

Side note: in the future the index could only store event meta, such as add, del. Values would be stored on disk/IPFS to conserve memory. Potentially even sharded (at the cost of performance) to save space.

I am willing to submit a PR to add this feature.

vaultec81 avatar Oct 23 '19 20:10 vaultec81

@vaultec81 sounds compelling! Would you get what you needed by simple listing out the events in the log that pertain to that index?

aphelionz avatar Oct 23 '19 21:10 aphelionz

@aphelionz Yes, that would work.

vaultec81 avatar Oct 23 '19 22:10 vaultec81

If you want to attempt a PR I would suggest then modifying / extending the Index.updateIndex function to encapsulate that somehow. It should actually be fairly straightforward in the reduce call, and bonus points if you keep it backwards compatible :D

aphelionz avatar Oct 24 '19 00:10 aphelionz

@aphelionz I am curious about what is the best approach to doing a history tracking system. Should it be built into the docstore index or in Orbit-db core itself. It would be simpler to add a new function on to docstore that interfaces with the history index. There isn't any changes to the data stored itself (or Orbit-db core), so it would be backwards compatible

vaultec81 avatar Oct 27 '19 20:10 vaultec81

IMO it should be in the docstore index for now, since other store types may or may not want the feature.

aphelionz avatar Oct 28 '19 00:10 aphelionz