router

package
v2.9.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 2, 2021 License: Apache-2.0 Imports: 14 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	AdvertType_name = map[int32]string{
		0: "AdvertAnnounce",
		1: "AdvertUpdate",
	}
	AdvertType_value = map[string]int32{
		"AdvertAnnounce": 0,
		"AdvertUpdate":   1,
	}
)

Enum value maps for AdvertType.

View Source
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.

View Source
var File_router_service_proto_router_proto protoreflect.FileDescriptor

Functions

func NewRouterEndpoints

func NewRouterEndpoints() []*api.Endpoint

func NewTableEndpoints

func NewTableEndpoints() []*api.Endpoint

func RegisterRouterHandler

func RegisterRouterHandler(s server.Server, hdlr RouterHandler, opts ...server.HandlerOption) error

func RegisterRouterServer

func RegisterRouterServer(s *grpc.Server, srv RouterServer)

func RegisterTableHandler

func RegisterTableHandler(s server.Server, hdlr TableHandler, opts ...server.HandlerOption) error

func RegisterTableServer

func RegisterTableServer(s *grpc.Server, srv TableServer)

Types

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) Descriptor() ([]byte, []int)

Deprecated: Use Advert.ProtoReflect.Descriptor instead.

func (*Advert) GetEvents

func (x *Advert) GetEvents() []*Event

func (*Advert) GetId

func (x *Advert) GetId() string

func (*Advert) GetTimestamp

func (x *Advert) GetTimestamp() int64

func (*Advert) GetTtl

func (x *Advert) GetTtl() int64

func (*Advert) GetType

func (x *Advert) GetType() AdvertType

func (*Advert) ProtoMessage

func (*Advert) ProtoMessage()

func (*Advert) ProtoReflect added in v2.9.3

func (x *Advert) ProtoReflect() protoreflect.Message

func (*Advert) Reset

func (x *Advert) Reset()

func (*Advert) String

func (x *Advert) String() string

type AdvertType

type AdvertType int32

AdvertType defines the type of advert

const (
	AdvertType_AdvertAnnounce AdvertType = 0
	AdvertType_AdvertUpdate   AdvertType = 1
)

func (AdvertType) Descriptor added in v2.9.3

func (AdvertType) Descriptor() protoreflect.EnumDescriptor

func (AdvertType) Enum added in v2.9.3

func (x AdvertType) Enum() *AdvertType

func (AdvertType) EnumDescriptor deprecated

func (AdvertType) EnumDescriptor() ([]byte, []int)

Deprecated: Use AdvertType.Descriptor instead.

func (AdvertType) Number added in v2.9.3

func (x AdvertType) Number() protoreflect.EnumNumber

func (AdvertType) String

func (x AdvertType) String() string

func (AdvertType) Type added in v2.9.3

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 added in v2.9.3

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 added in v2.9.3

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) Descriptor() ([]byte, []int)

Deprecated: Use Event.ProtoReflect.Descriptor instead.

func (*Event) GetId

func (x *Event) GetId() string

func (*Event) GetRoute

func (x *Event) GetRoute() *Route

func (*Event) GetTimestamp

func (x *Event) GetTimestamp() int64

func (*Event) GetType

func (x *Event) GetType() EventType

func (*Event) ProtoMessage

func (*Event) ProtoMessage()

func (*Event) ProtoReflect added in v2.9.3

func (x *Event) ProtoReflect() protoreflect.Message

func (*Event) Reset

func (x *Event) Reset()

func (*Event) String

func (x *Event) String() string

type EventType

type EventType int32

EventType defines the type of event

const (
	EventType_Create EventType = 0
	EventType_Delete EventType = 1
	EventType_Update EventType = 2
)

func (EventType) Descriptor added in v2.9.3

func (EventType) Descriptor() protoreflect.EnumDescriptor

func (EventType) Enum added in v2.9.3

func (x EventType) Enum() *EventType

func (EventType) EnumDescriptor deprecated

func (EventType) EnumDescriptor() ([]byte, []int)

Deprecated: Use EventType.Descriptor instead.

func (EventType) Number added in v2.9.3

func (x EventType) Number() protoreflect.EnumNumber

func (EventType) String

func (x EventType) String() string

func (EventType) Type added in v2.9.3

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 added in v2.9.3

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 added in v2.9.3

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 added in v2.9.3

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 added in v2.9.3

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) Descriptor() ([]byte, []int)

Deprecated: Use Query.ProtoReflect.Descriptor instead.

func (*Query) GetGateway

func (x *Query) GetGateway() string

func (*Query) GetNetwork

func (x *Query) GetNetwork() string

func (*Query) GetService

func (x *Query) GetService() string

func (*Query) ProtoMessage

func (*Query) ProtoMessage()

func (*Query) ProtoReflect added in v2.9.3

func (x *Query) ProtoReflect() protoreflect.Message

func (*Query) Reset

func (x *Query) Reset()

func (*Query) String

func (x *Query) String() string

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 added in v2.9.3

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 added in v2.9.3

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) Descriptor() ([]byte, []int)

Deprecated: Use Request.ProtoReflect.Descriptor instead.

func (*Request) ProtoMessage

func (*Request) ProtoMessage()

func (*Request) ProtoReflect added in v2.9.3

func (x *Request) ProtoReflect() protoreflect.Message

func (*Request) Reset

func (x *Request) Reset()

func (*Request) String

func (x *Request) String() string

type Response

type Response struct {
	// contains filtered or unexported fields
}

Empty response

func (*Response) Descriptor deprecated

func (*Response) Descriptor() ([]byte, []int)

Deprecated: Use Response.ProtoReflect.Descriptor instead.

func (*Response) ProtoMessage

func (*Response) ProtoMessage()

func (*Response) ProtoReflect added in v2.9.3

func (x *Response) ProtoReflect() protoreflect.Message

func (*Response) Reset

func (x *Response) Reset()

func (*Response) String

func (x *Response) String() string

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) Descriptor() ([]byte, []int)

Deprecated: Use Route.ProtoReflect.Descriptor instead.

func (*Route) GetAddress

func (x *Route) GetAddress() string

func (*Route) GetGateway

func (x *Route) GetGateway() string
func (x *Route) GetLink() string

func (*Route) GetMetric

func (x *Route) GetMetric() int64

func (*Route) GetNetwork

func (x *Route) GetNetwork() string

func (*Route) GetRouter

func (x *Route) GetRouter() string

func (*Route) GetService

func (x *Route) GetService() string

func (*Route) ProtoMessage

func (*Route) ProtoMessage()

func (*Route) ProtoReflect added in v2.9.3

func (x *Route) ProtoReflect() protoreflect.Message

func (*Route) Reset

func (x *Route) Reset()

func (*Route) String

func (x *Route) String() string

type RouterClient

type RouterClient interface {
	Lookup(ctx context.Context, in *LookupRequest, opts ...grpc.CallOption) (*LookupResponse, error)
	Watch(ctx context.Context, in *WatchRequest, opts ...grpc.CallOption) (Router_WatchClient, error)
	Advertise(ctx context.Context, in *Request, opts ...grpc.CallOption) (Router_AdvertiseClient, error)
	Process(ctx context.Context, in *Advert, opts ...grpc.CallOption) (*ProcessResponse, error)
}

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.

func NewRouterClient

func NewRouterClient(cc grpc.ClientConnInterface) RouterClient

type RouterServer

RouterServer 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)
}

func NewRouterService

func NewRouterService(name string, c client.Client) RouterService

type Router_AdvertiseClient

type Router_AdvertiseClient interface {
	Recv() (*Advert, error)
	grpc.ClientStream
}

type Router_AdvertiseServer

type Router_AdvertiseServer interface {
	Send(*Advert) error
	grpc.ServerStream
}

type Router_AdvertiseService

type Router_AdvertiseService interface {
	Context() context.Context
	SendMsg(interface{}) error
	RecvMsg(interface{}) error
	Close() error
	Recv() (*Advert, error)
}

type Router_AdvertiseStream

type Router_AdvertiseStream interface {
	Context() context.Context
	SendMsg(interface{}) error
	RecvMsg(interface{}) error
	Close() error
	Send(*Advert) error
}

type Router_WatchClient

type Router_WatchClient interface {
	Recv() (*Event, error)
	grpc.ClientStream
}

type Router_WatchServer

type Router_WatchServer interface {
	Send(*Event) error
	grpc.ServerStream
}

type Router_WatchService

type Router_WatchService interface {
	Context() context.Context
	SendMsg(interface{}) error
	RecvMsg(interface{}) error
	Close() error
	Recv() (*Event, error)
}

type Router_WatchStream

type Router_WatchStream interface {
	Context() context.Context
	SendMsg(interface{}) error
	RecvMsg(interface{}) error
	Close() error
	Send(*Event) error
}

type TableClient

type TableClient interface {
	Create(ctx context.Context, in *Route, opts ...grpc.CallOption) (*CreateResponse, error)
	Delete(ctx context.Context, in *Route, opts ...grpc.CallOption) (*DeleteResponse, error)
	Update(ctx context.Context, in *Route, opts ...grpc.CallOption) (*UpdateResponse, error)
	List(ctx context.Context, in *Request, opts ...grpc.CallOption) (*ListResponse, error)
	Query(ctx context.Context, in *QueryRequest, opts ...grpc.CallOption) (*QueryResponse, error)
}

TableClient is the client API for Table service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.

func NewTableClient

func NewTableClient(cc grpc.ClientConnInterface) TableClient

type TableServer

TableServer 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)
}

func NewTableService

func NewTableService(name string, c client.Client) TableService

type UnimplementedRouterServer

type UnimplementedRouterServer struct {
}

UnimplementedRouterServer can be embedded to have forward compatible implementations.

func (*UnimplementedRouterServer) Advertise

func (*UnimplementedRouterServer) Lookup

func (*UnimplementedRouterServer) Process

func (*UnimplementedRouterServer) Watch

type UnimplementedTableServer

type UnimplementedTableServer struct {
}

UnimplementedTableServer can be embedded to have forward compatible implementations.

func (*UnimplementedTableServer) Create

func (*UnimplementedTableServer) Delete

func (*UnimplementedTableServer) List

func (*UnimplementedTableServer) Query

func (*UnimplementedTableServer) Update

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 added in v2.9.3

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 added in v2.9.3

func (x *WatchRequest) ProtoReflect() protoreflect.Message

func (*WatchRequest) Reset

func (x *WatchRequest) Reset()

func (*WatchRequest) String

func (x *WatchRequest) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL