Documentation
¶
Index ¶
- Variables
- func NewRouterEndpoints() []*api.Endpoint
- func NewTableEndpoints() []*api.Endpoint
- func RegisterRouterHandler(s server.Server, hdlr RouterHandler, opts ...server.HandlerOption) error
- func RegisterTableHandler(s server.Server, hdlr TableHandler, opts ...server.HandlerOption) error
- type Advert
- func (*Advert) Descriptor() ([]byte, []int)deprecated
- func (x *Advert) GetEvents() []*Event
- func (x *Advert) GetId() string
- func (x *Advert) GetTimestamp() int64
- func (x *Advert) GetTtl() int64
- func (x *Advert) GetType() AdvertType
- func (*Advert) ProtoMessage()
- func (x *Advert) ProtoReflect() protoreflect.Message
- func (x *Advert) Reset()
- func (x *Advert) String() string
- type AdvertType
- type CreateResponse
- type DeleteResponse
- type Event
- func (*Event) Descriptor() ([]byte, []int)deprecated
- func (x *Event) GetId() string
- func (x *Event) GetRoute() *Route
- func (x *Event) GetTimestamp() int64
- func (x *Event) GetType() EventType
- func (*Event) ProtoMessage()
- func (x *Event) ProtoReflect() protoreflect.Message
- func (x *Event) Reset()
- func (x *Event) String() string
- type EventType
- type ListResponse
- type LookupRequest
- type LookupResponse
- type ProcessResponse
- type Query
- type QueryRequest
- type QueryResponse
- type Request
- type Response
- type Route
- func (*Route) Descriptor() ([]byte, []int)deprecated
- func (x *Route) GetAddress() string
- func (x *Route) GetGateway() string
- func (x *Route) GetLink() string
- func (x *Route) GetMetric() int64
- func (x *Route) GetNetwork() string
- func (x *Route) GetRouter() string
- func (x *Route) GetService() string
- func (*Route) ProtoMessage()
- func (x *Route) ProtoReflect() protoreflect.Message
- func (x *Route) Reset()
- func (x *Route) String() string
- type RouterHandler
- type RouterService
- type Router_AdvertiseService
- type Router_AdvertiseStream
- type Router_WatchService
- type Router_WatchStream
- type TableHandler
- type TableService
- type UpdateResponse
- type WatchRequest
Constants ¶
This section is empty.
Variables ¶
var ( AdvertType_name = map[int32]string{ 0: "AdvertAnnounce", 1: "AdvertUpdate", } AdvertType_value = map[string]int32{ "AdvertAnnounce": 0, "AdvertUpdate": 1, } )
Enum value maps for AdvertType.
var ( EventType_name = map[int32]string{ 0: "Create", 1: "Delete", 2: "Update", } EventType_value = map[string]int32{ "Create": 0, "Delete": 1, "Update": 2, } )
Enum value maps for EventType.
var File_router_service_proto_router_proto protoreflect.FileDescriptor
Functions ¶
func NewRouterEndpoints ¶
NewRouterEndpoints API Endpoints for Router service
func NewTableEndpoints ¶
NewTableEndpoints API Endpoints for Table service
func RegisterRouterHandler ¶
func RegisterRouterHandler(s server.Server, hdlr RouterHandler, opts ...server.HandlerOption) error
func RegisterTableHandler ¶
func RegisterTableHandler(s server.Server, hdlr TableHandler, opts ...server.HandlerOption) error
Types ¶
type Advert ¶
type Advert struct { // id of the advertising router Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` // type of advertisement Type AdvertType `protobuf:"varint,2,opt,name=type,proto3,enum=go.micro.router.AdvertType" json:"type,omitempty"` // unix timestamp of the advertisement Timestamp int64 `protobuf:"varint,3,opt,name=timestamp,proto3" json:"timestamp,omitempty"` // TTL of the Advert Ttl int64 `protobuf:"varint,4,opt,name=ttl,proto3" json:"ttl,omitempty"` // events is a list of advertised events Events []*Event `protobuf:"bytes,5,rep,name=events,proto3" json:"events,omitempty"` // contains filtered or unexported fields }
Advert is router advertsement streamed by Watch
func (*Advert) Descriptor
deprecated
func (*Advert) GetTimestamp ¶
func (*Advert) GetType ¶
func (x *Advert) GetType() AdvertType
func (*Advert) ProtoMessage ¶
func (*Advert) ProtoMessage()
func (*Advert) ProtoReflect ¶
func (x *Advert) ProtoReflect() protoreflect.Message
type AdvertType ¶
type AdvertType int32
AdvertType defines the type of advert
const ( AdvertType_AdvertAnnounce AdvertType = 0 AdvertType_AdvertUpdate AdvertType = 1 )
func (AdvertType) Descriptor ¶
func (AdvertType) Descriptor() protoreflect.EnumDescriptor
func (AdvertType) Enum ¶
func (x AdvertType) Enum() *AdvertType
func (AdvertType) EnumDescriptor
deprecated
func (AdvertType) EnumDescriptor() ([]byte, []int)
Deprecated: Use AdvertType.Descriptor instead.
func (AdvertType) Number ¶
func (x AdvertType) Number() protoreflect.EnumNumber
func (AdvertType) String ¶
func (x AdvertType) String() string
func (AdvertType) Type ¶
func (AdvertType) Type() protoreflect.EnumType
type CreateResponse ¶
type CreateResponse struct {
// contains filtered or unexported fields
}
CreateResponse is returned by Create
func (*CreateResponse) Descriptor
deprecated
func (*CreateResponse) Descriptor() ([]byte, []int)
Deprecated: Use CreateResponse.ProtoReflect.Descriptor instead.
func (*CreateResponse) ProtoMessage ¶
func (*CreateResponse) ProtoMessage()
func (*CreateResponse) ProtoReflect ¶
func (x *CreateResponse) ProtoReflect() protoreflect.Message
func (*CreateResponse) Reset ¶
func (x *CreateResponse) Reset()
func (*CreateResponse) String ¶
func (x *CreateResponse) String() string
type DeleteResponse ¶
type DeleteResponse struct {
// contains filtered or unexported fields
}
DeleteResponse is returned by Delete
func (*DeleteResponse) Descriptor
deprecated
func (*DeleteResponse) Descriptor() ([]byte, []int)
Deprecated: Use DeleteResponse.ProtoReflect.Descriptor instead.
func (*DeleteResponse) ProtoMessage ¶
func (*DeleteResponse) ProtoMessage()
func (*DeleteResponse) ProtoReflect ¶
func (x *DeleteResponse) ProtoReflect() protoreflect.Message
func (*DeleteResponse) Reset ¶
func (x *DeleteResponse) Reset()
func (*DeleteResponse) String ¶
func (x *DeleteResponse) String() string
type Event ¶
type Event struct { // the unique event id Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` // type of event Type EventType `protobuf:"varint,2,opt,name=type,proto3,enum=go.micro.router.EventType" json:"type,omitempty"` // unix timestamp of event Timestamp int64 `protobuf:"varint,3,opt,name=timestamp,proto3" json:"timestamp,omitempty"` // service route Route *Route `protobuf:"bytes,4,opt,name=route,proto3" json:"route,omitempty"` // contains filtered or unexported fields }
Event is routing table event
func (*Event) Descriptor
deprecated
func (*Event) GetTimestamp ¶
func (*Event) ProtoMessage ¶
func (*Event) ProtoMessage()
func (*Event) ProtoReflect ¶
func (x *Event) ProtoReflect() protoreflect.Message
type EventType ¶
type EventType int32
EventType defines the type of event
func (EventType) Descriptor ¶
func (EventType) Descriptor() protoreflect.EnumDescriptor
func (EventType) EnumDescriptor
deprecated
func (EventType) Number ¶
func (x EventType) Number() protoreflect.EnumNumber
func (EventType) Type ¶
func (EventType) Type() protoreflect.EnumType
type ListResponse ¶
type ListResponse struct { Routes []*Route `protobuf:"bytes,1,rep,name=routes,proto3" json:"routes,omitempty"` // contains filtered or unexported fields }
ListResponse is returned by List
func (*ListResponse) Descriptor
deprecated
func (*ListResponse) Descriptor() ([]byte, []int)
Deprecated: Use ListResponse.ProtoReflect.Descriptor instead.
func (*ListResponse) GetRoutes ¶
func (x *ListResponse) GetRoutes() []*Route
func (*ListResponse) ProtoMessage ¶
func (*ListResponse) ProtoMessage()
func (*ListResponse) ProtoReflect ¶
func (x *ListResponse) ProtoReflect() protoreflect.Message
func (*ListResponse) Reset ¶
func (x *ListResponse) Reset()
func (*ListResponse) String ¶
func (x *ListResponse) String() string
type LookupRequest ¶
type LookupRequest struct { Query *Query `protobuf:"bytes,1,opt,name=query,proto3" json:"query,omitempty"` // contains filtered or unexported fields }
LookupRequest is made to Lookup
func (*LookupRequest) Descriptor
deprecated
func (*LookupRequest) Descriptor() ([]byte, []int)
Deprecated: Use LookupRequest.ProtoReflect.Descriptor instead.
func (*LookupRequest) GetQuery ¶
func (x *LookupRequest) GetQuery() *Query
func (*LookupRequest) ProtoMessage ¶
func (*LookupRequest) ProtoMessage()
func (*LookupRequest) ProtoReflect ¶
func (x *LookupRequest) ProtoReflect() protoreflect.Message
func (*LookupRequest) Reset ¶
func (x *LookupRequest) Reset()
func (*LookupRequest) String ¶
func (x *LookupRequest) String() string
type LookupResponse ¶
type LookupResponse struct { Routes []*Route `protobuf:"bytes,1,rep,name=routes,proto3" json:"routes,omitempty"` // contains filtered or unexported fields }
LookupResponse is returned by Lookup
func (*LookupResponse) Descriptor
deprecated
func (*LookupResponse) Descriptor() ([]byte, []int)
Deprecated: Use LookupResponse.ProtoReflect.Descriptor instead.
func (*LookupResponse) GetRoutes ¶
func (x *LookupResponse) GetRoutes() []*Route
func (*LookupResponse) ProtoMessage ¶
func (*LookupResponse) ProtoMessage()
func (*LookupResponse) ProtoReflect ¶
func (x *LookupResponse) ProtoReflect() protoreflect.Message
func (*LookupResponse) Reset ¶
func (x *LookupResponse) Reset()
func (*LookupResponse) String ¶
func (x *LookupResponse) String() string
type ProcessResponse ¶
type ProcessResponse struct {
// contains filtered or unexported fields
}
ProcessResponse is returned by Process
func (*ProcessResponse) Descriptor
deprecated
func (*ProcessResponse) Descriptor() ([]byte, []int)
Deprecated: Use ProcessResponse.ProtoReflect.Descriptor instead.
func (*ProcessResponse) ProtoMessage ¶
func (*ProcessResponse) ProtoMessage()
func (*ProcessResponse) ProtoReflect ¶
func (x *ProcessResponse) ProtoReflect() protoreflect.Message
func (*ProcessResponse) Reset ¶
func (x *ProcessResponse) Reset()
func (*ProcessResponse) String ¶
func (x *ProcessResponse) String() string
type Query ¶
type Query struct { // service to lookup Service string `protobuf:"bytes,1,opt,name=service,proto3" json:"service,omitempty"` // gateway to lookup Gateway string `protobuf:"bytes,2,opt,name=gateway,proto3" json:"gateway,omitempty"` // network to lookup Network string `protobuf:"bytes,3,opt,name=network,proto3" json:"network,omitempty"` // contains filtered or unexported fields }
Query is passed in a LookupRequest
func (*Query) Descriptor
deprecated
func (*Query) GetGateway ¶
func (*Query) GetNetwork ¶
func (*Query) GetService ¶
func (*Query) ProtoMessage ¶
func (*Query) ProtoMessage()
func (*Query) ProtoReflect ¶
func (x *Query) ProtoReflect() protoreflect.Message
type QueryRequest ¶
type QueryRequest struct { Query *Query `protobuf:"bytes,1,opt,name=query,proto3" json:"query,omitempty"` // contains filtered or unexported fields }
QueryRequest queries Table for Routes
func (*QueryRequest) Descriptor
deprecated
func (*QueryRequest) Descriptor() ([]byte, []int)
Deprecated: Use QueryRequest.ProtoReflect.Descriptor instead.
func (*QueryRequest) GetQuery ¶
func (x *QueryRequest) GetQuery() *Query
func (*QueryRequest) ProtoMessage ¶
func (*QueryRequest) ProtoMessage()
func (*QueryRequest) ProtoReflect ¶
func (x *QueryRequest) ProtoReflect() protoreflect.Message
func (*QueryRequest) Reset ¶
func (x *QueryRequest) Reset()
func (*QueryRequest) String ¶
func (x *QueryRequest) String() string
type QueryResponse ¶
type QueryResponse struct { Routes []*Route `protobuf:"bytes,1,rep,name=routes,proto3" json:"routes,omitempty"` // contains filtered or unexported fields }
QueryResponse is returned by Query
func (*QueryResponse) Descriptor
deprecated
func (*QueryResponse) Descriptor() ([]byte, []int)
Deprecated: Use QueryResponse.ProtoReflect.Descriptor instead.
func (*QueryResponse) GetRoutes ¶
func (x *QueryResponse) GetRoutes() []*Route
func (*QueryResponse) ProtoMessage ¶
func (*QueryResponse) ProtoMessage()
func (*QueryResponse) ProtoReflect ¶
func (x *QueryResponse) ProtoReflect() protoreflect.Message
func (*QueryResponse) Reset ¶
func (x *QueryResponse) Reset()
func (*QueryResponse) String ¶
func (x *QueryResponse) String() string
type Request ¶
type Request struct {
// contains filtered or unexported fields
}
Empty request
func (*Request) Descriptor
deprecated
func (*Request) ProtoMessage ¶
func (*Request) ProtoMessage()
func (*Request) ProtoReflect ¶
func (x *Request) ProtoReflect() protoreflect.Message
type Response ¶
type Response struct {
// contains filtered or unexported fields
}
Empty response
func (*Response) Descriptor
deprecated
func (*Response) ProtoMessage ¶
func (*Response) ProtoMessage()
func (*Response) ProtoReflect ¶
func (x *Response) ProtoReflect() protoreflect.Message
type Route ¶
type Route struct { // service for the route Service string `protobuf:"bytes,1,opt,name=service,proto3" json:"service,omitempty"` // the address that advertise this route Address string `protobuf:"bytes,2,opt,name=address,proto3" json:"address,omitempty"` // gateway as the next hop Gateway string `protobuf:"bytes,3,opt,name=gateway,proto3" json:"gateway,omitempty"` // the network for this destination Network string `protobuf:"bytes,4,opt,name=network,proto3" json:"network,omitempty"` // router if the router id Router string `protobuf:"bytes,5,opt,name=router,proto3" json:"router,omitempty"` // the network link Link string `protobuf:"bytes,6,opt,name=link,proto3" json:"link,omitempty"` // the metric / score of this route Metric int64 `protobuf:"varint,7,opt,name=metric,proto3" json:"metric,omitempty"` // contains filtered or unexported fields }
Route is a service route
func (*Route) Descriptor
deprecated
func (*Route) GetAddress ¶
func (*Route) GetGateway ¶
func (*Route) GetNetwork ¶
func (*Route) GetService ¶
func (*Route) ProtoMessage ¶
func (*Route) ProtoMessage()
func (*Route) ProtoReflect ¶
func (x *Route) ProtoReflect() protoreflect.Message
type RouterHandler ¶
type RouterHandler interface { Lookup(context.Context, *LookupRequest, *LookupResponse) error Watch(context.Context, *WatchRequest, Router_WatchStream) error Advertise(context.Context, *Request, Router_AdvertiseStream) error Process(context.Context, *Advert, *ProcessResponse) error }
RouterHandler is the server API for Router service.
type RouterService ¶
type RouterService interface { 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 *Request, opts ...client.CallOption) (Router_AdvertiseService, error) Process(ctx context.Context, in *Advert, opts ...client.CallOption) (*ProcessResponse, error) }
RouterService is the client API for Router service.
func NewRouterService ¶
func NewRouterService(name string, c client.Client) RouterService
type Router_AdvertiseService ¶
type Router_AdvertiseStream ¶
type Router_WatchService ¶
type Router_WatchStream ¶
type TableHandler ¶
type TableHandler interface { Create(context.Context, *Route, *CreateResponse) error Delete(context.Context, *Route, *DeleteResponse) error Update(context.Context, *Route, *UpdateResponse) error List(context.Context, *Request, *ListResponse) error Query(context.Context, *QueryRequest, *QueryResponse) error }
TableHandler is the server API for Table service.
type TableService ¶
type TableService interface { 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) List(ctx context.Context, in *Request, opts ...client.CallOption) (*ListResponse, error) Query(ctx context.Context, in *QueryRequest, opts ...client.CallOption) (*QueryResponse, error) }
TableService is the client API for Table service.
func NewTableService ¶
func NewTableService(name string, c client.Client) TableService
type UpdateResponse ¶
type UpdateResponse struct {
// contains filtered or unexported fields
}
UpdateResponse is returned by Update
func (*UpdateResponse) Descriptor
deprecated
func (*UpdateResponse) Descriptor() ([]byte, []int)
Deprecated: Use UpdateResponse.ProtoReflect.Descriptor instead.
func (*UpdateResponse) ProtoMessage ¶
func (*UpdateResponse) ProtoMessage()
func (*UpdateResponse) ProtoReflect ¶
func (x *UpdateResponse) ProtoReflect() protoreflect.Message
func (*UpdateResponse) Reset ¶
func (x *UpdateResponse) Reset()
func (*UpdateResponse) String ¶
func (x *UpdateResponse) String() string
type WatchRequest ¶
type WatchRequest struct {
// contains filtered or unexported fields
}
WatchRequest is made to Watch Router
func (*WatchRequest) Descriptor
deprecated
func (*WatchRequest) Descriptor() ([]byte, []int)
Deprecated: Use WatchRequest.ProtoReflect.Descriptor instead.
func (*WatchRequest) ProtoMessage ¶
func (*WatchRequest) ProtoMessage()
func (*WatchRequest) ProtoReflect ¶
func (x *WatchRequest) ProtoReflect() protoreflect.Message
func (*WatchRequest) Reset ¶
func (x *WatchRequest) Reset()
func (*WatchRequest) String ¶
func (x *WatchRequest) String() string