router

package
v0.0.0-...-4310c52 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2020 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

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_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 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=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

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

func (EventType) Descriptor() protoreflect.EnumDescriptor

func (EventType) Enum

func (x EventType) Enum() *EventType

func (EventType) EnumDescriptor deprecated

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

Deprecated: Use EventType.Descriptor instead.

func (EventType) Number

func (x EventType) Number() protoreflect.EnumNumber

func (EventType) String

func (x EventType) String() string

func (EventType) Type

type LookupOptions

type LookupOptions struct {
	Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"`
	Gateway string `protobuf:"bytes,2,opt,name=gateway,proto3" json:"gateway,omitempty"`
	Network string `protobuf:"bytes,3,opt,name=network,proto3" json:"network,omitempty"`
	Router  string `protobuf:"bytes,4,opt,name=router,proto3" json:"router,omitempty"`
	Link    string `protobuf:"bytes,5,opt,name=link,proto3" json:"link,omitempty"`
	// contains filtered or unexported fields
}

LookupOptions are passed in a LookupRequest

func (*LookupOptions) Descriptor deprecated

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

Deprecated: Use LookupOptions.ProtoReflect.Descriptor instead.

func (*LookupOptions) GetAddress

func (x *LookupOptions) GetAddress() string

func (*LookupOptions) GetGateway

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

func (*LookupOptions) GetNetwork

func (x *LookupOptions) GetNetwork() string

func (*LookupOptions) GetRouter

func (x *LookupOptions) GetRouter() string

func (*LookupOptions) ProtoMessage

func (*LookupOptions) ProtoMessage()

func (*LookupOptions) ProtoReflect

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

func (*LookupOptions) Reset

func (x *LookupOptions) Reset()

func (*LookupOptions) String

func (x *LookupOptions) String() string

type LookupRequest

type LookupRequest struct {
	Service string         `protobuf:"bytes,1,opt,name=service,proto3" json:"service,omitempty"`
	Options *LookupOptions `protobuf:"bytes,2,opt,name=options,proto3" json:"options,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) GetOptions

func (x *LookupRequest) GetOptions() *LookupOptions

func (*LookupRequest) GetService

func (x *LookupRequest) GetService() string

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 ReadRequest

type ReadRequest struct {
	Service string `protobuf:"bytes,1,opt,name=service,proto3" json:"service,omitempty"`
	// contains filtered or unexported fields
}

Empty request

func (*ReadRequest) Descriptor deprecated

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

Deprecated: Use ReadRequest.ProtoReflect.Descriptor instead.

func (*ReadRequest) GetService

func (x *ReadRequest) GetService() string

func (*ReadRequest) ProtoMessage

func (*ReadRequest) ProtoMessage()

func (*ReadRequest) ProtoReflect

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

func (*ReadRequest) Reset

func (x *ReadRequest) Reset()

func (*ReadRequest) String

func (x *ReadRequest) String() string

type ReadResponse

type ReadResponse struct {
	Routes []*Route `protobuf:"bytes,1,rep,name=routes,proto3" json:"routes,omitempty"`
	// contains filtered or unexported fields
}

Empty response

func (*ReadResponse) Descriptor deprecated

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

Deprecated: Use ReadResponse.ProtoReflect.Descriptor instead.

func (*ReadResponse) GetRoutes

func (x *ReadResponse) GetRoutes() []*Route

func (*ReadResponse) ProtoMessage

func (*ReadResponse) ProtoMessage()

func (*ReadResponse) ProtoReflect

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

func (*ReadResponse) Reset

func (x *ReadResponse) Reset()

func (*ReadResponse) String

func (x *ReadResponse) 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"`
	// metadata for the route
	Metadata map[string]string `` /* 157-byte string literal not displayed */
	// 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) GetMetadata

func (x *Route) GetMetadata() map[string]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

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

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

type RouterServer interface {
	Lookup(context.Context, *LookupRequest) (*LookupResponse, error)
	Watch(*WatchRequest, Router_WatchServer) error
}

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

func NewRouterService

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

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)
	Read(ctx context.Context, in *ReadRequest, opts ...grpc.CallOption) (*ReadResponse, 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

type TableServer interface {
	Create(context.Context, *Route) (*CreateResponse, error)
	Delete(context.Context, *Route) (*DeleteResponse, error)
	Update(context.Context, *Route) (*UpdateResponse, error)
	Read(context.Context, *ReadRequest) (*ReadResponse, error)
}

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)
	Read(ctx context.Context, in *ReadRequest, opts ...client.CallOption) (*ReadResponse, 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) Lookup

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) Read

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

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

Jump to

Keyboard shortcuts

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