@@ -28,7 +28,7 @@ type Config struct {
2828 // MaxReconcileTime the maximum time a handle of an item should take
2929 MaxReconcileTime time.Duration
3030 // Observability configuration for logs, metrics and traces
31- Observability Observability
31+ Observability Observability
3232}
3333
3434func DefaultConfig () Config {
@@ -53,6 +53,7 @@ type Handler interface {
5353
5454// HandlerFunc see Handler
5555type HandlerFunc func (ctx context.Context , id string ) Result
56+
5657func (f HandlerFunc ) Handle (ctx context.Context , id string ) Result {
5758 return f (ctx , id )
5859}
@@ -84,7 +85,6 @@ type Error interface {
8485 RetryDelay () time.Duration
8586}
8687
87-
8888// WorkerHasher specifies which of the control-loop workers should handle this specific item.
8989type WorkerHasher interface {
9090 // Route decide on which worker this item will go (return a value < 0 to drop this item), count is the number of items
@@ -93,6 +93,7 @@ type WorkerHasher interface {
9393
9494// WorkerHasherFunc see WorkerHasher
9595type WorkerHasherFunc func (ctx context.Context , id string , count int ) (int , error )
96+
9697func (f WorkerHasherFunc ) Route (ctx context.Context , id string , count int ) (int , error ) {
9798 return f (ctx , id , count )
9899}
@@ -114,6 +115,7 @@ type EventHandler interface {
114115
115116// EventHandlerFunc see EventHandler
116117type EventHandlerFunc func (ctx context.Context , jobId string ) error
118+
117119func (f EventHandlerFunc ) Handle (ctx context.Context , jobId string ) error {
118120 return f (ctx , jobId )
119121}
@@ -145,6 +147,7 @@ type EventStream interface {
145147
146148// EventStreamFunc see EventStream
147149type EventStreamFunc func (ctx context.Context , handler EventHandler ) error
150+
148151func (f EventStreamFunc ) Subscribe (ctx context.Context , handler EventHandler ) error {
149152 return f (ctx , handler )
150153}
0 commit comments