Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include original clock and feeds in history() elements etc #118

Open
xloem opened this issue May 7, 2018 · 1 comment
Open

Include original clock and feeds in history() elements etc #118

xloem opened this issue May 7, 2018 · 1 comment

Comments

@xloem
Copy link
Contributor

xloem commented May 7, 2018

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
@mafintosh
Copy link
Owner

Either that or we expose a method do denormalize. I'm fine either way :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants