Skip to content

Catch up after some peer(s) were dormant and on addPeer() #7

@pgmemk

Description

@pgmemk

Not yet implemented. But here are some thoughts on how to and some stumbling blocks:

While running

  • Create another index in Diff hyperbee that maps timestamp to the key like this:
key: timestamp
value: {
  _objectId: diffObjectId,
  pubKey: hyperbeePubKey // 'hex' string diffFeed.key.toString('hex')
}

Let's call this Stub

Note: We need pubKey above, so that we know which peer has this diff object.

On restart:

  • Find in Store hyperbee all Stubs that have timestamp that is bigger then the timestamp of the last object written in Store hyperbee using createUnionStream which would be great except after
  • Get all the Diff objects from the hyperbees using pubKey of the Stub to know where to look for it
  • Merge Diff objects with Store objects that Diff objects point to

Above algo does not cover the following case

Above find will not find the objects that were not yet applied to Store. Those are the Diff objects that have a timestamp which is earlier then the last timestamp of the Store object

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions