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

event bus should be bound to scopes #1666

Open
dustmop opened this issue Mar 2, 2021 · 2 comments
Open

event bus should be bound to scopes #1666

dustmop opened this issue Mar 2, 2021 · 2 comments
Labels
event bus Issues with events & coordination using the event.Bus
Milestone

Comments

@dustmop
Copy link
Contributor

dustmop commented Mar 2, 2021

TODO from dispatch PR: https://github.com/qri-io/qri/pull/1653/files
// TODO(dustmop): Filter only events for this scope.

Let's say two methods are running at once, one is pulling a dataset and the other is getting status from an FSI directory. The first gets events from the bus about pull progress. The second should not be able to get any of these events, no matter how it tries to subscribe to them. This requires changing the bus such that events are bound to the current scope.

Certain subsystems, such as the filesystem watcher, or websockets, should still be able to see events globally.

@Arqu
Copy link
Contributor

Arqu commented Mar 4, 2021

If I remember correctly, the idea was to use run-ids to separate the "subscribe" interfaces.
In that sense some auth mechanic should be present on the dispatch level and bellow that things should be trusted.
However, I think this should be configurable as external implementations using lib might not want that type of isolation for message passing.

@b5 b5 added the event bus Issues with events & coordination using the event.Bus label Mar 16, 2021
@b5 b5 added this to the v0.10.1 milestone Mar 16, 2021
@ramfox ramfox mentioned this issue Apr 8, 2021
29 tasks
@b5 b5 modified the milestones: v0.10.1, v0.11.0 Sep 10, 2021
@ramfox ramfox closed this as completed Sep 15, 2021
@ramfox ramfox reopened this Sep 15, 2021
@ramfox
Copy link
Member

ramfox commented Sep 15, 2021

has this been closed by: #1870 ?

The PR adds profileid := profile.IDFromCtx(ctx) and passes that profile id to the event in bus.publish:

qri/event/event.go

Lines 153 to 170 in d451f6f

func (b *bus) publish(ctx context.Context, typ Type, sessionID string, payload interface{}) error {
b.lk.RLock()
defer b.lk.RUnlock()
log.Debugw("publish", "type", typ, "payload", payload)
if b.closed {
return ErrBusClosed
}
profileid := profile.IDFromCtx(ctx)
e := Event{
Type: typ,
Timestamp: NowFunc().UnixNano(),
SessionID: sessionID,
ProfileID: profileid,
Payload: payload,
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
event bus Issues with events & coordination using the event.Bus
Projects
None yet
Development

No branches or pull requests

4 participants