micro-register-service/proto/registry_micro.pb.go
Vasiliy Tolstov 4c99389c04 use own fork
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2021-01-19 22:08:06 +03:00

73 lines
2.4 KiB
Go

// Code generated by protoc-gen-micro
// source: registry.proto
package service
import (
"context"
micro_api "github.com/unistack-org/micro/v3/api"
micro_client "github.com/unistack-org/micro/v3/client"
micro_server "github.com/unistack-org/micro/v3/server"
)
// NewRegistryEndpoints provides api endpoints metdata for Registry service
func NewRegistryEndpoints() []*micro_api.Endpoint {
var endpoints []*micro_api.Endpoint
return endpoints
}
// RegistryService interface
type RegistryService interface {
GetService(context.Context, *GetRequest, ...micro_client.CallOption) (*GetResponse, error)
Register(context.Context, *Service, ...micro_client.CallOption) (*EmptyResponse, error)
Deregister(context.Context, *Service, ...micro_client.CallOption) (*EmptyResponse, error)
ListServices(context.Context, *ListRequest, ...micro_client.CallOption) (*ListResponse, error)
Watch(context.Context, *WatchRequest, ...micro_client.CallOption) (Registry_WatchService, error)
}
type Registry_WatchService interface {
Context() context.Context
SendMsg(interface{}) error
RecvMsg(interface{}) error
Close() error
Recv() (*Result, error)
}
// Micro server stuff
// RegistryHandler server handler
type RegistryHandler interface {
GetService(context.Context, *GetRequest, *GetResponse) error
Register(context.Context, *Service, *EmptyResponse) error
Deregister(context.Context, *Service, *EmptyResponse) error
ListServices(context.Context, *ListRequest, *ListResponse) error
Watch(context.Context, *WatchRequest, Registry_WatchStream) error
}
// RegisterRegistryHandler registers server handler
func RegisterRegistryHandler(s micro_server.Server, sh RegistryHandler, opts ...micro_server.HandlerOption) error {
type registry interface {
GetService(context.Context, *GetRequest, *GetResponse) error
Register(context.Context, *Service, *EmptyResponse) error
Deregister(context.Context, *Service, *EmptyResponse) error
ListServices(context.Context, *ListRequest, *ListResponse) error
Watch(context.Context, micro_server.Stream) error
}
type Registry struct {
registry
}
h := &registryHandler{sh}
for _, endpoint := range NewRegistryEndpoints() {
opts = append(opts, micro_api.WithEndpoint(endpoint))
}
return s.Handle(s.NewHandler(&Registry{h}, opts...))
}
type Registry_WatchStream interface {
Context() context.Context
SendMsg(interface{}) error
RecvMsg(interface{}) error
Close() error
Send(*Result) error
}