mafintosh / mafintosh/hyperdb

Include original clock and feeds in history() elements etc

Open
#118 1 comment 0 reactions 0 assignees View on GitHub

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

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.