ttrpc/handlers.go
Stephen J Day 42ff40f1f1
mgrpc: initial implementation of server
With this change, we define a simple server and client framework to
start generating code against. We define a simple handler system with
back registration into the server definition.

From here, we can start generating code against the handlers.

Signed-off-by: Stephen J Day <stephen.day@docker.com>
2017-11-14 12:18:06 -08:00

14 lines
323 B
Go

package mgrpc
import "context"
type Handler interface {
Handle(ctx context.Context, req interface{}) (interface{}, error)
}
type HandlerFunc func(ctx context.Context, req interface{}) (interface{}, error)
func (fn HandlerFunc) Handle(ctx context.Context, req interface{}) (interface{}, error) {
return fn(ctx, req)
}