Update proto Service => Config

This commit is contained in:
Asim Aslam 2020-01-23 11:37:54 +00:00
parent 6d636b7ab3
commit 1c19678d04
5 changed files with 117 additions and 114 deletions

View File

@ -1,5 +1,5 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// source: proto/service.proto
// source: go-micro/config/source/service/proto/service.proto
package service
@ -35,7 +35,7 @@ func (m *ChangeSet) Reset() { *m = ChangeSet{} }
func (m *ChangeSet) String() string { return proto.CompactTextString(m) }
func (*ChangeSet) ProtoMessage() {}
func (*ChangeSet) Descriptor() ([]byte, []int) {
return fileDescriptor_c33392ef2c1961ba, []int{0}
return fileDescriptor_05971a9aaecb0484, []int{0}
}
func (m *ChangeSet) XXX_Unmarshal(b []byte) error {
@ -104,7 +104,7 @@ func (m *Change) Reset() { *m = Change{} }
func (m *Change) String() string { return proto.CompactTextString(m) }
func (*Change) ProtoMessage() {}
func (*Change) Descriptor() ([]byte, []int) {
return fileDescriptor_c33392ef2c1961ba, []int{1}
return fileDescriptor_05971a9aaecb0484, []int{1}
}
func (m *Change) XXX_Unmarshal(b []byte) error {
@ -157,7 +157,7 @@ func (m *CreateRequest) Reset() { *m = CreateRequest{} }
func (m *CreateRequest) String() string { return proto.CompactTextString(m) }
func (*CreateRequest) ProtoMessage() {}
func (*CreateRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_c33392ef2c1961ba, []int{2}
return fileDescriptor_05971a9aaecb0484, []int{2}
}
func (m *CreateRequest) XXX_Unmarshal(b []byte) error {
@ -195,7 +195,7 @@ func (m *CreateResponse) Reset() { *m = CreateResponse{} }
func (m *CreateResponse) String() string { return proto.CompactTextString(m) }
func (*CreateResponse) ProtoMessage() {}
func (*CreateResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_c33392ef2c1961ba, []int{3}
return fileDescriptor_05971a9aaecb0484, []int{3}
}
func (m *CreateResponse) XXX_Unmarshal(b []byte) error {
@ -227,7 +227,7 @@ func (m *UpdateRequest) Reset() { *m = UpdateRequest{} }
func (m *UpdateRequest) String() string { return proto.CompactTextString(m) }
func (*UpdateRequest) ProtoMessage() {}
func (*UpdateRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_c33392ef2c1961ba, []int{4}
return fileDescriptor_05971a9aaecb0484, []int{4}
}
func (m *UpdateRequest) XXX_Unmarshal(b []byte) error {
@ -265,7 +265,7 @@ func (m *UpdateResponse) Reset() { *m = UpdateResponse{} }
func (m *UpdateResponse) String() string { return proto.CompactTextString(m) }
func (*UpdateResponse) ProtoMessage() {}
func (*UpdateResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_c33392ef2c1961ba, []int{5}
return fileDescriptor_05971a9aaecb0484, []int{5}
}
func (m *UpdateResponse) XXX_Unmarshal(b []byte) error {
@ -297,7 +297,7 @@ func (m *DeleteRequest) Reset() { *m = DeleteRequest{} }
func (m *DeleteRequest) String() string { return proto.CompactTextString(m) }
func (*DeleteRequest) ProtoMessage() {}
func (*DeleteRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_c33392ef2c1961ba, []int{6}
return fileDescriptor_05971a9aaecb0484, []int{6}
}
func (m *DeleteRequest) XXX_Unmarshal(b []byte) error {
@ -335,7 +335,7 @@ func (m *DeleteResponse) Reset() { *m = DeleteResponse{} }
func (m *DeleteResponse) String() string { return proto.CompactTextString(m) }
func (*DeleteResponse) ProtoMessage() {}
func (*DeleteResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_c33392ef2c1961ba, []int{7}
return fileDescriptor_05971a9aaecb0484, []int{7}
}
func (m *DeleteResponse) XXX_Unmarshal(b []byte) error {
@ -366,7 +366,7 @@ func (m *ListRequest) Reset() { *m = ListRequest{} }
func (m *ListRequest) String() string { return proto.CompactTextString(m) }
func (*ListRequest) ProtoMessage() {}
func (*ListRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_c33392ef2c1961ba, []int{8}
return fileDescriptor_05971a9aaecb0484, []int{8}
}
func (m *ListRequest) XXX_Unmarshal(b []byte) error {
@ -398,7 +398,7 @@ func (m *ListResponse) Reset() { *m = ListResponse{} }
func (m *ListResponse) String() string { return proto.CompactTextString(m) }
func (*ListResponse) ProtoMessage() {}
func (*ListResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_c33392ef2c1961ba, []int{9}
return fileDescriptor_05971a9aaecb0484, []int{9}
}
func (m *ListResponse) XXX_Unmarshal(b []byte) error {
@ -438,7 +438,7 @@ func (m *ReadRequest) Reset() { *m = ReadRequest{} }
func (m *ReadRequest) String() string { return proto.CompactTextString(m) }
func (*ReadRequest) ProtoMessage() {}
func (*ReadRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_c33392ef2c1961ba, []int{10}
return fileDescriptor_05971a9aaecb0484, []int{10}
}
func (m *ReadRequest) XXX_Unmarshal(b []byte) error {
@ -484,7 +484,7 @@ func (m *ReadResponse) Reset() { *m = ReadResponse{} }
func (m *ReadResponse) String() string { return proto.CompactTextString(m) }
func (*ReadResponse) ProtoMessage() {}
func (*ReadResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_c33392ef2c1961ba, []int{11}
return fileDescriptor_05971a9aaecb0484, []int{11}
}
func (m *ReadResponse) XXX_Unmarshal(b []byte) error {
@ -524,7 +524,7 @@ func (m *WatchRequest) Reset() { *m = WatchRequest{} }
func (m *WatchRequest) String() string { return proto.CompactTextString(m) }
func (*WatchRequest) ProtoMessage() {}
func (*WatchRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_c33392ef2c1961ba, []int{12}
return fileDescriptor_05971a9aaecb0484, []int{12}
}
func (m *WatchRequest) XXX_Unmarshal(b []byte) error {
@ -571,7 +571,7 @@ func (m *WatchResponse) Reset() { *m = WatchResponse{} }
func (m *WatchResponse) String() string { return proto.CompactTextString(m) }
func (*WatchResponse) ProtoMessage() {}
func (*WatchResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_c33392ef2c1961ba, []int{13}
return fileDescriptor_05971a9aaecb0484, []int{13}
}
func (m *WatchResponse) XXX_Unmarshal(b []byte) error {
@ -623,35 +623,38 @@ func init() {
proto.RegisterType((*WatchResponse)(nil), "WatchResponse")
}
func init() { proto.RegisterFile("proto/service.proto", fileDescriptor_c33392ef2c1961ba) }
var fileDescriptor_c33392ef2c1961ba = []byte{
// 427 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x93, 0xcf, 0x6a, 0xdb, 0x40,
0x10, 0xc6, 0x2d, 0xdb, 0x51, 0xaa, 0xb1, 0x24, 0x87, 0x29, 0x14, 0x21, 0x0a, 0x35, 0x0b, 0x05,
0xd3, 0xc2, 0x26, 0x38, 0x7d, 0x83, 0xf4, 0xd6, 0x9e, 0x36, 0x94, 0xf6, 0xba, 0x95, 0xa7, 0xb5,
0x49, 0x14, 0xa9, 0xda, 0x55, 0xa0, 0x8f, 0xd0, 0x3e, 0x75, 0xd9, 0x3f, 0x8a, 0x24, 0x17, 0x4c,
0x7c, 0xdb, 0x99, 0xd9, 0xf9, 0xe6, 0xd3, 0xfc, 0x56, 0xf0, 0xb2, 0x6e, 0x2a, 0x5d, 0x5d, 0x2a,
0x6a, 0x1e, 0xf7, 0x05, 0x71, 0x1b, 0xb1, 0x3f, 0x01, 0x44, 0x37, 0x3b, 0xf9, 0xf0, 0x93, 0x6e,
0x49, 0x23, 0xc2, 0x7c, 0x2b, 0xb5, 0xcc, 0x82, 0x55, 0xb0, 0x8e, 0x85, 0x3d, 0x63, 0x0e, 0x2f,
0x8a, 0x1d, 0x15, 0x77, 0xaa, 0x2d, 0xb3, 0xe9, 0x2a, 0x58, 0x47, 0xe2, 0x29, 0xc6, 0x57, 0x10,
0xfe, 0xa8, 0x9a, 0x52, 0xea, 0x6c, 0x66, 0x2b, 0x3e, 0x32, 0x79, 0x55, 0xb5, 0x4d, 0x41, 0xd9,
0xdc, 0xe5, 0x5d, 0x84, 0xaf, 0x21, 0xd2, 0xfb, 0x92, 0x94, 0x96, 0x65, 0x9d, 0x9d, 0xad, 0x82,
0xf5, 0x4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, 0x84, 0x3c, 0x5f, 0xf2, 0x03, 0xa0,
0xf6, 0xb2, 0x03, 0x84, 0x29, 0x1f, 0xb1, 0xcd, 0x97, 0xfc, 0x80, 0xdc, 0x04, 0xdf, 0xc2, 0xdc,
0xc0, 0xc2, 0x98, 0x0f, 0x10, 0xe6, 0x09, 0x1f, 0x12, 0x74, 0xd7, 0xcc, 0xb6, 0x31, 0xe6, 0x03,
0x52, 0x79, 0xc2, 0x87, 0x08, 0xd8, 0x04, 0xdf, 0xc1, 0x99, 0xdd, 0x16, 0x26, 0x7c, 0xb8, 0xeb,
0x3c, 0xe5, 0xa3, 0x25, 0xb2, 0xc9, 0x55, 0xf0, 0x3d, 0xb4, 0xbf, 0xfb, 0xf5, 0xbf, 0x00, 0x00,
0x00, 0xff, 0xff, 0xc3, 0x45, 0xac, 0x57, 0x05, 0x04, 0x00, 0x00,
func init() {
proto.RegisterFile("go-micro/config/source/service/proto/service.proto", fileDescriptor_05971a9aaecb0484)
}
var fileDescriptor_05971a9aaecb0484 = []byte{
// 443 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x93, 0xcf, 0x6a, 0xdb, 0x40,
0x10, 0xc6, 0x2d, 0xdb, 0x51, 0xab, 0xb1, 0x24, 0x87, 0x39, 0x14, 0x21, 0x0a, 0x35, 0x82, 0x82,
0x69, 0xe9, 0x2a, 0x38, 0x7d, 0x03, 0xf7, 0xd6, 0x9e, 0x54, 0x4a, 0x7b, 0xdd, 0xca, 0x13, 0x5b,
0x24, 0xf2, 0xaa, 0xda, 0x75, 0xa0, 0x8f, 0x90, 0xb7, 0x2e, 0xfb, 0x47, 0xb1, 0xe4, 0x82, 0x89,
0x6f, 0x3b, 0x33, 0x3b, 0xdf, 0x7c, 0x9a, 0x9f, 0x16, 0x56, 0x5b, 0xf1, 0xa9, 0xae, 0xca, 0x56,
0xe4, 0xa5, 0xd8, 0xdf, 0x55, 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0e, 0xa7, 0x11, 0xc1, 0xec,
0x5b, 0x25, 0x95, 0x53, 0xc8, 0x72, 0x08, 0x6d, 0x68, 0xcb, 0x5a, 0xf1, 0x91, 0x3f, 0x1c, 0x48,
0x26, 0xde, 0x62, 0x32, 0x50, 0xb4, 0xe9, 0xec, 0x16, 0x66, 0x05, 0xf1, 0x4d, 0xe7, 0xe0, 0x45,
0xab, 0xd6, 0x53, 0x6c, 0xd3, 0x71, 0xca, 0x79, 0xdf, 0x9f, 0x21, 0xfc, 0xc9, 0x55, 0xb9, 0xbb,
0x6c, 0xcc, 0x57, 0x88, 0x5c, 0x97, 0x9b, 0xf3, 0x7f, 0xdb, 0x00, 0xfa, 0xf8, 0x0c, 0xf4, 0xd5,
0xd3, 0x18, 0xfc, 0xb5, 0x79, 0x08, 0xf8, 0x11, 0x7c, 0x4b, 0x13, 0x63, 0x36, 0xf8, 0x11, 0xd2,
0x39, 0x3b, 0xc1, 0x3c, 0xd2, 0x97, 0x2d, 0x36, 0x8c, 0xd9, 0x80, 0x78, 0x3a, 0x67, 0x27, 0x3c,
0xcd, 0x65, 0xcb, 0x07, 0x63, 0x36, 0x40, 0x9b, 0xce, 0xd9, 0x09, 0xb8, 0x11, 0xbe, 0x87, 0xa9,
0x66, 0x85, 0x21, 0xeb, 0x11, 0x4c, 0x23, 0xd6, 0x07, 0x68, 0xaf, 0xe9, 0x65, 0x63, 0xc8, 0x7a,
0xa0, 0xd2, 0x88, 0xf5, 0x09, 0x64, 0x23, 0xfc, 0x00, 0x57, 0x66, 0x59, 0x18, 0xb1, 0xfe, 0xaa,
0xd3, 0x98, 0x0d, 0x76, 0x98, 0x8d, 0x6e, 0xbc, 0xdf, 0xbe, 0x79, 0xed, 0xb7, 0xff, 0x02, 0x00,
0x00, 0xff, 0xff, 0xea, 0xa0, 0x1e, 0x8e, 0x23, 0x04, 0x00, 0x00,
}

View File

@ -1,5 +1,5 @@
// Code generated by protoc-gen-micro. DO NOT EDIT.
// source: proto/service.proto
// source: go-micro/config/source/service/proto/service.proto
package service
@ -31,37 +31,37 @@ var _ context.Context
var _ client.Option
var _ server.Option
// Client API for Service service
// Client API for Config service
type Service interface {
type ConfigService interface {
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)
Watch(ctx context.Context, in *WatchRequest, opts ...client.CallOption) (Service_WatchService, error)
Watch(ctx context.Context, in *WatchRequest, opts ...client.CallOption) (Config_WatchService, error)
}
type service struct {
type configService struct {
c client.Client
name string
}
func NewService(name string, c client.Client) Service {
func NewConfigService(name string, c client.Client) ConfigService {
if c == nil {
c = client.NewClient()
}
if len(name) == 0 {
name = "service"
name = "config"
}
return &service{
return &configService{
c: c,
name: name,
}
}
func (c *service) Create(ctx context.Context, in *CreateRequest, opts ...client.CallOption) (*CreateResponse, error) {
req := c.c.NewRequest(c.name, "Service.Create", in)
func (c *configService) Create(ctx context.Context, in *CreateRequest, opts ...client.CallOption) (*CreateResponse, error) {
req := c.c.NewRequest(c.name, "Config.Create", in)
out := new(CreateResponse)
err := c.c.Call(ctx, req, out, opts...)
if err != nil {
@ -70,8 +70,8 @@ func (c *service) Create(ctx context.Context, in *CreateRequest, opts ...client.
return out, nil
}
func (c *service) Update(ctx context.Context, in *UpdateRequest, opts ...client.CallOption) (*UpdateResponse, error) {
req := c.c.NewRequest(c.name, "Service.Update", in)
func (c *configService) Update(ctx context.Context, in *UpdateRequest, opts ...client.CallOption) (*UpdateResponse, error) {
req := c.c.NewRequest(c.name, "Config.Update", in)
out := new(UpdateResponse)
err := c.c.Call(ctx, req, out, opts...)
if err != nil {
@ -80,8 +80,8 @@ func (c *service) Update(ctx context.Context, in *UpdateRequest, opts ...client.
return out, nil
}
func (c *service) Delete(ctx context.Context, in *DeleteRequest, opts ...client.CallOption) (*DeleteResponse, error) {
req := c.c.NewRequest(c.name, "Service.Delete", in)
func (c *configService) Delete(ctx context.Context, in *DeleteRequest, opts ...client.CallOption) (*DeleteResponse, error) {
req := c.c.NewRequest(c.name, "Config.Delete", in)
out := new(DeleteResponse)
err := c.c.Call(ctx, req, out, opts...)
if err != nil {
@ -90,8 +90,8 @@ func (c *service) Delete(ctx context.Context, in *DeleteRequest, opts ...client.
return out, nil
}
func (c *service) List(ctx context.Context, in *ListRequest, opts ...client.CallOption) (*ListResponse, error) {
req := c.c.NewRequest(c.name, "Service.List", in)
func (c *configService) List(ctx context.Context, in *ListRequest, opts ...client.CallOption) (*ListResponse, error) {
req := c.c.NewRequest(c.name, "Config.List", in)
out := new(ListResponse)
err := c.c.Call(ctx, req, out, opts...)
if err != nil {
@ -100,8 +100,8 @@ func (c *service) List(ctx context.Context, in *ListRequest, opts ...client.Call
return out, nil
}
func (c *service) Read(ctx context.Context, in *ReadRequest, opts ...client.CallOption) (*ReadResponse, error) {
req := c.c.NewRequest(c.name, "Service.Read", in)
func (c *configService) Read(ctx context.Context, in *ReadRequest, opts ...client.CallOption) (*ReadResponse, error) {
req := c.c.NewRequest(c.name, "Config.Read", in)
out := new(ReadResponse)
err := c.c.Call(ctx, req, out, opts...)
if err != nil {
@ -110,8 +110,8 @@ func (c *service) Read(ctx context.Context, in *ReadRequest, opts ...client.Call
return out, nil
}
func (c *service) Watch(ctx context.Context, in *WatchRequest, opts ...client.CallOption) (Service_WatchService, error) {
req := c.c.NewRequest(c.name, "Service.Watch", &WatchRequest{})
func (c *configService) Watch(ctx context.Context, in *WatchRequest, opts ...client.CallOption) (Config_WatchService, error) {
req := c.c.NewRequest(c.name, "Config.Watch", &WatchRequest{})
stream, err := c.c.Stream(ctx, req, opts...)
if err != nil {
return nil, err
@ -119,33 +119,33 @@ func (c *service) Watch(ctx context.Context, in *WatchRequest, opts ...client.Ca
if err := stream.Send(in); err != nil {
return nil, err
}
return &serviceWatch{stream}, nil
return &configServiceWatch{stream}, nil
}
type Service_WatchService interface {
type Config_WatchService interface {
SendMsg(interface{}) error
RecvMsg(interface{}) error
Close() error
Recv() (*WatchResponse, error)
}
type serviceWatch struct {
type configServiceWatch struct {
stream client.Stream
}
func (x *serviceWatch) Close() error {
func (x *configServiceWatch) Close() error {
return x.stream.Close()
}
func (x *serviceWatch) SendMsg(m interface{}) error {
func (x *configServiceWatch) SendMsg(m interface{}) error {
return x.stream.Send(m)
}
func (x *serviceWatch) RecvMsg(m interface{}) error {
func (x *configServiceWatch) RecvMsg(m interface{}) error {
return x.stream.Recv(m)
}
func (x *serviceWatch) Recv() (*WatchResponse, error) {
func (x *configServiceWatch) Recv() (*WatchResponse, error) {
m := new(WatchResponse)
err := x.stream.Recv(m)
if err != nil {
@ -154,19 +154,19 @@ func (x *serviceWatch) Recv() (*WatchResponse, error) {
return m, nil
}
// Server API for Service service
// Server API for Config service
type ServiceHandler interface {
type ConfigHandler interface {
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
Watch(context.Context, *WatchRequest, Service_WatchStream) error
Watch(context.Context, *WatchRequest, Config_WatchStream) error
}
func RegisterServiceHandler(s server.Server, hdlr ServiceHandler, opts ...server.HandlerOption) error {
type service interface {
func RegisterConfigHandler(s server.Server, hdlr ConfigHandler, opts ...server.HandlerOption) error {
type config interface {
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
@ -174,68 +174,68 @@ func RegisterServiceHandler(s server.Server, hdlr ServiceHandler, opts ...server
Read(ctx context.Context, in *ReadRequest, out *ReadResponse) error
Watch(ctx context.Context, stream server.Stream) error
}
type Service struct {
service
type Config struct {
config
}
h := &serviceHandler{hdlr}
return s.Handle(s.NewHandler(&Service{h}, opts...))
h := &configHandler{hdlr}
return s.Handle(s.NewHandler(&Config{h}, opts...))
}
type serviceHandler struct {
ServiceHandler
type configHandler struct {
ConfigHandler
}
func (h *serviceHandler) Create(ctx context.Context, in *CreateRequest, out *CreateResponse) error {
return h.ServiceHandler.Create(ctx, in, out)
func (h *configHandler) Create(ctx context.Context, in *CreateRequest, out *CreateResponse) error {
return h.ConfigHandler.Create(ctx, in, out)
}
func (h *serviceHandler) Update(ctx context.Context, in *UpdateRequest, out *UpdateResponse) error {
return h.ServiceHandler.Update(ctx, in, out)
func (h *configHandler) Update(ctx context.Context, in *UpdateRequest, out *UpdateResponse) error {
return h.ConfigHandler.Update(ctx, in, out)
}
func (h *serviceHandler) Delete(ctx context.Context, in *DeleteRequest, out *DeleteResponse) error {
return h.ServiceHandler.Delete(ctx, in, out)
func (h *configHandler) Delete(ctx context.Context, in *DeleteRequest, out *DeleteResponse) error {
return h.ConfigHandler.Delete(ctx, in, out)
}
func (h *serviceHandler) List(ctx context.Context, in *ListRequest, out *ListResponse) error {
return h.ServiceHandler.List(ctx, in, out)
func (h *configHandler) List(ctx context.Context, in *ListRequest, out *ListResponse) error {
return h.ConfigHandler.List(ctx, in, out)
}
func (h *serviceHandler) Read(ctx context.Context, in *ReadRequest, out *ReadResponse) error {
return h.ServiceHandler.Read(ctx, in, out)
func (h *configHandler) Read(ctx context.Context, in *ReadRequest, out *ReadResponse) error {
return h.ConfigHandler.Read(ctx, in, out)
}
func (h *serviceHandler) Watch(ctx context.Context, stream server.Stream) error {
func (h *configHandler) Watch(ctx context.Context, stream server.Stream) error {
m := new(WatchRequest)
if err := stream.Recv(m); err != nil {
return err
}
return h.ServiceHandler.Watch(ctx, m, &serviceWatchStream{stream})
return h.ConfigHandler.Watch(ctx, m, &configWatchStream{stream})
}
type Service_WatchStream interface {
type Config_WatchStream interface {
SendMsg(interface{}) error
RecvMsg(interface{}) error
Close() error
Send(*WatchResponse) error
}
type serviceWatchStream struct {
type configWatchStream struct {
stream server.Stream
}
func (x *serviceWatchStream) Close() error {
func (x *configWatchStream) Close() error {
return x.stream.Close()
}
func (x *serviceWatchStream) SendMsg(m interface{}) error {
func (x *configWatchStream) SendMsg(m interface{}) error {
return x.stream.Send(m)
}
func (x *serviceWatchStream) RecvMsg(m interface{}) error {
func (x *configWatchStream) RecvMsg(m interface{}) error {
return x.stream.Recv(m)
}
func (x *serviceWatchStream) Send(m *WatchResponse) error {
func (x *configWatchStream) Send(m *WatchResponse) error {
return x.stream.Send(m)
}

View File

@ -1,6 +1,6 @@
syntax = "proto3";
service Service {
service Config {
rpc Create (CreateRequest) returns (CreateResponse) {}
rpc Update (UpdateRequest) returns (UpdateResponse) {}
rpc Delete (DeleteRequest) returns (DeleteResponse) {}

View File

@ -21,7 +21,7 @@ type service struct {
key string
path string
opts source.Options
client proto.Service
client proto.ConfigService
}
func (m *service) Read() (set *source.ChangeSet, err error) {
@ -83,7 +83,7 @@ func NewSource(opts ...source.Option) source.Source {
opts: options,
key: key,
path: path,
client: proto.NewService(addr, DefaultClient),
client: proto.NewConfigService(addr, DefaultClient),
}
return s

View File

@ -6,10 +6,10 @@ import (
)
type watcher struct {
stream proto.Service_WatchService
stream proto.Config_WatchService
}
func newWatcher(stream proto.Service_WatchService) (source.Watcher, error) {
func newWatcher(stream proto.Config_WatchService) (source.Watcher, error) {
return &watcher{stream: stream}, nil
}