github.com/argoproj/argo-events@v1.9.1/eventbus/common/interface.go (about) 1 package common 2 3 import ( 4 "context" 5 "fmt" 6 "time" 7 8 cloudevents "github.com/cloudevents/sdk-go/v2" 9 ) 10 11 type Connection interface { 12 Close() error 13 14 IsClosed() bool 15 } 16 17 type EventSourceConnection interface { 18 Connection 19 20 Publish(ctx context.Context, msg Message) error 21 } 22 23 type TriggerConnection interface { 24 Connection 25 26 fmt.Stringer // need to implement String() 27 28 Subscribe(ctx context.Context, 29 closeCh <-chan struct{}, 30 resetConditionsCh <-chan struct{}, 31 lastResetTime time.Time, 32 transform func(depName string, event cloudevents.Event) (*cloudevents.Event, error), 33 filter func(string, cloudevents.Event) bool, 34 action func(map[string]cloudevents.Event), 35 defaultSubject *string) error 36 } 37 38 type EventSourceDriver interface { 39 Initialize() error 40 Connect(clientID string) (EventSourceConnection, error) 41 } 42 43 type SensorDriver interface { 44 Initialize() error 45 Connect(ctx context.Context, 46 triggerName string, 47 dependencyExpression string, 48 deps []Dependency, 49 atLeastOnce bool) (TriggerConnection, error) 50 }