router

package
v3.0.0-...-9d75b9b Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2022 License: Apache-2.0 Imports: 8 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",
}
View Source
var EventType_value = map[string]int32{
	"Create": 0,
	"Delete": 1,
	"Update": 2,
}

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 {
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

CreateResponse is returned by Create

func (*CreateResponse) Descriptor

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

func (*CreateResponse) ProtoMessage

func (*CreateResponse) ProtoMessage()

func (*CreateResponse) Reset

func (m *CreateResponse) Reset()

func (*CreateResponse) String

func (m *CreateResponse) String() string

func (*CreateResponse) XXX_DiscardUnknown

func (m *CreateResponse) XXX_DiscardUnknown()

func (*CreateResponse) XXX_Marshal

func (m *CreateResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*CreateResponse) XXX_Merge

func (m *CreateResponse) XXX_Merge(src proto.Message)

func (*CreateResponse) XXX_Size

func (m *CreateResponse) XXX_Size() int

func (*CreateResponse) XXX_Unmarshal

func (m *CreateResponse) XXX_Unmarshal(b []byte) error

type DeleteResponse

type DeleteResponse struct {
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

DeleteResponse is returned by Delete

func (*DeleteResponse) Descriptor

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

func (*DeleteResponse) ProtoMessage

func (*DeleteResponse) ProtoMessage()

func (*DeleteResponse) Reset

func (m *DeleteResponse) Reset()

func (*DeleteResponse) String

func (m *DeleteResponse) String() string

func (*DeleteResponse) XXX_DiscardUnknown

func (m *DeleteResponse) XXX_DiscardUnknown()

func (*DeleteResponse) XXX_Marshal

func (m *DeleteResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*DeleteResponse) XXX_Merge

func (m *DeleteResponse) XXX_Merge(src proto.Message)

func (*DeleteResponse) XXX_Size

func (m *DeleteResponse) XXX_Size() int

func (*DeleteResponse) XXX_Unmarshal

func (m *DeleteResponse) XXX_Unmarshal(b []byte) error

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"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

Event is routing table event

func (*Event) Descriptor

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

func (*Event) GetId

func (m *Event) GetId() string

func (*Event) GetRoute

func (m *Event) GetRoute() *Route

func (*Event) GetTimestamp

func (m *Event) GetTimestamp() int64

func (*Event) GetType

func (m *Event) GetType() EventType

func (*Event) ProtoMessage

func (*Event) ProtoMessage()

func (*Event) Reset

func (m *Event) Reset()

func (*Event) String

func (m *Event) String() string

func (*Event) XXX_DiscardUnknown

func (m *Event) XXX_DiscardUnknown()

func (*Event) XXX_Marshal

func (m *Event) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Event) XXX_Merge

func (m *Event) XXX_Merge(src proto.Message)

func (*Event) XXX_Size

func (m *Event) XXX_Size() int

func (*Event) XXX_Unmarshal

func (m *Event) XXX_Unmarshal(b []byte) error

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

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

func (EventType) String

func (x EventType) String() string

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"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

LookupOptions are passed in a LookupRequest

func (*LookupOptions) Descriptor

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

func (*LookupOptions) GetAddress

func (m *LookupOptions) GetAddress() string

func (*LookupOptions) GetGateway

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

func (*LookupOptions) GetNetwork

func (m *LookupOptions) GetNetwork() string

func (*LookupOptions) GetRouter

func (m *LookupOptions) GetRouter() string

func (*LookupOptions) ProtoMessage

func (*LookupOptions) ProtoMessage()

func (*LookupOptions) Reset

func (m *LookupOptions) Reset()

func (*LookupOptions) String

func (m *LookupOptions) String() string

func (*LookupOptions) XXX_DiscardUnknown

func (m *LookupOptions) XXX_DiscardUnknown()

func (*LookupOptions) XXX_Marshal

func (m *LookupOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*LookupOptions) XXX_Merge

func (m *LookupOptions) XXX_Merge(src proto.Message)

func (*LookupOptions) XXX_Size

func (m *LookupOptions) XXX_Size() int

func (*LookupOptions) XXX_Unmarshal

func (m *LookupOptions) XXX_Unmarshal(b []byte) error

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"`
	XXX_NoUnkeyedLiteral struct{}       `json:"-"`
	XXX_unrecognized     []byte         `json:"-"`
	XXX_sizecache        int32          `json:"-"`
}

LookupRequest is made to Lookup

func (*LookupRequest) Descriptor

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

func (*LookupRequest) GetOptions

func (m *LookupRequest) GetOptions() *LookupOptions

func (*LookupRequest) GetService

func (m *LookupRequest) GetService() string

func (*LookupRequest) ProtoMessage

func (*LookupRequest) ProtoMessage()

func (*LookupRequest) Reset

func (m *LookupRequest) Reset()

func (*LookupRequest) String

func (m *LookupRequest) String() string

func (*LookupRequest) XXX_DiscardUnknown

func (m *LookupRequest) XXX_DiscardUnknown()

func (*LookupRequest) XXX_Marshal

func (m *LookupRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*LookupRequest) XXX_Merge

func (m *LookupRequest) XXX_Merge(src proto.Message)

func (*LookupRequest) XXX_Size

func (m *LookupRequest) XXX_Size() int

func (*LookupRequest) XXX_Unmarshal

func (m *LookupRequest) XXX_Unmarshal(b []byte) error

type LookupResponse

type LookupResponse 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:"-"`
}

LookupResponse is returned by Lookup

func (*LookupResponse) Descriptor

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

func (*LookupResponse) GetRoutes

func (m *LookupResponse) GetRoutes() []*Route

func (*LookupResponse) ProtoMessage

func (*LookupResponse) ProtoMessage()

func (*LookupResponse) Reset

func (m *LookupResponse) Reset()

func (*LookupResponse) String

func (m *LookupResponse) String() string

func (*LookupResponse) XXX_DiscardUnknown

func (m *LookupResponse) XXX_DiscardUnknown()

func (*LookupResponse) XXX_Marshal

func (m *LookupResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*LookupResponse) XXX_Merge

func (m *LookupResponse) XXX_Merge(src proto.Message)

func (*LookupResponse) XXX_Size

func (m *LookupResponse) XXX_Size() int

func (*LookupResponse) XXX_Unmarshal

func (m *LookupResponse) XXX_Unmarshal(b []byte) error

type ReadRequest

type ReadRequest struct {
	Service              string   `protobuf:"bytes,1,opt,name=service,proto3" json:"service,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

Empty request

func (*ReadRequest) Descriptor

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

func (*ReadRequest) GetService

func (m *ReadRequest) GetService() string

func (*ReadRequest) ProtoMessage

func (*ReadRequest) ProtoMessage()

func (*ReadRequest) Reset

func (m *ReadRequest) Reset()

func (*ReadRequest) String

func (m *ReadRequest) String() string

func (*ReadRequest) XXX_DiscardUnknown

func (m *ReadRequest) XXX_DiscardUnknown()

func (*ReadRequest) XXX_Marshal

func (m *ReadRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*ReadRequest) XXX_Merge

func (m *ReadRequest) XXX_Merge(src proto.Message)

func (*ReadRequest) XXX_Size

func (m *ReadRequest) XXX_Size() int

func (*ReadRequest) XXX_Unmarshal

func (m *ReadRequest) XXX_Unmarshal(b []byte) error

type ReadResponse

type ReadResponse 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:"-"`
}

Empty response

func (*ReadResponse) Descriptor

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

func (*ReadResponse) GetRoutes

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

func (*ReadResponse) ProtoMessage

func (*ReadResponse) ProtoMessage()

func (*ReadResponse) Reset

func (m *ReadResponse) Reset()

func (*ReadResponse) String

func (m *ReadResponse) String() string

func (*ReadResponse) XXX_DiscardUnknown

func (m *ReadResponse) XXX_DiscardUnknown()

func (*ReadResponse) XXX_Marshal

func (m *ReadResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*ReadResponse) XXX_Merge

func (m *ReadResponse) XXX_Merge(src proto.Message)

func (*ReadResponse) XXX_Size

func (m *ReadResponse) XXX_Size() int

func (*ReadResponse) XXX_Unmarshal

func (m *ReadResponse) XXX_Unmarshal(b []byte) error

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 */
	XXX_NoUnkeyedLiteral struct{}          `json:"-"`
	XXX_unrecognized     []byte            `json:"-"`
	XXX_sizecache        int32             `json:"-"`
}

Route is a service route

func (*Route) Descriptor

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

func (*Route) GetAddress

func (m *Route) GetAddress() string

func (*Route) GetGateway

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

func (*Route) GetMetadata

func (m *Route) GetMetadata() map[string]string

func (*Route) GetMetric

func (m *Route) GetMetric() int64

func (*Route) GetNetwork

func (m *Route) GetNetwork() string

func (*Route) GetRouter

func (m *Route) GetRouter() string

func (*Route) GetService

func (m *Route) GetService() string

func (*Route) ProtoMessage

func (*Route) ProtoMessage()

func (*Route) Reset

func (m *Route) Reset()

func (*Route) String

func (m *Route) String() string

func (*Route) XXX_DiscardUnknown

func (m *Route) XXX_DiscardUnknown()

func (*Route) XXX_Marshal

func (m *Route) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Route) XXX_Merge

func (m *Route) XXX_Merge(src proto.Message)

func (*Route) XXX_Size

func (m *Route) XXX_Size() int

func (*Route) XXX_Unmarshal

func (m *Route) XXX_Unmarshal(b []byte) error

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.ClientConn) 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.ClientConn) 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 UpdateResponse

type UpdateResponse struct {
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

UpdateResponse is returned by Update

func (*UpdateResponse) Descriptor

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

func (*UpdateResponse) ProtoMessage

func (*UpdateResponse) ProtoMessage()

func (*UpdateResponse) Reset

func (m *UpdateResponse) Reset()

func (*UpdateResponse) String

func (m *UpdateResponse) String() string

func (*UpdateResponse) XXX_DiscardUnknown

func (m *UpdateResponse) XXX_DiscardUnknown()

func (*UpdateResponse) XXX_Marshal

func (m *UpdateResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*UpdateResponse) XXX_Merge

func (m *UpdateResponse) XXX_Merge(src proto.Message)

func (*UpdateResponse) XXX_Size

func (m *UpdateResponse) XXX_Size() int

func (*UpdateResponse) XXX_Unmarshal

func (m *UpdateResponse) XXX_Unmarshal(b []byte) error

type WatchRequest

type WatchRequest struct {
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

WatchRequest is made to Watch Router

func (*WatchRequest) Descriptor

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

func (*WatchRequest) ProtoMessage

func (*WatchRequest) ProtoMessage()

func (*WatchRequest) Reset

func (m *WatchRequest) Reset()

func (*WatchRequest) String

func (m *WatchRequest) String() string

func (*WatchRequest) XXX_DiscardUnknown

func (m *WatchRequest) XXX_DiscardUnknown()

func (*WatchRequest) XXX_Marshal

func (m *WatchRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*WatchRequest) XXX_Merge

func (m *WatchRequest) XXX_Merge(src proto.Message)

func (*WatchRequest) XXX_Size

func (m *WatchRequest) XXX_Size() int

func (*WatchRequest) XXX_Unmarshal

func (m *WatchRequest) XXX_Unmarshal(b []byte) error

Jump to

Keyboard shortcuts

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