2019-09-09 08:57:57 -07:00
|
|
|
// Code generated by protoc-gen-micro. DO NOT EDIT.
|
2020-03-30 23:58:32 +03:00
|
|
|
// source: registry/service/proto/registry.proto
|
2019-09-09 08:57:57 -07:00
|
|
|
|
|
|
|
package go_micro_registry
|
|
|
|
|
|
|
|
import (
|
|
|
|
fmt "fmt"
|
|
|
|
proto "github.com/golang/protobuf/proto"
|
|
|
|
math "math"
|
|
|
|
)
|
|
|
|
|
|
|
|
import (
|
|
|
|
context "context"
|
2020-01-30 14:39:00 +03:00
|
|
|
client "github.com/micro/go-micro/v2/client"
|
|
|
|
server "github.com/micro/go-micro/v2/server"
|
2019-09-09 08:57:57 -07:00
|
|
|
)
|
|
|
|
|
|
|
|
// Reference imports to suppress errors if they are not otherwise used.
|
|
|
|
var _ = proto.Marshal
|
|
|
|
var _ = fmt.Errorf
|
|
|
|
var _ = math.Inf
|
|
|
|
|
|
|
|
// This is a compile-time assertion to ensure that this generated file
|
|
|
|
// is compatible with the proto package it is being compiled against.
|
|
|
|
// A compilation error at this line likely means your copy of the
|
|
|
|
// proto package needs to be updated.
|
|
|
|
const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
|
|
|
|
|
|
|
|
// Reference imports to suppress errors if they are not otherwise used.
|
|
|
|
var _ context.Context
|
|
|
|
var _ client.Option
|
|
|
|
var _ server.Option
|
|
|
|
|
|
|
|
// Client API for Registry service
|
|
|
|
|
|
|
|
type RegistryService interface {
|
|
|
|
GetService(ctx context.Context, in *GetRequest, opts ...client.CallOption) (*GetResponse, error)
|
|
|
|
Register(ctx context.Context, in *Service, opts ...client.CallOption) (*EmptyResponse, error)
|
|
|
|
Deregister(ctx context.Context, in *Service, opts ...client.CallOption) (*EmptyResponse, error)
|
|
|
|
ListServices(ctx context.Context, in *ListRequest, opts ...client.CallOption) (*ListResponse, error)
|
|
|
|
Watch(ctx context.Context, in *WatchRequest, opts ...client.CallOption) (Registry_WatchService, error)
|
|
|
|
}
|
|
|
|
|
|
|
|
type registryService struct {
|
|
|
|
c client.Client
|
|
|
|
name string
|
|
|
|
}
|
|
|
|
|
|
|
|
func NewRegistryService(name string, c client.Client) RegistryService {
|
|
|
|
return ®istryService{
|
|
|
|
c: c,
|
|
|
|
name: name,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func (c *registryService) GetService(ctx context.Context, in *GetRequest, opts ...client.CallOption) (*GetResponse, error) {
|
|
|
|
req := c.c.NewRequest(c.name, "Registry.GetService", in)
|
|
|
|
out := new(GetResponse)
|
|
|
|
err := c.c.Call(ctx, req, out, opts...)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
return out, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (c *registryService) Register(ctx context.Context, in *Service, opts ...client.CallOption) (*EmptyResponse, error) {
|
|
|
|
req := c.c.NewRequest(c.name, "Registry.Register", in)
|
|
|
|
out := new(EmptyResponse)
|
|
|
|
err := c.c.Call(ctx, req, out, opts...)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
return out, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (c *registryService) Deregister(ctx context.Context, in *Service, opts ...client.CallOption) (*EmptyResponse, error) {
|
|
|
|
req := c.c.NewRequest(c.name, "Registry.Deregister", in)
|
|
|
|
out := new(EmptyResponse)
|
|
|
|
err := c.c.Call(ctx, req, out, opts...)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
return out, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (c *registryService) ListServices(ctx context.Context, in *ListRequest, opts ...client.CallOption) (*ListResponse, error) {
|
|
|
|
req := c.c.NewRequest(c.name, "Registry.ListServices", in)
|
|
|
|
out := new(ListResponse)
|
|
|
|
err := c.c.Call(ctx, req, out, opts...)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
return out, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (c *registryService) Watch(ctx context.Context, in *WatchRequest, opts ...client.CallOption) (Registry_WatchService, error) {
|
|
|
|
req := c.c.NewRequest(c.name, "Registry.Watch", &WatchRequest{})
|
|
|
|
stream, err := c.c.Stream(ctx, req, opts...)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
if err := stream.Send(in); err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
return ®istryServiceWatch{stream}, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
type Registry_WatchService interface {
|
2020-03-30 23:58:32 +03:00
|
|
|
Context() context.Context
|
2019-09-09 08:57:57 -07:00
|
|
|
SendMsg(interface{}) error
|
|
|
|
RecvMsg(interface{}) error
|
|
|
|
Close() error
|
|
|
|
Recv() (*Result, error)
|
|
|
|
}
|
|
|
|
|
|
|
|
type registryServiceWatch struct {
|
|
|
|
stream client.Stream
|
|
|
|
}
|
|
|
|
|
|
|
|
func (x *registryServiceWatch) Close() error {
|
|
|
|
return x.stream.Close()
|
|
|
|
}
|
|
|
|
|
2020-03-30 23:58:32 +03:00
|
|
|
func (x *registryServiceWatch) Context() context.Context {
|
|
|
|
return x.stream.Context()
|
|
|
|
}
|
|
|
|
|
2019-09-09 08:57:57 -07:00
|
|
|
func (x *registryServiceWatch) SendMsg(m interface{}) error {
|
|
|
|
return x.stream.Send(m)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (x *registryServiceWatch) RecvMsg(m interface{}) error {
|
|
|
|
return x.stream.Recv(m)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (x *registryServiceWatch) Recv() (*Result, error) {
|
|
|
|
m := new(Result)
|
|
|
|
err := x.stream.Recv(m)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
return m, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
// Server API for Registry service
|
|
|
|
|
|
|
|
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
|
|
|
|
}
|
|
|
|
|
|
|
|
func RegisterRegistryHandler(s server.Server, hdlr RegistryHandler, opts ...server.HandlerOption) error {
|
|
|
|
type registry interface {
|
|
|
|
GetService(ctx context.Context, in *GetRequest, out *GetResponse) error
|
|
|
|
Register(ctx context.Context, in *Service, out *EmptyResponse) error
|
|
|
|
Deregister(ctx context.Context, in *Service, out *EmptyResponse) error
|
|
|
|
ListServices(ctx context.Context, in *ListRequest, out *ListResponse) error
|
|
|
|
Watch(ctx context.Context, stream server.Stream) error
|
|
|
|
}
|
|
|
|
type Registry struct {
|
|
|
|
registry
|
|
|
|
}
|
|
|
|
h := ®istryHandler{hdlr}
|
|
|
|
return s.Handle(s.NewHandler(&Registry{h}, opts...))
|
|
|
|
}
|
|
|
|
|
|
|
|
type registryHandler struct {
|
|
|
|
RegistryHandler
|
|
|
|
}
|
|
|
|
|
|
|
|
func (h *registryHandler) GetService(ctx context.Context, in *GetRequest, out *GetResponse) error {
|
|
|
|
return h.RegistryHandler.GetService(ctx, in, out)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (h *registryHandler) Register(ctx context.Context, in *Service, out *EmptyResponse) error {
|
|
|
|
return h.RegistryHandler.Register(ctx, in, out)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (h *registryHandler) Deregister(ctx context.Context, in *Service, out *EmptyResponse) error {
|
|
|
|
return h.RegistryHandler.Deregister(ctx, in, out)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (h *registryHandler) ListServices(ctx context.Context, in *ListRequest, out *ListResponse) error {
|
|
|
|
return h.RegistryHandler.ListServices(ctx, in, out)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (h *registryHandler) Watch(ctx context.Context, stream server.Stream) error {
|
|
|
|
m := new(WatchRequest)
|
|
|
|
if err := stream.Recv(m); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
return h.RegistryHandler.Watch(ctx, m, ®istryWatchStream{stream})
|
|
|
|
}
|
|
|
|
|
|
|
|
type Registry_WatchStream interface {
|
2020-03-30 23:58:32 +03:00
|
|
|
Context() context.Context
|
2019-09-09 08:57:57 -07:00
|
|
|
SendMsg(interface{}) error
|
|
|
|
RecvMsg(interface{}) error
|
|
|
|
Close() error
|
|
|
|
Send(*Result) error
|
|
|
|
}
|
|
|
|
|
|
|
|
type registryWatchStream struct {
|
|
|
|
stream server.Stream
|
|
|
|
}
|
|
|
|
|
|
|
|
func (x *registryWatchStream) Close() error {
|
|
|
|
return x.stream.Close()
|
|
|
|
}
|
|
|
|
|
2020-03-30 23:58:32 +03:00
|
|
|
func (x *registryWatchStream) Context() context.Context {
|
|
|
|
return x.stream.Context()
|
|
|
|
}
|
|
|
|
|
2019-09-09 08:57:57 -07:00
|
|
|
func (x *registryWatchStream) SendMsg(m interface{}) error {
|
|
|
|
return x.stream.Send(m)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (x *registryWatchStream) RecvMsg(m interface{}) error {
|
|
|
|
return x.stream.Recv(m)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (x *registryWatchStream) Send(m *Result) error {
|
|
|
|
return x.stream.Send(m)
|
|
|
|
}
|