embed: add example for ServiceRegister.
@@ -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:"-"`
}
