Skip to content
This repository has been archived by the owner on May 11, 2022. It is now read-only.

Stateful eventbus #51

Closed
wants to merge 2 commits into from
Closed

Stateful eventbus #51

wants to merge 2 commits into from

Conversation

aarshkshah1992
Copy link
Collaborator

autonat.go Outdated
Comment on lines 80 to 82
emitUnknown, _ := h.EventBus().Emitter(new(event.EvtLocalRoutabilityUnknown), eventbus.Stateful)
emitPublic, _ := h.EventBus().Emitter(new(event.EvtLocalRoutabilityPublic), eventbus.Stateful)
emitPrivate, _ := h.EventBus().Emitter(new(event.EvtLocalRoutabilityPrivate), eventbus.Stateful)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How will this interact with a subscriber who subscribes to all three events? Won't they just be confused as to the current state?

Is there a reason we don't have a single emitter with multiple different state options, instead of three emitters?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a good point.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We've agreed to merge all three types into a single type with an enum and replace all the emitters with a single emitter. @Stebalien is working on a PR for that and will fix this PR once this is done.

@willscott
Copy link
Contributor

ℹ️ The combination of events into one is also something in #41
Everything here is waiting on a release of -core before it can merge.
I'd be happy to have this merged into #41 in the meantime so there's only one branch to maintain while we wait

@aschmahmann
Copy link
Contributor

aschmahmann commented Mar 6, 2020

@willscott how stable is #41, and would you recommend me using it within the DHT testground plan?

I'm planning on updating the test plan to use the latest proposed DHT changes, and they include a dependency on the latest version of go-libp2p-core (for the Reachability event) which is emitted in this PR. If you think I should rely on #41 then go for the merge and lmk so I can figure out which commit to depend on.

Also, is there a reason why we shouldn't merge this and then rebase #41 on it? While it's a bit annoying that we're depending on a commit of go-libp2p-core instead of release it seems like we can just update the go.mod after we do a -core release.

@aarshkshah1992
Copy link
Collaborator Author

Closing as this has been absorbed in #41.

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

Successfully merging this pull request may close these issues.

4 participants