edge/pkg/bus/bus.go
William Petit ad49c1718c
All checks were successful
arcad/edge/pipeline/head This commit looks good
arcad/edge/pipeline/pr-master This commit looks good
feat: rewrite bus to prevent deadlocks
2023-11-30 15:02:36 +01:00

14 lines
387 B
Go

package bus
import "context"
type Bus interface {
Subscribe(ctx context.Context, addr Address) (<-chan Envelope, error)
Unsubscribe(addr Address, ch <-chan Envelope)
Publish(env Envelope) error
Request(ctx context.Context, env Envelope) (Envelope, error)
Reply(ctx context.Context, addr Address, h RequestHandler) chan error
}
type RequestHandler func(env Envelope) (any, error)