micro/server/wrapper.go

20 lines
689 B
Go
Raw Normal View History

package server
import (
2018-03-03 14:53:52 +03:00
"context"
)
2015-12-03 00:16:44 +03:00
// 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.
2015-12-02 23:56:50 +03:00
type HandlerFunc func(ctx context.Context, req Request, rsp interface{}) error
2015-12-03 00:16:44 +03:00
// HandlerWrapper wraps the HandlerFunc and returns the equivalent
2015-12-02 14:54:36 +03:00
type HandlerWrapper func(HandlerFunc) HandlerFunc
2018-04-14 20:15:09 +03:00
// StreamWrapper wraps a Stream interface and returns the equivalent.
2015-12-18 04:01:59 +03:00
// 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.
2018-04-14 20:15:09 +03:00
type StreamWrapper func(Stream) Stream