why not exchange remote head
https://github.com/berty/go-orbit-db/blob/e9658b4e3af28dd8123b11fad123ba7a27e18bf5/baseorbitdb/orbitdb.go#L931
add a local head in one node and other nodes sync this of remote head。If I stop these nodes that have local head and run a new node。Other nodes that only have remote heads do not sync their remote head。So the new node that I run do not receive head and sync data from ipfs。
like i say in the comment just behind, i got some unknown problem when syncing "_remoteheads".
// >>>> @FIXME(gfanton): looks like activate this break the exchange
// rawRemoteHeads, err := store.Cache().Get(ctx, datastore.NewKey("_remoteHeads"))
// if err != nil && err != datastore.ErrNotFound {
// return errors.Wrap(err, "unable to get data from cache")
// }
And i'm aware that the js implementation actually sync the _remoteheads: https://github.com/orbitdb/orbit-db/blob/480ce576c848c912d15dc54fe3a7fa0304881f22/src/exchange-heads.js#L12
I need first to understand why enabling those lines on go-orbit-db implementation break things up.
I will check this when I got some time.
GitHub
Peer-to-Peer Databases for the Decentralized Web. Contribute to orbitdb/orbit-db development by creating an account on GitHub.
thanks! I expect your answer. @gfanton
Unfortunately I still haven't had time to test it... You can try this feature by doing the following change:
modified baseorbitdb/orbitdb.go
@@ -934,14 +934,14 @@ func (o *orbitDB) exchangeHeads(ctx context.Context, p peer.ID, store Store) err
}
// @FIXME(gfanton): looks like activate this break the exchange
- // rawRemoteHeads, err := store.Cache().Get(ctx, datastore.NewKey("_remoteHeads"))
- // if err != nil && err != datastore.ErrNotFound {
- // return errors.Wrap(err, "unable to get data from cache")
- // }
+ rawRemoteHeads, err := store.Cache().Get(ctx, datastore.NewKey("_remoteHeads"))
+ if err != nil && err != datastore.ErrNotFound {
+ return errors.Wrap(err, "unable to get data from cache")
+ }
heads := []*entry.Entry{}
- for _, rawHeads := range [][]byte{rawLocalHeads} {
+ for _, rawHeads := range [][]byte{rawLocalHeads, rawRemoteHeads} {
if len(rawLocalHeads) > 0 {
var dHeads []*entry.Entry
err = json.Unmarshal(rawHeads, &dHeads)
If you can open a pull request with this change and add a test to show that it actually works, that would be great!
@gfanton I tested it and the problem was solved. I suggest leaving this comment open so that remote branches can be synchronized
:tada: This issue has been resolved in version 1.20.0 :tada:
The release is available on GitHub release
Your semantic-release bot :package::rocket: