berty / go-orbit-db

Go version of P2P Database on IPFS
https://berty.tech
Apache License 2.0
405 stars 55 forks source link

v1.14.1 -> v1.16.0, no more *stores.EventReady event? #100

Closed mrusme closed 2 years ago

mrusme commented 2 years ago

I'm experiencing an issue in one of my projects, in which I've upgraded from v1.14.1 to v1.15.1 and I don't seem to be getting the *stores.EventReady event anymore from the documentstore that I'm using.

Did something change / is there a replacement for this event? Thank you.

mrusme commented 2 years ago

Just tried v1.16.0 and it's the same, the application won't start because it looks like the stores.EventReady event won't show up. I quickly checked the go-orbit-db code and it seems the event is still present. Has something else changed that would require initializing the database differently in order for it to become ready?

Appreciate any help here.

gfanton commented 2 years ago

@mrusme sorry for the delay, i've update the event system in favor of https://github.com/libp2p/go-eventbus you should use EventBus instead of the deprecated Subscribe method. Also Events doesn't have pointer anymore, so you should update *stores.EventReady to stores.EventReady

usage example: https://github.com/berty/go-orbit-db/blob/07c8fbab7657926d723aaee4ba50c58c88b7959b/tests/persistence_test.go#L163-L201

GitHub
GitHub - libp2p/go-eventbus: a simple and fast eventbus for type-based local event delivery.
a simple and fast eventbus for type-based local event delivery. - GitHub - libp2p/go-eventbus: a simple and fast eventbus for type-based local event delivery.
mrusme commented 2 years ago

Thank you, that was the info I needed. Upgrade has worked and the EventReady event is now firing. Appreciate it!