Include original clock and feeds in history() elements etc
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 748
- Forks
- 56
- PR merge metrics
- No merged PRs in 30d
Description
Writer._decode converts results taken from the database before being passed to the user. The vector clock entries are rearranged to match the local feed list. (It looks like the trie is altered as well although I'm not familiar with the trie yet)
It would be nice for the original, remote vector clock to be available in the result, in case the clock was used for anything (I'm using it to hash the feed tips together). For this to be useful, the remote feeds could be returned too (which I guess means passing them via _encodeMap).
Something like this perhaps:
diff --git a/index.js b/index.js
index bfd9c46..f84e084 100644
--- a/index.js
+++ b/index.js
@@ -748,6 +748,10 @@ Writer.prototype._decode = function (seq, buf, cb) {
val.path = hash(val.key, true)
val.value = val.value && this._db._valueEncoding.decode(val.value)
+ val.rawClock = val.clock
+ val.rawTrie = val.trie
+ val.rawFeeds = this._mapList(this._db.feeds, this._encodeMap, null)
+
if (this._feedsMessage && this._feedsLoaded === val.inflate) {
this._maybeUpdateFeeds()
val.feed = this._id
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in index.js at Writer._decode and trace how database results become history() elements, then inspect _encodeMap and the handling of vector clocks, tries, and feeds. Done means the result exposes the original remote clock and relevant feeds without losing the existing decoded values; clarify whether the trie must also be preserved.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- databases, distributed-systems
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100