Files

27 lines
1.0 KiB
Go
Raw Permalink Normal View History

2023-04-19 20:10:09 +02:00
package server
import (
"context"
)
// HandlerFunc represents a single method of a handler. It's used primarily
// for the wrappers. What's handed to the actual method is the concrete
// request and response types.
type HandlerFunc func(ctx context.Context, req Request, rsp interface{}) error
// SubscriberFunc represents a single method of a subscriber. It's used primarily
// for the wrappers. What's handed to the actual method is the concrete
// publication message.
type SubscriberFunc func(ctx context.Context, msg Message) error
2024-02-21 10:20:36 +01:00
// HandlerWrapper wraps the HandlerFunc and returns the equivalent.
2023-04-19 20:10:09 +02:00
type HandlerWrapper func(HandlerFunc) HandlerFunc
2024-02-21 10:20:36 +01:00
// SubscriberWrapper wraps the SubscriberFunc and returns the equivalent.
2023-04-19 20:10:09 +02:00
type SubscriberWrapper func(SubscriberFunc) SubscriberFunc
// StreamWrapper wraps a Stream interface and returns the equivalent.
// Because streams exist for the lifetime of a method invocation this
// is a convenient way to wrap a Stream as its in use for trace, monitoring,
// metrics, etc.
type StreamWrapper func(Stream) Stream