Full router RPC coverage
This commit is contained in:
		| @@ -1,5 +1,5 @@ | ||||
| // Code generated by protoc-gen-micro. DO NOT EDIT. | ||||
| // source: go-micro/network/router/proto/router.proto | ||||
| // source: router.proto | ||||
|  | ||||
| package go_micro_router | ||||
|  | ||||
| @@ -34,11 +34,14 @@ var _ server.Option | ||||
| // Client API for Router service | ||||
|  | ||||
| type RouterService interface { | ||||
| 	Watch(ctx context.Context, in *WatchRequest, opts ...client.CallOption) (Router_WatchService, error) | ||||
| 	Lookup(ctx context.Context, in *LookupRequest, opts ...client.CallOption) (*LookupResponse, error) | ||||
| 	List(ctx context.Context, in *ListRequest, opts ...client.CallOption) (*ListResponse, error) | ||||
| 	Lookup(ctx context.Context, in *LookupRequest, opts ...client.CallOption) (*LookupResponse, error) | ||||
| 	Watch(ctx context.Context, in *WatchRequest, opts ...client.CallOption) (Router_WatchService, error) | ||||
| 	Advertise(ctx context.Context, in *AdvertiseRequest, opts ...client.CallOption) (Router_AdvertiseService, error) | ||||
| 	Process(ctx context.Context, in *Advert, opts ...client.CallOption) (*ProcessResponse, error) | ||||
| 	Create(ctx context.Context, in *Route, opts ...client.CallOption) (*CreateResponse, error) | ||||
| 	Delete(ctx context.Context, in *Route, opts ...client.CallOption) (*DeleteResponse, error) | ||||
| 	Update(ctx context.Context, in *Route, opts ...client.CallOption) (*UpdateResponse, error) | ||||
| } | ||||
|  | ||||
| type routerService struct { | ||||
| @@ -59,6 +62,26 @@ func NewRouterService(name string, c client.Client) RouterService { | ||||
| 	} | ||||
| } | ||||
|  | ||||
| func (c *routerService) List(ctx context.Context, in *ListRequest, opts ...client.CallOption) (*ListResponse, error) { | ||||
| 	req := c.c.NewRequest(c.name, "Router.List", in) | ||||
| 	out := new(ListResponse) | ||||
| 	err := c.c.Call(ctx, req, out, opts...) | ||||
| 	if err != nil { | ||||
| 		return nil, err | ||||
| 	} | ||||
| 	return out, nil | ||||
| } | ||||
|  | ||||
| func (c *routerService) Lookup(ctx context.Context, in *LookupRequest, opts ...client.CallOption) (*LookupResponse, error) { | ||||
| 	req := c.c.NewRequest(c.name, "Router.Lookup", in) | ||||
| 	out := new(LookupResponse) | ||||
| 	err := c.c.Call(ctx, req, out, opts...) | ||||
| 	if err != nil { | ||||
| 		return nil, err | ||||
| 	} | ||||
| 	return out, nil | ||||
| } | ||||
|  | ||||
| func (c *routerService) Watch(ctx context.Context, in *WatchRequest, opts ...client.CallOption) (Router_WatchService, error) { | ||||
| 	req := c.c.NewRequest(c.name, "Router.Watch", &WatchRequest{}) | ||||
| 	stream, err := c.c.Stream(ctx, req, opts...) | ||||
| @@ -103,26 +126,6 @@ func (x *routerServiceWatch) Recv() (*Event, error) { | ||||
| 	return m, nil | ||||
| } | ||||
|  | ||||
| func (c *routerService) Lookup(ctx context.Context, in *LookupRequest, opts ...client.CallOption) (*LookupResponse, error) { | ||||
| 	req := c.c.NewRequest(c.name, "Router.Lookup", in) | ||||
| 	out := new(LookupResponse) | ||||
| 	err := c.c.Call(ctx, req, out, opts...) | ||||
| 	if err != nil { | ||||
| 		return nil, err | ||||
| 	} | ||||
| 	return out, nil | ||||
| } | ||||
|  | ||||
| func (c *routerService) List(ctx context.Context, in *ListRequest, opts ...client.CallOption) (*ListResponse, error) { | ||||
| 	req := c.c.NewRequest(c.name, "Router.List", in) | ||||
| 	out := new(ListResponse) | ||||
| 	err := c.c.Call(ctx, req, out, opts...) | ||||
| 	if err != nil { | ||||
| 		return nil, err | ||||
| 	} | ||||
| 	return out, nil | ||||
| } | ||||
|  | ||||
| func (c *routerService) Advertise(ctx context.Context, in *AdvertiseRequest, opts ...client.CallOption) (Router_AdvertiseService, error) { | ||||
| 	req := c.c.NewRequest(c.name, "Router.Advertise", &AdvertiseRequest{}) | ||||
| 	stream, err := c.c.Stream(ctx, req, opts...) | ||||
| @@ -177,23 +180,59 @@ func (c *routerService) Process(ctx context.Context, in *Advert, opts ...client. | ||||
| 	return out, nil | ||||
| } | ||||
|  | ||||
| func (c *routerService) Create(ctx context.Context, in *Route, opts ...client.CallOption) (*CreateResponse, error) { | ||||
| 	req := c.c.NewRequest(c.name, "Router.Create", in) | ||||
| 	out := new(CreateResponse) | ||||
| 	err := c.c.Call(ctx, req, out, opts...) | ||||
| 	if err != nil { | ||||
| 		return nil, err | ||||
| 	} | ||||
| 	return out, nil | ||||
| } | ||||
|  | ||||
| func (c *routerService) Delete(ctx context.Context, in *Route, opts ...client.CallOption) (*DeleteResponse, error) { | ||||
| 	req := c.c.NewRequest(c.name, "Router.Delete", in) | ||||
| 	out := new(DeleteResponse) | ||||
| 	err := c.c.Call(ctx, req, out, opts...) | ||||
| 	if err != nil { | ||||
| 		return nil, err | ||||
| 	} | ||||
| 	return out, nil | ||||
| } | ||||
|  | ||||
| func (c *routerService) Update(ctx context.Context, in *Route, opts ...client.CallOption) (*UpdateResponse, error) { | ||||
| 	req := c.c.NewRequest(c.name, "Router.Update", in) | ||||
| 	out := new(UpdateResponse) | ||||
| 	err := c.c.Call(ctx, req, out, opts...) | ||||
| 	if err != nil { | ||||
| 		return nil, err | ||||
| 	} | ||||
| 	return out, nil | ||||
| } | ||||
|  | ||||
| // Server API for Router service | ||||
|  | ||||
| type RouterHandler interface { | ||||
| 	Watch(context.Context, *WatchRequest, Router_WatchStream) error | ||||
| 	Lookup(context.Context, *LookupRequest, *LookupResponse) error | ||||
| 	List(context.Context, *ListRequest, *ListResponse) error | ||||
| 	Lookup(context.Context, *LookupRequest, *LookupResponse) error | ||||
| 	Watch(context.Context, *WatchRequest, Router_WatchStream) error | ||||
| 	Advertise(context.Context, *AdvertiseRequest, Router_AdvertiseStream) error | ||||
| 	Process(context.Context, *Advert, *ProcessResponse) error | ||||
| 	Create(context.Context, *Route, *CreateResponse) error | ||||
| 	Delete(context.Context, *Route, *DeleteResponse) error | ||||
| 	Update(context.Context, *Route, *UpdateResponse) error | ||||
| } | ||||
|  | ||||
| func RegisterRouterHandler(s server.Server, hdlr RouterHandler, opts ...server.HandlerOption) error { | ||||
| 	type router interface { | ||||
| 		Watch(ctx context.Context, stream server.Stream) error | ||||
| 		Lookup(ctx context.Context, in *LookupRequest, out *LookupResponse) error | ||||
| 		List(ctx context.Context, in *ListRequest, out *ListResponse) error | ||||
| 		Lookup(ctx context.Context, in *LookupRequest, out *LookupResponse) error | ||||
| 		Watch(ctx context.Context, stream server.Stream) error | ||||
| 		Advertise(ctx context.Context, stream server.Stream) error | ||||
| 		Process(ctx context.Context, in *Advert, out *ProcessResponse) error | ||||
| 		Create(ctx context.Context, in *Route, out *CreateResponse) error | ||||
| 		Delete(ctx context.Context, in *Route, out *DeleteResponse) error | ||||
| 		Update(ctx context.Context, in *Route, out *UpdateResponse) error | ||||
| 	} | ||||
| 	type Router struct { | ||||
| 		router | ||||
| @@ -206,6 +245,14 @@ type routerHandler struct { | ||||
| 	RouterHandler | ||||
| } | ||||
|  | ||||
| func (h *routerHandler) List(ctx context.Context, in *ListRequest, out *ListResponse) error { | ||||
| 	return h.RouterHandler.List(ctx, in, out) | ||||
| } | ||||
|  | ||||
| func (h *routerHandler) Lookup(ctx context.Context, in *LookupRequest, out *LookupResponse) error { | ||||
| 	return h.RouterHandler.Lookup(ctx, in, out) | ||||
| } | ||||
|  | ||||
| func (h *routerHandler) Watch(ctx context.Context, stream server.Stream) error { | ||||
| 	m := new(WatchRequest) | ||||
| 	if err := stream.Recv(m); err != nil { | ||||
| @@ -241,14 +288,6 @@ func (x *routerWatchStream) Send(m *Event) error { | ||||
| 	return x.stream.Send(m) | ||||
| } | ||||
|  | ||||
| func (h *routerHandler) Lookup(ctx context.Context, in *LookupRequest, out *LookupResponse) error { | ||||
| 	return h.RouterHandler.Lookup(ctx, in, out) | ||||
| } | ||||
|  | ||||
| func (h *routerHandler) List(ctx context.Context, in *ListRequest, out *ListResponse) error { | ||||
| 	return h.RouterHandler.List(ctx, in, out) | ||||
| } | ||||
|  | ||||
| func (h *routerHandler) Advertise(ctx context.Context, stream server.Stream) error { | ||||
| 	m := new(AdvertiseRequest) | ||||
| 	if err := stream.Recv(m); err != nil { | ||||
| @@ -287,3 +326,15 @@ func (x *routerAdvertiseStream) Send(m *Advert) error { | ||||
| func (h *routerHandler) Process(ctx context.Context, in *Advert, out *ProcessResponse) error { | ||||
| 	return h.RouterHandler.Process(ctx, in, out) | ||||
| } | ||||
|  | ||||
| func (h *routerHandler) Create(ctx context.Context, in *Route, out *CreateResponse) error { | ||||
| 	return h.RouterHandler.Create(ctx, in, out) | ||||
| } | ||||
|  | ||||
| func (h *routerHandler) Delete(ctx context.Context, in *Route, out *DeleteResponse) error { | ||||
| 	return h.RouterHandler.Delete(ctx, in, out) | ||||
| } | ||||
|  | ||||
| func (h *routerHandler) Update(ctx context.Context, in *Route, out *UpdateResponse) error { | ||||
| 	return h.RouterHandler.Update(ctx, in, out) | ||||
| } | ||||
|   | ||||
| @@ -1,13 +1,11 @@ | ||||
| // Code generated by protoc-gen-go. DO NOT EDIT. | ||||
| // source: go-micro/network/router/proto/router.proto | ||||
| // source: router.proto | ||||
|  | ||||
| package go_micro_router | ||||
|  | ||||
| import ( | ||||
| 	context "context" | ||||
| 	fmt "fmt" | ||||
| 	proto "github.com/golang/protobuf/proto" | ||||
| 	grpc "google.golang.org/grpc" | ||||
| 	math "math" | ||||
| ) | ||||
|  | ||||
| @@ -45,7 +43,7 @@ func (x AdvertType) String() string { | ||||
| } | ||||
|  | ||||
| func (AdvertType) EnumDescriptor() ([]byte, []int) { | ||||
| 	return fileDescriptor_fc08514fc6dadd29, []int{0} | ||||
| 	return fileDescriptor_367072455c71aedc, []int{0} | ||||
| } | ||||
|  | ||||
| // EventType defines the type of event | ||||
| @@ -74,7 +72,79 @@ func (x EventType) String() string { | ||||
| } | ||||
|  | ||||
| func (EventType) EnumDescriptor() ([]byte, []int) { | ||||
| 	return fileDescriptor_fc08514fc6dadd29, []int{1} | ||||
| 	return fileDescriptor_367072455c71aedc, []int{1} | ||||
| } | ||||
|  | ||||
| // ListRequest is made to List routes | ||||
| type ListRequest struct { | ||||
| 	XXX_NoUnkeyedLiteral struct{} `json:"-"` | ||||
| 	XXX_unrecognized     []byte   `json:"-"` | ||||
| 	XXX_sizecache        int32    `json:"-"` | ||||
| } | ||||
|  | ||||
| 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_367072455c71aedc, []int{0} | ||||
| } | ||||
|  | ||||
| func (m *ListRequest) XXX_Unmarshal(b []byte) error { | ||||
| 	return xxx_messageInfo_ListRequest.Unmarshal(m, b) | ||||
| } | ||||
| func (m *ListRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { | ||||
| 	return xxx_messageInfo_ListRequest.Marshal(b, m, deterministic) | ||||
| } | ||||
| func (m *ListRequest) XXX_Merge(src proto.Message) { | ||||
| 	xxx_messageInfo_ListRequest.Merge(m, src) | ||||
| } | ||||
| func (m *ListRequest) XXX_Size() int { | ||||
| 	return xxx_messageInfo_ListRequest.Size(m) | ||||
| } | ||||
| func (m *ListRequest) XXX_DiscardUnknown() { | ||||
| 	xxx_messageInfo_ListRequest.DiscardUnknown(m) | ||||
| } | ||||
|  | ||||
| var xxx_messageInfo_ListRequest proto.InternalMessageInfo | ||||
|  | ||||
| // ListResponse is returned by List | ||||
| type ListResponse struct { | ||||
| 	Routes               []*Route `protobuf:"bytes,1,rep,name=routes,proto3" json:"routes,omitempty"` | ||||
| 	XXX_NoUnkeyedLiteral struct{} `json:"-"` | ||||
| 	XXX_unrecognized     []byte   `json:"-"` | ||||
| 	XXX_sizecache        int32    `json:"-"` | ||||
| } | ||||
|  | ||||
| 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_367072455c71aedc, []int{1} | ||||
| } | ||||
|  | ||||
| func (m *ListResponse) XXX_Unmarshal(b []byte) error { | ||||
| 	return xxx_messageInfo_ListResponse.Unmarshal(m, b) | ||||
| } | ||||
| func (m *ListResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { | ||||
| 	return xxx_messageInfo_ListResponse.Marshal(b, m, deterministic) | ||||
| } | ||||
| func (m *ListResponse) XXX_Merge(src proto.Message) { | ||||
| 	xxx_messageInfo_ListResponse.Merge(m, src) | ||||
| } | ||||
| func (m *ListResponse) XXX_Size() int { | ||||
| 	return xxx_messageInfo_ListResponse.Size(m) | ||||
| } | ||||
| func (m *ListResponse) XXX_DiscardUnknown() { | ||||
| 	xxx_messageInfo_ListResponse.DiscardUnknown(m) | ||||
| } | ||||
|  | ||||
| var xxx_messageInfo_ListResponse proto.InternalMessageInfo | ||||
|  | ||||
| func (m *ListResponse) GetRoutes() []*Route { | ||||
| 	if m != nil { | ||||
| 		return m.Routes | ||||
| 	} | ||||
| 	return nil | ||||
| } | ||||
|  | ||||
| // LookupRequest is made to Lookup | ||||
| @@ -89,7 +159,7 @@ func (m *LookupRequest) Reset()         { *m = LookupRequest{} } | ||||
| func (m *LookupRequest) String() string { return proto.CompactTextString(m) } | ||||
| func (*LookupRequest) ProtoMessage()    {} | ||||
| func (*LookupRequest) Descriptor() ([]byte, []int) { | ||||
| 	return fileDescriptor_fc08514fc6dadd29, []int{0} | ||||
| 	return fileDescriptor_367072455c71aedc, []int{2} | ||||
| } | ||||
|  | ||||
| func (m *LookupRequest) XXX_Unmarshal(b []byte) error { | ||||
| @@ -129,7 +199,7 @@ func (m *LookupResponse) Reset()         { *m = LookupResponse{} } | ||||
| func (m *LookupResponse) String() string { return proto.CompactTextString(m) } | ||||
| func (*LookupResponse) ProtoMessage()    {} | ||||
| func (*LookupResponse) Descriptor() ([]byte, []int) { | ||||
| 	return fileDescriptor_fc08514fc6dadd29, []int{1} | ||||
| 	return fileDescriptor_367072455c71aedc, []int{3} | ||||
| } | ||||
|  | ||||
| func (m *LookupResponse) XXX_Unmarshal(b []byte) error { | ||||
| @@ -168,7 +238,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_fc08514fc6dadd29, []int{2} | ||||
| 	return fileDescriptor_367072455c71aedc, []int{4} | ||||
| } | ||||
|  | ||||
| func (m *WatchRequest) XXX_Unmarshal(b []byte) error { | ||||
| @@ -200,7 +270,7 @@ func (m *AdvertiseRequest) Reset()         { *m = AdvertiseRequest{} } | ||||
| func (m *AdvertiseRequest) String() string { return proto.CompactTextString(m) } | ||||
| func (*AdvertiseRequest) ProtoMessage()    {} | ||||
| func (*AdvertiseRequest) Descriptor() ([]byte, []int) { | ||||
| 	return fileDescriptor_fc08514fc6dadd29, []int{3} | ||||
| 	return fileDescriptor_367072455c71aedc, []int{5} | ||||
| } | ||||
|  | ||||
| func (m *AdvertiseRequest) XXX_Unmarshal(b []byte) error { | ||||
| @@ -242,7 +312,7 @@ func (m *Advert) Reset()         { *m = Advert{} } | ||||
| func (m *Advert) String() string { return proto.CompactTextString(m) } | ||||
| func (*Advert) ProtoMessage()    {} | ||||
| func (*Advert) Descriptor() ([]byte, []int) { | ||||
| 	return fileDescriptor_fc08514fc6dadd29, []int{4} | ||||
| 	return fileDescriptor_367072455c71aedc, []int{6} | ||||
| } | ||||
|  | ||||
| func (m *Advert) XXX_Unmarshal(b []byte) error { | ||||
| @@ -309,7 +379,7 @@ func (m *ProcessResponse) Reset()         { *m = ProcessResponse{} } | ||||
| func (m *ProcessResponse) String() string { return proto.CompactTextString(m) } | ||||
| func (*ProcessResponse) ProtoMessage()    {} | ||||
| func (*ProcessResponse) Descriptor() ([]byte, []int) { | ||||
| 	return fileDescriptor_fc08514fc6dadd29, []int{5} | ||||
| 	return fileDescriptor_367072455c71aedc, []int{7} | ||||
| } | ||||
|  | ||||
| func (m *ProcessResponse) XXX_Unmarshal(b []byte) error { | ||||
| @@ -330,6 +400,102 @@ func (m *ProcessResponse) XXX_DiscardUnknown() { | ||||
|  | ||||
| var xxx_messageInfo_ProcessResponse proto.InternalMessageInfo | ||||
|  | ||||
| // CreateResponse is returned by Create | ||||
| type CreateResponse struct { | ||||
| 	XXX_NoUnkeyedLiteral struct{} `json:"-"` | ||||
| 	XXX_unrecognized     []byte   `json:"-"` | ||||
| 	XXX_sizecache        int32    `json:"-"` | ||||
| } | ||||
|  | ||||
| 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_367072455c71aedc, []int{8} | ||||
| } | ||||
|  | ||||
| func (m *CreateResponse) XXX_Unmarshal(b []byte) error { | ||||
| 	return xxx_messageInfo_CreateResponse.Unmarshal(m, b) | ||||
| } | ||||
| func (m *CreateResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { | ||||
| 	return xxx_messageInfo_CreateResponse.Marshal(b, m, deterministic) | ||||
| } | ||||
| func (m *CreateResponse) XXX_Merge(src proto.Message) { | ||||
| 	xxx_messageInfo_CreateResponse.Merge(m, src) | ||||
| } | ||||
| func (m *CreateResponse) XXX_Size() int { | ||||
| 	return xxx_messageInfo_CreateResponse.Size(m) | ||||
| } | ||||
| func (m *CreateResponse) XXX_DiscardUnknown() { | ||||
| 	xxx_messageInfo_CreateResponse.DiscardUnknown(m) | ||||
| } | ||||
|  | ||||
| var xxx_messageInfo_CreateResponse proto.InternalMessageInfo | ||||
|  | ||||
| // DeleteResponse is returned by Delete | ||||
| type DeleteResponse struct { | ||||
| 	XXX_NoUnkeyedLiteral struct{} `json:"-"` | ||||
| 	XXX_unrecognized     []byte   `json:"-"` | ||||
| 	XXX_sizecache        int32    `json:"-"` | ||||
| } | ||||
|  | ||||
| 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_367072455c71aedc, []int{9} | ||||
| } | ||||
|  | ||||
| func (m *DeleteResponse) XXX_Unmarshal(b []byte) error { | ||||
| 	return xxx_messageInfo_DeleteResponse.Unmarshal(m, b) | ||||
| } | ||||
| func (m *DeleteResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { | ||||
| 	return xxx_messageInfo_DeleteResponse.Marshal(b, m, deterministic) | ||||
| } | ||||
| func (m *DeleteResponse) XXX_Merge(src proto.Message) { | ||||
| 	xxx_messageInfo_DeleteResponse.Merge(m, src) | ||||
| } | ||||
| func (m *DeleteResponse) XXX_Size() int { | ||||
| 	return xxx_messageInfo_DeleteResponse.Size(m) | ||||
| } | ||||
| func (m *DeleteResponse) XXX_DiscardUnknown() { | ||||
| 	xxx_messageInfo_DeleteResponse.DiscardUnknown(m) | ||||
| } | ||||
|  | ||||
| var xxx_messageInfo_DeleteResponse proto.InternalMessageInfo | ||||
|  | ||||
| // UpdateResponse is returned by Update | ||||
| type UpdateResponse struct { | ||||
| 	XXX_NoUnkeyedLiteral struct{} `json:"-"` | ||||
| 	XXX_unrecognized     []byte   `json:"-"` | ||||
| 	XXX_sizecache        int32    `json:"-"` | ||||
| } | ||||
|  | ||||
| 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_367072455c71aedc, []int{10} | ||||
| } | ||||
|  | ||||
| func (m *UpdateResponse) XXX_Unmarshal(b []byte) error { | ||||
| 	return xxx_messageInfo_UpdateResponse.Unmarshal(m, b) | ||||
| } | ||||
| func (m *UpdateResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { | ||||
| 	return xxx_messageInfo_UpdateResponse.Marshal(b, m, deterministic) | ||||
| } | ||||
| func (m *UpdateResponse) XXX_Merge(src proto.Message) { | ||||
| 	xxx_messageInfo_UpdateResponse.Merge(m, src) | ||||
| } | ||||
| func (m *UpdateResponse) XXX_Size() int { | ||||
| 	return xxx_messageInfo_UpdateResponse.Size(m) | ||||
| } | ||||
| func (m *UpdateResponse) XXX_DiscardUnknown() { | ||||
| 	xxx_messageInfo_UpdateResponse.DiscardUnknown(m) | ||||
| } | ||||
|  | ||||
| var xxx_messageInfo_UpdateResponse proto.InternalMessageInfo | ||||
|  | ||||
| // Event is routing table event | ||||
| type Event struct { | ||||
| 	// type of event | ||||
| @@ -347,7 +513,7 @@ func (m *Event) Reset()         { *m = Event{} } | ||||
| func (m *Event) String() string { return proto.CompactTextString(m) } | ||||
| func (*Event) ProtoMessage()    {} | ||||
| func (*Event) Descriptor() ([]byte, []int) { | ||||
| 	return fileDescriptor_fc08514fc6dadd29, []int{6} | ||||
| 	return fileDescriptor_367072455c71aedc, []int{11} | ||||
| } | ||||
|  | ||||
| func (m *Event) XXX_Unmarshal(b []byte) error { | ||||
| @@ -389,78 +555,6 @@ func (m *Event) GetRoute() *Route { | ||||
| 	return nil | ||||
| } | ||||
|  | ||||
| // ListRequest is made to List routes | ||||
| type ListRequest struct { | ||||
| 	XXX_NoUnkeyedLiteral struct{} `json:"-"` | ||||
| 	XXX_unrecognized     []byte   `json:"-"` | ||||
| 	XXX_sizecache        int32    `json:"-"` | ||||
| } | ||||
|  | ||||
| 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_fc08514fc6dadd29, []int{7} | ||||
| } | ||||
|  | ||||
| func (m *ListRequest) XXX_Unmarshal(b []byte) error { | ||||
| 	return xxx_messageInfo_ListRequest.Unmarshal(m, b) | ||||
| } | ||||
| func (m *ListRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { | ||||
| 	return xxx_messageInfo_ListRequest.Marshal(b, m, deterministic) | ||||
| } | ||||
| func (m *ListRequest) XXX_Merge(src proto.Message) { | ||||
| 	xxx_messageInfo_ListRequest.Merge(m, src) | ||||
| } | ||||
| func (m *ListRequest) XXX_Size() int { | ||||
| 	return xxx_messageInfo_ListRequest.Size(m) | ||||
| } | ||||
| func (m *ListRequest) XXX_DiscardUnknown() { | ||||
| 	xxx_messageInfo_ListRequest.DiscardUnknown(m) | ||||
| } | ||||
|  | ||||
| var xxx_messageInfo_ListRequest proto.InternalMessageInfo | ||||
|  | ||||
| // ListResponse is returned by List | ||||
| type ListResponse struct { | ||||
| 	Routes               []*Route `protobuf:"bytes,1,rep,name=routes,proto3" json:"routes,omitempty"` | ||||
| 	XXX_NoUnkeyedLiteral struct{} `json:"-"` | ||||
| 	XXX_unrecognized     []byte   `json:"-"` | ||||
| 	XXX_sizecache        int32    `json:"-"` | ||||
| } | ||||
|  | ||||
| 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_fc08514fc6dadd29, []int{8} | ||||
| } | ||||
|  | ||||
| func (m *ListResponse) XXX_Unmarshal(b []byte) error { | ||||
| 	return xxx_messageInfo_ListResponse.Unmarshal(m, b) | ||||
| } | ||||
| func (m *ListResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { | ||||
| 	return xxx_messageInfo_ListResponse.Marshal(b, m, deterministic) | ||||
| } | ||||
| func (m *ListResponse) XXX_Merge(src proto.Message) { | ||||
| 	xxx_messageInfo_ListResponse.Merge(m, src) | ||||
| } | ||||
| func (m *ListResponse) XXX_Size() int { | ||||
| 	return xxx_messageInfo_ListResponse.Size(m) | ||||
| } | ||||
| func (m *ListResponse) XXX_DiscardUnknown() { | ||||
| 	xxx_messageInfo_ListResponse.DiscardUnknown(m) | ||||
| } | ||||
|  | ||||
| var xxx_messageInfo_ListResponse proto.InternalMessageInfo | ||||
|  | ||||
| func (m *ListResponse) GetRoutes() []*Route { | ||||
| 	if m != nil { | ||||
| 		return m.Routes | ||||
| 	} | ||||
| 	return nil | ||||
| } | ||||
|  | ||||
| // Query is passed in a LookupRequest | ||||
| type Query struct { | ||||
| 	// service to lookup | ||||
| @@ -474,7 +568,7 @@ func (m *Query) Reset()         { *m = Query{} } | ||||
| func (m *Query) String() string { return proto.CompactTextString(m) } | ||||
| func (*Query) ProtoMessage()    {} | ||||
| func (*Query) Descriptor() ([]byte, []int) { | ||||
| 	return fileDescriptor_fc08514fc6dadd29, []int{9} | ||||
| 	return fileDescriptor_367072455c71aedc, []int{12} | ||||
| } | ||||
|  | ||||
| func (m *Query) XXX_Unmarshal(b []byte) error { | ||||
| @@ -525,7 +619,7 @@ func (m *Route) Reset()         { *m = Route{} } | ||||
| func (m *Route) String() string { return proto.CompactTextString(m) } | ||||
| func (*Route) ProtoMessage()    {} | ||||
| func (*Route) Descriptor() ([]byte, []int) { | ||||
| 	return fileDescriptor_fc08514fc6dadd29, []int{10} | ||||
| 	return fileDescriptor_367072455c71aedc, []int{13} | ||||
| } | ||||
|  | ||||
| func (m *Route) XXX_Unmarshal(b []byte) error { | ||||
| @@ -591,317 +685,61 @@ func (m *Route) GetMetric() int64 { | ||||
| func init() { | ||||
| 	proto.RegisterEnum("go.micro.router.AdvertType", AdvertType_name, AdvertType_value) | ||||
| 	proto.RegisterEnum("go.micro.router.EventType", EventType_name, EventType_value) | ||||
| 	proto.RegisterType((*ListRequest)(nil), "go.micro.router.ListRequest") | ||||
| 	proto.RegisterType((*ListResponse)(nil), "go.micro.router.ListResponse") | ||||
| 	proto.RegisterType((*LookupRequest)(nil), "go.micro.router.LookupRequest") | ||||
| 	proto.RegisterType((*LookupResponse)(nil), "go.micro.router.LookupResponse") | ||||
| 	proto.RegisterType((*WatchRequest)(nil), "go.micro.router.WatchRequest") | ||||
| 	proto.RegisterType((*AdvertiseRequest)(nil), "go.micro.router.AdvertiseRequest") | ||||
| 	proto.RegisterType((*Advert)(nil), "go.micro.router.Advert") | ||||
| 	proto.RegisterType((*ProcessResponse)(nil), "go.micro.router.ProcessResponse") | ||||
| 	proto.RegisterType((*CreateResponse)(nil), "go.micro.router.CreateResponse") | ||||
| 	proto.RegisterType((*DeleteResponse)(nil), "go.micro.router.DeleteResponse") | ||||
| 	proto.RegisterType((*UpdateResponse)(nil), "go.micro.router.UpdateResponse") | ||||
| 	proto.RegisterType((*Event)(nil), "go.micro.router.Event") | ||||
| 	proto.RegisterType((*ListRequest)(nil), "go.micro.router.ListRequest") | ||||
| 	proto.RegisterType((*ListResponse)(nil), "go.micro.router.ListResponse") | ||||
| 	proto.RegisterType((*Query)(nil), "go.micro.router.Query") | ||||
| 	proto.RegisterType((*Route)(nil), "go.micro.router.Route") | ||||
| } | ||||
|  | ||||
| func init() { | ||||
| 	proto.RegisterFile("go-micro/network/router/proto/router.proto", fileDescriptor_fc08514fc6dadd29) | ||||
| } | ||||
| func init() { proto.RegisterFile("router.proto", fileDescriptor_367072455c71aedc) } | ||||
|  | ||||
| var fileDescriptor_fc08514fc6dadd29 = []byte{ | ||||
| 	// 553 bytes of a gzipped FileDescriptorProto | ||||
| var fileDescriptor_367072455c71aedc = []byte{ | ||||
| 	// 584 bytes of a gzipped FileDescriptorProto | ||||
| 	0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x54, 0xc1, 0x6e, 0xd3, 0x40, | ||||
| 	0x10, 0x8d, 0x9d, 0xd8, 0x95, 0xa7, 0x6d, 0x1a, 0xe6, 0x50, 0x2c, 0xd3, 0x42, 0xea, 0x53, 0x55, | ||||
| 	0x15, 0x07, 0x85, 0x33, 0x88, 0x02, 0xe5, 0xd2, 0x1e, 0xc0, 0x02, 0x71, 0x36, 0xf6, 0x28, 0x58, | ||||
| 	0x49, 0xbc, 0xee, 0xee, 0x26, 0x55, 0xce, 0x7c, 0x06, 0x5f, 0xc0, 0x07, 0x72, 0x47, 0x3b, 0xb6, | ||||
| 	0x13, 0x48, 0xea, 0x0b, 0xa7, 0xec, 0x9b, 0xf7, 0x66, 0x3d, 0x33, 0x3b, 0x2f, 0x70, 0x31, 0x11, | ||||
| 	0xcf, 0xe7, 0x79, 0x2a, 0xc5, 0xa8, 0x20, 0x7d, 0x2f, 0xe4, 0x74, 0x24, 0xc5, 0x42, 0x93, 0x1c, | ||||
| 	0x95, 0x52, 0x68, 0x51, 0x83, 0x88, 0x01, 0x1e, 0x4d, 0x44, 0xc4, 0xda, 0xa8, 0x0a, 0x87, 0xaf, | ||||
| 	0xe0, 0xf0, 0x56, 0x88, 0xe9, 0xa2, 0x8c, 0xe9, 0x6e, 0x41, 0x4a, 0xe3, 0x25, 0x38, 0x77, 0x0b, | ||||
| 	0x92, 0x2b, 0xdf, 0x1a, 0x5a, 0xe7, 0xfb, 0xe3, 0xe3, 0x68, 0x2b, 0x23, 0xfa, 0x64, 0xd8, 0xb8, | ||||
| 	0x12, 0x85, 0x6f, 0xa0, 0xdf, 0xa4, 0xab, 0x52, 0x14, 0x8a, 0x30, 0x02, 0x97, 0x85, 0xca, 0xb7, | ||||
| 	0x86, 0xdd, 0x07, 0x2f, 0x88, 0xcd, 0x4f, 0x5c, 0xab, 0xc2, 0x3e, 0x1c, 0x7c, 0x4d, 0x74, 0xfa, | ||||
| 	0xbd, 0xfe, 0x7e, 0x88, 0x30, 0xb8, 0xca, 0x96, 0x24, 0x75, 0xae, 0xa8, 0x89, 0xfd, 0xb2, 0xc0, | ||||
| 	0xad, 0x82, 0xd8, 0x07, 0x3b, 0xcf, 0xb8, 0x36, 0x2f, 0xb6, 0xf3, 0x0c, 0x47, 0xd0, 0xd3, 0xab, | ||||
| 	0x92, 0x7c, 0x7b, 0x68, 0x9d, 0xf7, 0xc7, 0x4f, 0x76, 0x3e, 0x56, 0xa5, 0x7d, 0x5e, 0x95, 0x14, | ||||
| 	0xb3, 0x10, 0x4f, 0xc0, 0xd3, 0xf9, 0x9c, 0x94, 0x4e, 0xe6, 0xa5, 0xdf, 0x1d, 0x5a, 0xe7, 0xdd, | ||||
| 	0x78, 0x13, 0xc0, 0x01, 0x74, 0xb5, 0x9e, 0xf9, 0x3d, 0x8e, 0x9b, 0xa3, 0xe9, 0x87, 0x96, 0x54, | ||||
| 	0x68, 0xe5, 0x3b, 0x2d, 0xfd, 0x5c, 0x1b, 0x3a, 0xae, 0x55, 0xe1, 0x23, 0x38, 0xfa, 0x28, 0x45, | ||||
| 	0x4a, 0x4a, 0x35, 0x23, 0x09, 0x7f, 0x58, 0xe0, 0xb0, 0x08, 0xa3, 0xba, 0x5a, 0x8b, 0xab, 0x0d, | ||||
| 	0x1e, 0xbe, 0xaa, 0xad, 0x58, 0x7b, 0xbb, 0xd8, 0x4b, 0x70, 0x38, 0x8f, 0xdb, 0x68, 0x9f, 0x74, | ||||
| 	0x25, 0x0a, 0x0f, 0x61, 0xff, 0x36, 0x57, 0xba, 0x99, 0xe9, 0x6b, 0x38, 0xa8, 0xe0, 0x7f, 0xbe, | ||||
| 	0xdb, 0x19, 0x38, 0xbc, 0x09, 0xe8, 0xc3, 0x9e, 0x22, 0xb9, 0xcc, 0x53, 0xaa, 0x9f, 0xa5, 0x81, | ||||
| 	0xe1, 0x4f, 0x0b, 0x1c, 0x4e, 0x6a, 0xd7, 0x18, 0x26, 0xc9, 0x32, 0x49, 0x4a, 0x71, 0x7f, 0x5e, | ||||
| 	0xdc, 0x40, 0xc3, 0x4c, 0x12, 0x4d, 0xf7, 0xc9, 0x8a, 0xfb, 0xf3, 0xe2, 0x06, 0x1a, 0xa6, 0xde, | ||||
| 	0x74, 0x7e, 0x28, 0x2f, 0x6e, 0x20, 0x22, 0xf4, 0x66, 0x79, 0x31, 0xf5, 0x1d, 0x0e, 0xf3, 0x19, | ||||
| 	0x8f, 0xc1, 0x9d, 0x93, 0x96, 0x79, 0xea, 0xbb, 0x3c, 0xc0, 0x1a, 0x5d, 0x8c, 0x01, 0x36, 0xcb, | ||||
| 	0x81, 0x08, 0xfd, 0x0a, 0x5d, 0x15, 0x85, 0x58, 0x14, 0x29, 0x0d, 0x3a, 0x38, 0x80, 0x83, 0x2a, | ||||
| 	0xf6, 0xa5, 0xcc, 0x12, 0x4d, 0x03, 0xeb, 0x62, 0x04, 0xde, 0xfa, 0x89, 0x10, 0xc0, 0x7d, 0x27, | ||||
| 	0xc9, 0x10, 0x1d, 0x73, 0x7e, 0x4f, 0x33, 0x32, 0x22, 0x73, 0xae, 0x13, 0xec, 0xf1, 0x6f, 0x1b, | ||||
| 	0x5c, 0x1e, 0x81, 0xc4, 0xb7, 0xe0, 0xf0, 0xa2, 0xe3, 0xe9, 0xce, 0x64, 0xff, 0x36, 0x40, 0xd0, | ||||
| 	0xb2, 0x60, 0x61, 0xe7, 0x85, 0x85, 0x37, 0xe0, 0x56, 0x76, 0xc3, 0xa7, 0x3b, 0xaa, 0x7f, 0x6c, | ||||
| 	0x1c, 0x3c, 0x6b, 0xe5, 0xeb, 0xa5, 0xec, 0xe0, 0x35, 0xf4, 0xcc, 0x06, 0xe0, 0xc9, 0xae, 0x74, | ||||
| 	0xb3, 0x27, 0xc1, 0x69, 0x0b, 0xbb, 0xbe, 0xe6, 0x06, 0xbc, 0xb5, 0x61, 0xf1, 0xac, 0xc5, 0x80, | ||||
| 	0x1b, 0x33, 0x07, 0x8f, 0x5b, 0x24, 0xdc, 0xe0, 0x07, 0xd8, 0xab, 0xdd, 0x83, 0x6d, 0xba, 0x60, | ||||
| 	0xb8, 0x43, 0x6c, 0x1b, 0xae, 0xf3, 0xcd, 0xe5, 0xbf, 0xbb, 0x97, 0x7f, 0x02, 0x00, 0x00, 0xff, | ||||
| 	0xff, 0x99, 0x8e, 0xb9, 0x97, 0x1c, 0x05, 0x00, 0x00, | ||||
| } | ||||
|  | ||||
| // Reference imports to suppress errors if they are not otherwise used. | ||||
| var _ context.Context | ||||
| var _ grpc.ClientConn | ||||
|  | ||||
| // This is a compile-time assertion to ensure that this generated file | ||||
| // is compatible with the grpc package it is being compiled against. | ||||
| const _ = grpc.SupportPackageIsVersion4 | ||||
|  | ||||
| // RouterClient is the client API for Router service. | ||||
| // | ||||
| // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. | ||||
| type RouterClient interface { | ||||
| 	Watch(ctx context.Context, in *WatchRequest, opts ...grpc.CallOption) (Router_WatchClient, error) | ||||
| 	Lookup(ctx context.Context, in *LookupRequest, opts ...grpc.CallOption) (*LookupResponse, error) | ||||
| 	List(ctx context.Context, in *ListRequest, opts ...grpc.CallOption) (*ListResponse, error) | ||||
| 	Advertise(ctx context.Context, in *AdvertiseRequest, opts ...grpc.CallOption) (Router_AdvertiseClient, error) | ||||
| 	Process(ctx context.Context, in *Advert, opts ...grpc.CallOption) (*ProcessResponse, error) | ||||
| } | ||||
|  | ||||
| type routerClient struct { | ||||
| 	cc *grpc.ClientConn | ||||
| } | ||||
|  | ||||
| func NewRouterClient(cc *grpc.ClientConn) RouterClient { | ||||
| 	return &routerClient{cc} | ||||
| } | ||||
|  | ||||
| func (c *routerClient) Watch(ctx context.Context, in *WatchRequest, opts ...grpc.CallOption) (Router_WatchClient, error) { | ||||
| 	stream, err := c.cc.NewStream(ctx, &_Router_serviceDesc.Streams[0], "/go.micro.router.Router/Watch", opts...) | ||||
| 	if err != nil { | ||||
| 		return nil, err | ||||
| 	} | ||||
| 	x := &routerWatchClient{stream} | ||||
| 	if err := x.ClientStream.SendMsg(in); err != nil { | ||||
| 		return nil, err | ||||
| 	} | ||||
| 	if err := x.ClientStream.CloseSend(); err != nil { | ||||
| 		return nil, err | ||||
| 	} | ||||
| 	return x, nil | ||||
| } | ||||
|  | ||||
| type Router_WatchClient interface { | ||||
| 	Recv() (*Event, error) | ||||
| 	grpc.ClientStream | ||||
| } | ||||
|  | ||||
| type routerWatchClient struct { | ||||
| 	grpc.ClientStream | ||||
| } | ||||
|  | ||||
| func (x *routerWatchClient) Recv() (*Event, error) { | ||||
| 	m := new(Event) | ||||
| 	if err := x.ClientStream.RecvMsg(m); err != nil { | ||||
| 		return nil, err | ||||
| 	} | ||||
| 	return m, nil | ||||
| } | ||||
|  | ||||
| func (c *routerClient) Lookup(ctx context.Context, in *LookupRequest, opts ...grpc.CallOption) (*LookupResponse, error) { | ||||
| 	out := new(LookupResponse) | ||||
| 	err := c.cc.Invoke(ctx, "/go.micro.router.Router/Lookup", in, out, opts...) | ||||
| 	if err != nil { | ||||
| 		return nil, err | ||||
| 	} | ||||
| 	return out, nil | ||||
| } | ||||
|  | ||||
| func (c *routerClient) List(ctx context.Context, in *ListRequest, opts ...grpc.CallOption) (*ListResponse, error) { | ||||
| 	out := new(ListResponse) | ||||
| 	err := c.cc.Invoke(ctx, "/go.micro.router.Router/List", in, out, opts...) | ||||
| 	if err != nil { | ||||
| 		return nil, err | ||||
| 	} | ||||
| 	return out, nil | ||||
| } | ||||
|  | ||||
| func (c *routerClient) Advertise(ctx context.Context, in *AdvertiseRequest, opts ...grpc.CallOption) (Router_AdvertiseClient, error) { | ||||
| 	stream, err := c.cc.NewStream(ctx, &_Router_serviceDesc.Streams[1], "/go.micro.router.Router/Advertise", opts...) | ||||
| 	if err != nil { | ||||
| 		return nil, err | ||||
| 	} | ||||
| 	x := &routerAdvertiseClient{stream} | ||||
| 	if err := x.ClientStream.SendMsg(in); err != nil { | ||||
| 		return nil, err | ||||
| 	} | ||||
| 	if err := x.ClientStream.CloseSend(); err != nil { | ||||
| 		return nil, err | ||||
| 	} | ||||
| 	return x, nil | ||||
| } | ||||
|  | ||||
| type Router_AdvertiseClient interface { | ||||
| 	Recv() (*Advert, error) | ||||
| 	grpc.ClientStream | ||||
| } | ||||
|  | ||||
| type routerAdvertiseClient struct { | ||||
| 	grpc.ClientStream | ||||
| } | ||||
|  | ||||
| func (x *routerAdvertiseClient) Recv() (*Advert, error) { | ||||
| 	m := new(Advert) | ||||
| 	if err := x.ClientStream.RecvMsg(m); err != nil { | ||||
| 		return nil, err | ||||
| 	} | ||||
| 	return m, nil | ||||
| } | ||||
|  | ||||
| func (c *routerClient) Process(ctx context.Context, in *Advert, opts ...grpc.CallOption) (*ProcessResponse, error) { | ||||
| 	out := new(ProcessResponse) | ||||
| 	err := c.cc.Invoke(ctx, "/go.micro.router.Router/Process", in, out, opts...) | ||||
| 	if err != nil { | ||||
| 		return nil, err | ||||
| 	} | ||||
| 	return out, nil | ||||
| } | ||||
|  | ||||
| // RouterServer is the server API for Router service. | ||||
| type RouterServer interface { | ||||
| 	Watch(*WatchRequest, Router_WatchServer) error | ||||
| 	Lookup(context.Context, *LookupRequest) (*LookupResponse, error) | ||||
| 	List(context.Context, *ListRequest) (*ListResponse, error) | ||||
| 	Advertise(*AdvertiseRequest, Router_AdvertiseServer) error | ||||
| 	Process(context.Context, *Advert) (*ProcessResponse, error) | ||||
| } | ||||
|  | ||||
| func RegisterRouterServer(s *grpc.Server, srv RouterServer) { | ||||
| 	s.RegisterService(&_Router_serviceDesc, srv) | ||||
| } | ||||
|  | ||||
| func _Router_Watch_Handler(srv interface{}, stream grpc.ServerStream) error { | ||||
| 	m := new(WatchRequest) | ||||
| 	if err := stream.RecvMsg(m); err != nil { | ||||
| 		return err | ||||
| 	} | ||||
| 	return srv.(RouterServer).Watch(m, &routerWatchServer{stream}) | ||||
| } | ||||
|  | ||||
| type Router_WatchServer interface { | ||||
| 	Send(*Event) error | ||||
| 	grpc.ServerStream | ||||
| } | ||||
|  | ||||
| type routerWatchServer struct { | ||||
| 	grpc.ServerStream | ||||
| } | ||||
|  | ||||
| func (x *routerWatchServer) Send(m *Event) error { | ||||
| 	return x.ServerStream.SendMsg(m) | ||||
| } | ||||
|  | ||||
| func _Router_Lookup_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { | ||||
| 	in := new(LookupRequest) | ||||
| 	if err := dec(in); err != nil { | ||||
| 		return nil, err | ||||
| 	} | ||||
| 	if interceptor == nil { | ||||
| 		return srv.(RouterServer).Lookup(ctx, in) | ||||
| 	} | ||||
| 	info := &grpc.UnaryServerInfo{ | ||||
| 		Server:     srv, | ||||
| 		FullMethod: "/go.micro.router.Router/Lookup", | ||||
| 	} | ||||
| 	handler := func(ctx context.Context, req interface{}) (interface{}, error) { | ||||
| 		return srv.(RouterServer).Lookup(ctx, req.(*LookupRequest)) | ||||
| 	} | ||||
| 	return interceptor(ctx, in, info, handler) | ||||
| } | ||||
|  | ||||
| func _Router_List_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { | ||||
| 	in := new(ListRequest) | ||||
| 	if err := dec(in); err != nil { | ||||
| 		return nil, err | ||||
| 	} | ||||
| 	if interceptor == nil { | ||||
| 		return srv.(RouterServer).List(ctx, in) | ||||
| 	} | ||||
| 	info := &grpc.UnaryServerInfo{ | ||||
| 		Server:     srv, | ||||
| 		FullMethod: "/go.micro.router.Router/List", | ||||
| 	} | ||||
| 	handler := func(ctx context.Context, req interface{}) (interface{}, error) { | ||||
| 		return srv.(RouterServer).List(ctx, req.(*ListRequest)) | ||||
| 	} | ||||
| 	return interceptor(ctx, in, info, handler) | ||||
| } | ||||
|  | ||||
| func _Router_Advertise_Handler(srv interface{}, stream grpc.ServerStream) error { | ||||
| 	m := new(AdvertiseRequest) | ||||
| 	if err := stream.RecvMsg(m); err != nil { | ||||
| 		return err | ||||
| 	} | ||||
| 	return srv.(RouterServer).Advertise(m, &routerAdvertiseServer{stream}) | ||||
| } | ||||
|  | ||||
| type Router_AdvertiseServer interface { | ||||
| 	Send(*Advert) error | ||||
| 	grpc.ServerStream | ||||
| } | ||||
|  | ||||
| type routerAdvertiseServer struct { | ||||
| 	grpc.ServerStream | ||||
| } | ||||
|  | ||||
| func (x *routerAdvertiseServer) Send(m *Advert) error { | ||||
| 	return x.ServerStream.SendMsg(m) | ||||
| } | ||||
|  | ||||
| func _Router_Process_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { | ||||
| 	in := new(Advert) | ||||
| 	if err := dec(in); err != nil { | ||||
| 		return nil, err | ||||
| 	} | ||||
| 	if interceptor == nil { | ||||
| 		return srv.(RouterServer).Process(ctx, in) | ||||
| 	} | ||||
| 	info := &grpc.UnaryServerInfo{ | ||||
| 		Server:     srv, | ||||
| 		FullMethod: "/go.micro.router.Router/Process", | ||||
| 	} | ||||
| 	handler := func(ctx context.Context, req interface{}) (interface{}, error) { | ||||
| 		return srv.(RouterServer).Process(ctx, req.(*Advert)) | ||||
| 	} | ||||
| 	return interceptor(ctx, in, info, handler) | ||||
| } | ||||
|  | ||||
| var _Router_serviceDesc = grpc.ServiceDesc{ | ||||
| 	ServiceName: "go.micro.router.Router", | ||||
| 	HandlerType: (*RouterServer)(nil), | ||||
| 	Methods: []grpc.MethodDesc{ | ||||
| 		{ | ||||
| 			MethodName: "Lookup", | ||||
| 			Handler:    _Router_Lookup_Handler, | ||||
| 		}, | ||||
| 		{ | ||||
| 			MethodName: "List", | ||||
| 			Handler:    _Router_List_Handler, | ||||
| 		}, | ||||
| 		{ | ||||
| 			MethodName: "Process", | ||||
| 			Handler:    _Router_Process_Handler, | ||||
| 		}, | ||||
| 	}, | ||||
| 	Streams: []grpc.StreamDesc{ | ||||
| 		{ | ||||
| 			StreamName:    "Watch", | ||||
| 			Handler:       _Router_Watch_Handler, | ||||
| 			ServerStreams: true, | ||||
| 		}, | ||||
| 		{ | ||||
| 			StreamName:    "Advertise", | ||||
| 			Handler:       _Router_Advertise_Handler, | ||||
| 			ServerStreams: true, | ||||
| 		}, | ||||
| 	}, | ||||
| 	Metadata: "go-micro/network/router/proto/router.proto", | ||||
| 	0x10, 0xf5, 0x26, 0xb1, 0x2b, 0x4f, 0x53, 0xd7, 0xcc, 0xa1, 0x58, 0xa6, 0x40, 0xea, 0x53, 0x55, | ||||
| 	0x55, 0x2e, 0x0a, 0x67, 0x10, 0xa5, 0x94, 0x4b, 0x7b, 0x00, 0x0b, 0xc4, 0xd9, 0xd8, 0xa3, 0x62, | ||||
| 	0x25, 0xb1, 0xdd, 0xdd, 0x4d, 0xaa, 0x9c, 0xf9, 0x0c, 0xbe, 0x80, 0xff, 0xe0, 0xc3, 0x90, 0x77, | ||||
| 	0xed, 0x24, 0x38, 0xf1, 0xa1, 0x9c, 0xb2, 0x33, 0xf3, 0x66, 0xbc, 0x6f, 0xde, 0xbe, 0xc0, 0x90, | ||||
| 	0x17, 0x73, 0x49, 0x3c, 0x2c, 0x79, 0x21, 0x0b, 0x3c, 0xbc, 0x2b, 0xc2, 0x59, 0x96, 0xf0, 0x22, | ||||
| 	0xd4, 0xe9, 0xe0, 0x00, 0xf6, 0x6f, 0x33, 0x21, 0x23, 0xba, 0x9f, 0x93, 0x90, 0xc1, 0x5b, 0x18, | ||||
| 	0xea, 0x50, 0x94, 0x45, 0x2e, 0x08, 0x43, 0xb0, 0x14, 0x50, 0x78, 0x6c, 0xd4, 0x3f, 0xdd, 0x1f, | ||||
| 	0x1f, 0x85, 0xad, 0x01, 0x61, 0x54, 0xfd, 0x44, 0x35, 0x2a, 0x78, 0x03, 0x07, 0xb7, 0x45, 0x31, | ||||
| 	0x99, 0x97, 0xf5, 0x40, 0x3c, 0x07, 0xf3, 0x7e, 0x4e, 0x7c, 0xe9, 0xb1, 0x11, 0xdb, 0xd9, 0xff, | ||||
| 	0xb9, 0xaa, 0x46, 0x1a, 0x14, 0xbc, 0x03, 0xa7, 0x69, 0xff, 0xcf, 0x0b, 0x38, 0x30, 0xfc, 0x16, | ||||
| 	0xcb, 0xe4, 0x47, 0x43, 0x08, 0xc1, 0xbd, 0x4c, 0x17, 0xc4, 0x65, 0x26, 0xa8, 0xc9, 0xfd, 0x66, | ||||
| 	0x60, 0xe9, 0x24, 0x3a, 0xd0, 0xcb, 0x52, 0x75, 0x37, 0x3b, 0xea, 0x65, 0x29, 0x5e, 0xc0, 0x40, | ||||
| 	0x2e, 0x4b, 0xf2, 0x7a, 0x23, 0x76, 0xea, 0x8c, 0x9f, 0x6d, 0x7d, 0x4c, 0xb7, 0x7d, 0x59, 0x96, | ||||
| 	0x14, 0x29, 0x20, 0x1e, 0x83, 0x2d, 0xb3, 0x19, 0x09, 0x19, 0xcf, 0x4a, 0xaf, 0x3f, 0x62, 0xa7, | ||||
| 	0xfd, 0x68, 0x9d, 0x40, 0x17, 0xfa, 0x52, 0x4e, 0xbd, 0x81, 0xca, 0x57, 0xc7, 0x8a, 0x0f, 0x2d, | ||||
| 	0x28, 0x97, 0xc2, 0x33, 0x3b, 0xf8, 0x5c, 0x57, 0xe5, 0xa8, 0x46, 0x05, 0x4f, 0xe0, 0xf0, 0x13, | ||||
| 	0x2f, 0x12, 0x12, 0xa2, 0x59, 0x49, 0xe0, 0x82, 0x73, 0xc5, 0x29, 0x96, 0xb4, 0x99, 0xf9, 0x40, | ||||
| 	0x53, 0xfa, 0x37, 0xf3, 0xb5, 0x4c, 0x37, 0x31, 0x3f, 0x19, 0x98, 0x6a, 0x34, 0x86, 0x35, 0x47, | ||||
| 	0xa6, 0x38, 0xfa, 0xbb, 0x2f, 0xd0, 0x45, 0xb1, 0xd7, 0xa6, 0x78, 0x0e, 0xa6, 0xea, 0x53, 0xe4, | ||||
| 	0xbb, 0xf5, 0xd1, 0xa0, 0xe0, 0x04, 0x4c, 0x25, 0x38, 0x7a, 0xb0, 0x27, 0x88, 0x2f, 0xb2, 0x84, | ||||
| 	0xea, 0xed, 0x37, 0x61, 0xf0, 0x8b, 0x81, 0xa9, 0x7a, 0xba, 0x31, 0x55, 0x25, 0x4e, 0x53, 0x4e, | ||||
| 	0x42, 0xa8, 0x0b, 0xd9, 0x51, 0x13, 0x56, 0x95, 0xbb, 0x58, 0xd2, 0x43, 0xbc, 0x54, 0x17, 0xb2, | ||||
| 	0xa3, 0x26, 0xac, 0x2a, 0x39, 0xc9, 0x87, 0x82, 0x4f, 0x94, 0x1e, 0x76, 0xd4, 0x84, 0x88, 0x30, | ||||
| 	0x98, 0x66, 0xf9, 0xc4, 0x33, 0x55, 0x5a, 0x9d, 0xf1, 0x08, 0xac, 0x19, 0x49, 0x9e, 0x25, 0x9e, | ||||
| 	0xa5, 0x18, 0xd7, 0xd1, 0xd9, 0x18, 0x60, 0xfd, 0x06, 0x10, 0xc1, 0xd1, 0xd1, 0x65, 0x9e, 0x17, | ||||
| 	0xf3, 0x3c, 0x21, 0xd7, 0x40, 0x17, 0x86, 0x3a, 0xa7, 0x05, 0x70, 0xd9, 0xd9, 0x05, 0xd8, 0xab, | ||||
| 	0x9d, 0x22, 0x80, 0xa5, 0xd5, 0x73, 0x8d, 0xea, 0xac, 0x75, 0x73, 0x59, 0x75, 0xae, 0x1b, 0x7a, | ||||
| 	0xe3, 0x3f, 0x03, 0xb0, 0xd4, 0x0a, 0x38, 0x5e, 0xc3, 0xa0, 0x32, 0x24, 0x1e, 0x6f, 0xed, 0x75, | ||||
| 	0xc3, 0xb6, 0xfe, 0xf3, 0x8e, 0x6a, 0xad, 0xbd, 0x81, 0x37, 0x60, 0x69, 0x63, 0xe1, 0x8b, 0x6d, | ||||
| 	0xe8, 0xa6, 0x61, 0xfd, 0x97, 0x9d, 0xf5, 0xd5, 0xb0, 0xf7, 0x60, 0x2a, 0x8f, 0xe1, 0xf6, 0x67, | ||||
| 	0x37, 0xbd, 0xe7, 0x77, 0xbc, 0xed, 0xc0, 0x78, 0xc5, 0xf0, 0x06, 0xec, 0x95, 0x2f, 0xf1, 0xa4, | ||||
| 	0xc3, 0x67, 0x6b, 0xcf, 0xfa, 0x4f, 0x3b, 0x20, 0x6a, 0xd8, 0x47, 0xd8, 0xab, 0x4d, 0x82, 0x5d, | ||||
| 	0x38, 0x7f, 0xb4, 0x55, 0x68, 0xfb, 0xca, 0xc0, 0xab, 0x46, 0x1b, 0xec, 0x78, 0xc6, 0x3b, 0xb6, | ||||
| 	0xd3, 0xb2, 0xa2, 0x1a, 0xa2, 0x45, 0x7d, 0xc4, 0x90, 0x96, 0x7b, 0xd5, 0x10, 0xfd, 0x1a, 0x1e, | ||||
| 	0x31, 0xa4, 0x65, 0x78, 0xe3, 0xbb, 0xa5, 0xfe, 0xf3, 0x5f, 0xff, 0x0d, 0x00, 0x00, 0xff, 0xff, | ||||
| 	0xde, 0x0b, 0x1c, 0x4a, 0x03, 0x06, 0x00, 0x00, | ||||
| } | ||||
|   | ||||
| @@ -4,11 +4,22 @@ package go.micro.router; | ||||
|  | ||||
| // Router service is used by the proxy to lookup routes | ||||
| service Router { | ||||
|         rpc Watch(WatchRequest) returns (stream Event) {}; | ||||
| 	rpc Lookup(LookupRequest) returns (LookupResponse) {}; | ||||
|         rpc List(ListRequest) returns (ListResponse) {}; | ||||
| 	rpc Lookup(LookupRequest) returns (LookupResponse) {}; | ||||
|         rpc Watch(WatchRequest) returns (stream Event) {}; | ||||
|         rpc Advertise(AdvertiseRequest) returns (stream Advert) {}; | ||||
|         rpc Process(Advert) returns (ProcessResponse) {}; | ||||
|         rpc Create(Route) returns (CreateResponse) {}; | ||||
|         rpc Delete(Route) returns (DeleteResponse) {}; | ||||
|         rpc Update(Route) returns (UpdateResponse) {}; | ||||
| } | ||||
|  | ||||
| // ListRequest is made to List routes | ||||
| message ListRequest {} | ||||
|  | ||||
| // ListResponse is returned by List | ||||
| message ListResponse { | ||||
| 	repeated Route routes = 1; | ||||
| } | ||||
|  | ||||
| // LookupRequest is made to Lookup | ||||
| @@ -24,7 +35,6 @@ message LookupResponse { | ||||
| // WatchRequest is made to Watch Router | ||||
| message WatchRequest {} | ||||
|  | ||||
|  | ||||
| // AdvertiseRequest request a stream of Adverts | ||||
| message AdvertiseRequest {} | ||||
|  | ||||
| @@ -51,6 +61,15 @@ message Advert { | ||||
| // ProcessResponse is returned by Process | ||||
| message ProcessResponse {} | ||||
|  | ||||
| // CreateResponse is returned by Create | ||||
| message CreateResponse {} | ||||
|  | ||||
| // DeleteResponse is returned by Delete | ||||
| message DeleteResponse {} | ||||
|  | ||||
| // UpdateResponse is returned by Update | ||||
| message UpdateResponse {} | ||||
|  | ||||
| // EventType defines the type of event | ||||
| enum EventType { | ||||
|         Create = 0; | ||||
| @@ -68,14 +87,6 @@ message Event { | ||||
| 	Route route = 3; | ||||
| } | ||||
|  | ||||
| // ListRequest is made to List routes | ||||
| message ListRequest {} | ||||
|  | ||||
| // ListResponse is returned by List | ||||
| message ListResponse { | ||||
| 	repeated Route routes = 1; | ||||
| } | ||||
|  | ||||
| // Query is passed in a LookupRequest | ||||
| message Query { | ||||
| 	// service to lookup | ||||
|   | ||||
		Reference in New Issue
	
	Block a user