2020-01-16 19:10:15 +03:00
|
|
|
// Code generated by protoc-gen-micro. DO NOT EDIT.
|
2020-03-12 01:31:24 +03:00
|
|
|
// source: github.com/micro/go-micro/config/source/service/proto/service.proto
|
2020-01-16 19:10:15 +03:00
|
|
|
|
2020-01-18 18:16:23 +03:00
|
|
|
package service
|
2020-01-16 19:10:15 +03:00
|
|
|
|
|
|
|
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"
|
2020-01-16 19:10:15 +03: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
|
|
|
|
|
2020-01-23 14:37:54 +03:00
|
|
|
// Client API for Config service
|
2020-01-16 19:10:15 +03:00
|
|
|
|
2020-01-23 14:37:54 +03:00
|
|
|
type ConfigService interface {
|
2020-01-16 19:10:15 +03:00
|
|
|
Create(ctx context.Context, in *CreateRequest, opts ...client.CallOption) (*CreateResponse, error)
|
|
|
|
Update(ctx context.Context, in *UpdateRequest, opts ...client.CallOption) (*UpdateResponse, error)
|
|
|
|
Delete(ctx context.Context, in *DeleteRequest, opts ...client.CallOption) (*DeleteResponse, error)
|
|
|
|
List(ctx context.Context, in *ListRequest, opts ...client.CallOption) (*ListResponse, error)
|
|
|
|
Read(ctx context.Context, in *ReadRequest, opts ...client.CallOption) (*ReadResponse, error)
|
2020-01-23 14:37:54 +03:00
|
|
|
Watch(ctx context.Context, in *WatchRequest, opts ...client.CallOption) (Config_WatchService, error)
|
2020-01-16 19:10:15 +03:00
|
|
|
}
|
|
|
|
|
2020-01-23 14:37:54 +03:00
|
|
|
type configService struct {
|
2020-01-16 19:10:15 +03:00
|
|
|
c client.Client
|
|
|
|
name string
|
|
|
|
}
|
|
|
|
|
2020-01-23 14:37:54 +03:00
|
|
|
func NewConfigService(name string, c client.Client) ConfigService {
|
|
|
|
return &configService{
|
2020-01-16 19:10:15 +03:00
|
|
|
c: c,
|
|
|
|
name: name,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-01-23 14:37:54 +03:00
|
|
|
func (c *configService) Create(ctx context.Context, in *CreateRequest, opts ...client.CallOption) (*CreateResponse, error) {
|
|
|
|
req := c.c.NewRequest(c.name, "Config.Create", in)
|
2020-01-16 19:10:15 +03:00
|
|
|
out := new(CreateResponse)
|
|
|
|
err := c.c.Call(ctx, req, out, opts...)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
return out, nil
|
|
|
|
}
|
|
|
|
|
2020-01-23 14:37:54 +03:00
|
|
|
func (c *configService) Update(ctx context.Context, in *UpdateRequest, opts ...client.CallOption) (*UpdateResponse, error) {
|
|
|
|
req := c.c.NewRequest(c.name, "Config.Update", in)
|
2020-01-16 19:10:15 +03:00
|
|
|
out := new(UpdateResponse)
|
|
|
|
err := c.c.Call(ctx, req, out, opts...)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
return out, nil
|
|
|
|
}
|
|
|
|
|
2020-01-23 14:37:54 +03:00
|
|
|
func (c *configService) Delete(ctx context.Context, in *DeleteRequest, opts ...client.CallOption) (*DeleteResponse, error) {
|
|
|
|
req := c.c.NewRequest(c.name, "Config.Delete", in)
|
2020-01-16 19:10:15 +03:00
|
|
|
out := new(DeleteResponse)
|
|
|
|
err := c.c.Call(ctx, req, out, opts...)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
return out, nil
|
|
|
|
}
|
|
|
|
|
2020-01-23 14:37:54 +03:00
|
|
|
func (c *configService) List(ctx context.Context, in *ListRequest, opts ...client.CallOption) (*ListResponse, error) {
|
|
|
|
req := c.c.NewRequest(c.name, "Config.List", in)
|
2020-01-16 19:10:15 +03:00
|
|
|
out := new(ListResponse)
|
|
|
|
err := c.c.Call(ctx, req, out, opts...)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
return out, nil
|
|
|
|
}
|
|
|
|
|
2020-01-23 14:37:54 +03:00
|
|
|
func (c *configService) Read(ctx context.Context, in *ReadRequest, opts ...client.CallOption) (*ReadResponse, error) {
|
|
|
|
req := c.c.NewRequest(c.name, "Config.Read", in)
|
2020-01-16 19:10:15 +03:00
|
|
|
out := new(ReadResponse)
|
|
|
|
err := c.c.Call(ctx, req, out, opts...)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
return out, nil
|
|
|
|
}
|
|
|
|
|
2020-01-23 14:37:54 +03:00
|
|
|
func (c *configService) Watch(ctx context.Context, in *WatchRequest, opts ...client.CallOption) (Config_WatchService, error) {
|
|
|
|
req := c.c.NewRequest(c.name, "Config.Watch", &WatchRequest{})
|
2020-01-16 19:10:15 +03:00
|
|
|
stream, err := c.c.Stream(ctx, req, opts...)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
if err := stream.Send(in); err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
2020-01-23 14:37:54 +03:00
|
|
|
return &configServiceWatch{stream}, nil
|
2020-01-16 19:10:15 +03:00
|
|
|
}
|
|
|
|
|
2020-01-23 14:37:54 +03:00
|
|
|
type Config_WatchService interface {
|
2020-03-12 01:31:24 +03:00
|
|
|
Context() context.Context
|
2020-01-16 19:10:15 +03:00
|
|
|
SendMsg(interface{}) error
|
|
|
|
RecvMsg(interface{}) error
|
|
|
|
Close() error
|
|
|
|
Recv() (*WatchResponse, error)
|
|
|
|
}
|
|
|
|
|
2020-01-23 14:37:54 +03:00
|
|
|
type configServiceWatch struct {
|
2020-01-16 19:10:15 +03:00
|
|
|
stream client.Stream
|
|
|
|
}
|
|
|
|
|
2020-01-23 14:37:54 +03:00
|
|
|
func (x *configServiceWatch) Close() error {
|
2020-01-16 19:10:15 +03:00
|
|
|
return x.stream.Close()
|
|
|
|
}
|
|
|
|
|
2020-03-12 01:31:24 +03:00
|
|
|
func (x *configServiceWatch) Context() context.Context {
|
|
|
|
return x.stream.Context()
|
|
|
|
}
|
|
|
|
|
2020-01-23 14:37:54 +03:00
|
|
|
func (x *configServiceWatch) SendMsg(m interface{}) error {
|
2020-01-16 19:10:15 +03:00
|
|
|
return x.stream.Send(m)
|
|
|
|
}
|
|
|
|
|
2020-01-23 14:37:54 +03:00
|
|
|
func (x *configServiceWatch) RecvMsg(m interface{}) error {
|
2020-01-16 19:10:15 +03:00
|
|
|
return x.stream.Recv(m)
|
|
|
|
}
|
|
|
|
|
2020-01-23 14:37:54 +03:00
|
|
|
func (x *configServiceWatch) Recv() (*WatchResponse, error) {
|
2020-01-16 19:10:15 +03:00
|
|
|
m := new(WatchResponse)
|
|
|
|
err := x.stream.Recv(m)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
return m, nil
|
|
|
|
}
|
|
|
|
|
2020-01-23 14:37:54 +03:00
|
|
|
// Server API for Config service
|
2020-01-16 19:10:15 +03:00
|
|
|
|
2020-01-23 14:37:54 +03:00
|
|
|
type ConfigHandler interface {
|
2020-01-16 19:10:15 +03:00
|
|
|
Create(context.Context, *CreateRequest, *CreateResponse) error
|
|
|
|
Update(context.Context, *UpdateRequest, *UpdateResponse) error
|
|
|
|
Delete(context.Context, *DeleteRequest, *DeleteResponse) error
|
|
|
|
List(context.Context, *ListRequest, *ListResponse) error
|
|
|
|
Read(context.Context, *ReadRequest, *ReadResponse) error
|
2020-01-23 14:37:54 +03:00
|
|
|
Watch(context.Context, *WatchRequest, Config_WatchStream) error
|
2020-01-16 19:10:15 +03:00
|
|
|
}
|
|
|
|
|
2020-01-23 14:37:54 +03:00
|
|
|
func RegisterConfigHandler(s server.Server, hdlr ConfigHandler, opts ...server.HandlerOption) error {
|
|
|
|
type config interface {
|
2020-01-16 19:10:15 +03:00
|
|
|
Create(ctx context.Context, in *CreateRequest, out *CreateResponse) error
|
|
|
|
Update(ctx context.Context, in *UpdateRequest, out *UpdateResponse) error
|
|
|
|
Delete(ctx context.Context, in *DeleteRequest, out *DeleteResponse) error
|
|
|
|
List(ctx context.Context, in *ListRequest, out *ListResponse) error
|
|
|
|
Read(ctx context.Context, in *ReadRequest, out *ReadResponse) error
|
|
|
|
Watch(ctx context.Context, stream server.Stream) error
|
|
|
|
}
|
2020-01-23 14:37:54 +03:00
|
|
|
type Config struct {
|
|
|
|
config
|
2020-01-16 19:10:15 +03:00
|
|
|
}
|
2020-01-23 14:37:54 +03:00
|
|
|
h := &configHandler{hdlr}
|
|
|
|
return s.Handle(s.NewHandler(&Config{h}, opts...))
|
2020-01-16 19:10:15 +03:00
|
|
|
}
|
|
|
|
|
2020-01-23 14:37:54 +03:00
|
|
|
type configHandler struct {
|
|
|
|
ConfigHandler
|
2020-01-16 19:10:15 +03:00
|
|
|
}
|
|
|
|
|
2020-01-23 14:37:54 +03:00
|
|
|
func (h *configHandler) Create(ctx context.Context, in *CreateRequest, out *CreateResponse) error {
|
|
|
|
return h.ConfigHandler.Create(ctx, in, out)
|
2020-01-16 19:10:15 +03:00
|
|
|
}
|
|
|
|
|
2020-01-23 14:37:54 +03:00
|
|
|
func (h *configHandler) Update(ctx context.Context, in *UpdateRequest, out *UpdateResponse) error {
|
|
|
|
return h.ConfigHandler.Update(ctx, in, out)
|
2020-01-16 19:10:15 +03:00
|
|
|
}
|
|
|
|
|
2020-01-23 14:37:54 +03:00
|
|
|
func (h *configHandler) Delete(ctx context.Context, in *DeleteRequest, out *DeleteResponse) error {
|
|
|
|
return h.ConfigHandler.Delete(ctx, in, out)
|
2020-01-16 19:10:15 +03:00
|
|
|
}
|
|
|
|
|
2020-01-23 14:37:54 +03:00
|
|
|
func (h *configHandler) List(ctx context.Context, in *ListRequest, out *ListResponse) error {
|
|
|
|
return h.ConfigHandler.List(ctx, in, out)
|
2020-01-16 19:10:15 +03:00
|
|
|
}
|
|
|
|
|
2020-01-23 14:37:54 +03:00
|
|
|
func (h *configHandler) Read(ctx context.Context, in *ReadRequest, out *ReadResponse) error {
|
|
|
|
return h.ConfigHandler.Read(ctx, in, out)
|
2020-01-16 19:10:15 +03:00
|
|
|
}
|
|
|
|
|
2020-01-23 14:37:54 +03:00
|
|
|
func (h *configHandler) Watch(ctx context.Context, stream server.Stream) error {
|
2020-01-16 19:10:15 +03:00
|
|
|
m := new(WatchRequest)
|
|
|
|
if err := stream.Recv(m); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
2020-01-23 14:37:54 +03:00
|
|
|
return h.ConfigHandler.Watch(ctx, m, &configWatchStream{stream})
|
2020-01-16 19:10:15 +03:00
|
|
|
}
|
|
|
|
|
2020-01-23 14:37:54 +03:00
|
|
|
type Config_WatchStream interface {
|
2020-03-12 01:31:24 +03:00
|
|
|
Context() context.Context
|
2020-01-16 19:10:15 +03:00
|
|
|
SendMsg(interface{}) error
|
|
|
|
RecvMsg(interface{}) error
|
|
|
|
Close() error
|
|
|
|
Send(*WatchResponse) error
|
|
|
|
}
|
|
|
|
|
2020-01-23 14:37:54 +03:00
|
|
|
type configWatchStream struct {
|
2020-01-16 19:10:15 +03:00
|
|
|
stream server.Stream
|
|
|
|
}
|
|
|
|
|
2020-01-23 14:37:54 +03:00
|
|
|
func (x *configWatchStream) Close() error {
|
2020-01-16 19:10:15 +03:00
|
|
|
return x.stream.Close()
|
|
|
|
}
|
|
|
|
|
2020-03-12 01:31:24 +03:00
|
|
|
func (x *configWatchStream) Context() context.Context {
|
|
|
|
return x.stream.Context()
|
|
|
|
}
|
|
|
|
|
2020-01-23 14:37:54 +03:00
|
|
|
func (x *configWatchStream) SendMsg(m interface{}) error {
|
2020-01-16 19:10:15 +03:00
|
|
|
return x.stream.Send(m)
|
|
|
|
}
|
|
|
|
|
2020-01-23 14:37:54 +03:00
|
|
|
func (x *configWatchStream) RecvMsg(m interface{}) error {
|
2020-01-16 19:10:15 +03:00
|
|
|
return x.stream.Recv(m)
|
|
|
|
}
|
|
|
|
|
2020-01-23 14:37:54 +03:00
|
|
|
func (x *configWatchStream) Send(m *WatchResponse) error {
|
2020-01-16 19:10:15 +03:00
|
|
|
return x.stream.Send(m)
|
|
|
|
}
|