mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
embed: add example for ServiceRegister.
This commit is contained in:
@@ -28,6 +28,7 @@ import (
|
||||
"github.com/coreos/etcd/pkg/netutil"
|
||||
"github.com/coreos/etcd/pkg/transport"
|
||||
"github.com/coreos/etcd/pkg/types"
|
||||
|
||||
"github.com/ghodss/yaml"
|
||||
"google.golang.org/grpc"
|
||||
)
|
||||
@@ -127,7 +128,13 @@ type Config struct {
|
||||
// The map key is the route path for the handler, and
|
||||
// you must ensure it can't be conflicted with etcd's.
|
||||
UserHandlers map[string]http.Handler `json:"-"`
|
||||
// ServiceRegister is for registering users' gRPC services.
|
||||
// ServiceRegister is for registering users' gRPC services. A simple usage example:
|
||||
// cfg := embed.NewConfig()
|
||||
// cfg.ServerRegister = func(s *grpc.Server) {
|
||||
// pb.RegisterFooServer(s, &fooServer{})
|
||||
// pb.RegisterBarServer(s, &barServer{})
|
||||
// }
|
||||
// embed.StartEtcd(cfg)
|
||||
ServiceRegister func(*grpc.Server) `json:"-"`
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user