network

package
v0.24.46 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2023 License: Apache-2.0 Imports: 51 Imported by: 7

Documentation

Index

Constants

View Source
const (
	CreateDecoder = "CreateDecoder"
	UpdateDecoder = "UpdateDecoder"
	DeleteDecoder = "DeleteDecoder"
)
View Source
const (
	DefaultOptionsCreateCircuitRetries      = 2
	DefaultOptionsCycleSeconds              = 60
	DefaultOptionsEnableLegacyLinkMgmt      = true
	DefaultOptionsInitialLinkLatency        = 65 * time.Second
	DefaultOptionsPendingLinkTimeout        = 10 * time.Second
	DefaultOptionsMetricsReportInterval     = time.Minute
	DefaultOptionsMinRouterCost             = 10
	DefaultOptionsRouterConnectChurnLimit   = time.Minute
	DefaultOptionsRouterMessagingMaxWorkers = 100
	DefaultOptionsRouterMessagingQueueSize  = 100
	DefaultOptionsRouteTimeout              = 10 * time.Second

	DefaultOptionsSmartRerouteCap          = 4
	DefaultOptionsSmartRerouteFraction     = 0.02
	DefaultOptionsSmartRerouteMinCostDelta = 15

	OptionsRouterCommMaxQueueSize = 1_000_000
	OptionsRouterCommMaxWorkers   = 10_000
)
View Source
const (
	RouterQuiesceFlag   uint32 = 1
	RouterDequiesceFlag uint32 = 2
)
View Source
const SmartRerouteAttempt = 99969996

Variables

View Source
var DbSnapshotTooFrequentError = dbSnapshotTooFrequentError{}

Functions

func DispatchCreate added in v0.18.0

func DispatchCreate[T models.Entity](c creator[T], entity T, ctx *change.Context) error

func DispatchUpdate added in v0.18.0

func DispatchUpdate[T models.Entity](u updater[T], entity T, updatedFields fields.UpdatedFields, ctx *change.Context) error

func RegisterCommand added in v0.18.0

func RegisterCommand[MT any, CT any, M CommandMsg[MT], C decodableCommand[CT, M]](managers *Managers, _ C, _ M)

RegisterCommand register a decoder for the given command and message pair MT is the message type (ex: cmd_pb.CreateServiceCommand) CT is the command type (ex: CreateServiceCommand) M is the CommandMsg/command.TypedMessage implementation (ex: *cmd_pb.CreateServiceCommand) C is the decodableCommand/command.Command implementation (ex: *CreateServiceCommand)

We only have both types specified so that we can enforce that each is a pointer type. If didn't enforce that the instances were pointer types, we couldn't use new to instantiate new instances.

func RegisterCreateDecoder added in v0.18.0

func RegisterCreateDecoder[T models.Entity](managers *Managers, creator command.EntityCreator[T])

func RegisterDeleteDecoder added in v0.18.0

func RegisterDeleteDecoder(managers *Managers, deleter command.EntityDeleter)

func RegisterManagerDecoder added in v0.18.0

func RegisterManagerDecoder[T models.Entity](managers *Managers, ctrl command.EntityManager[T])

func RegisterUpdateDecoder added in v0.18.0

func RegisterUpdateDecoder[T models.Entity](managers *Managers, updater command.EntityUpdater[T])

Types

type Cache

type Cache interface {
	RemoveFromCache(id string)
}

type Circuit

type Circuit struct {
	Id         string
	ClientId   string
	Service    *Service
	Terminator xt.CostedTerminator
	Path       *Path
	Tags       map[string]string
	Rerouting  atomic.Bool
	PeerData   xt.PeerData
	CreatedAt  time.Time
}

func (*Circuit) HasRouter added in v0.17.24

func (self *Circuit) HasRouter(routerId string) bool

type CircuitError added in v0.19.0

type CircuitError interface {
	error
	Cause() CircuitFailureCause
}

type CircuitFailureCause added in v0.19.0

type CircuitFailureCause string
const (
	CircuitFailureInvalidService                   CircuitFailureCause = "INVALID_SERVICE"
	CircuitFailureIdGenerationError                CircuitFailureCause = "ID_GENERATION_ERR"
	CircuitFailureNoTerminators                    CircuitFailureCause = "NO_TERMINATORS"
	CircuitFailureNoOnlineTerminators              CircuitFailureCause = "NO_ONLINE_TERMINATORS"
	CircuitFailureNoPath                           CircuitFailureCause = "NO_PATH"
	CircuitFailurePathMissingLink                  CircuitFailureCause = "PATH_MISSING_LINK"
	CircuitFailureInvalidStrategy                  CircuitFailureCause = "INVALID_STRATEGY"
	CircuitFailureStrategyError                    CircuitFailureCause = "STRATEGY_ERR"
	CircuitFailureRouterResponseTimeout            CircuitFailureCause = "ROUTER_RESPONSE_TIMEOUT"
	CircuitFailureRouterErrGeneric                 CircuitFailureCause = "ROUTER_ERR_GENERIC"
	CircuitFailureRouterErrInvalidTerminator       CircuitFailureCause = "ROUTER_ERR_INVALID_TERMINATOR"
	CircuitFailureRouterErrMisconfiguredTerminator CircuitFailureCause = "ROUTER_ERR_MISCONFIGURED_TERMINATOR"
	CircuitFailureRouterErrDialTimedOut            CircuitFailureCause = "ROUTER_ERR_DIAL_TIMED_OUT"
	CircuitFailureRouterErrDialConnRefused         CircuitFailureCause = "ROUTER_ERR_CONN_REFUSED"
)

type CommandManager added in v0.18.0

type CommandManager struct {
	*Managers
	Decoders command.Decoders
}

type CommandMsg added in v0.18.0

type CommandMsg[T any] interface {
	cmd_pb.TypedMessage
	*T
}

CommandMsg is a TypedMessage which is also a pointer type.

T is message type. We want to enforce that the TypeMessage implementation is a pointer type so we can use new(T) to create instances of it

type Config added in v0.18.0

type Config interface {
	GetId() *identity.TokenId
	GetMetricsRegistry() metrics.Registry
	GetOptions() *Options
	GetCommandDispatcher() command.Dispatcher
	GetDb() boltz.Db
	GetVersionProvider() versions.VersionProvider
	GetEventDispatcher() event.Dispatcher
	GetCloseNotify() <-chan struct{}
}

Config provides the values needed to create a Network instance

type Controller

type Controller[T models.Entity] interface {
	models.EntityRetriever[T]
	// contains filtered or unexported methods
}

type CreateCircuitParams added in v0.20.0

type CreateCircuitParams interface {
	GetServiceId() string
	GetSourceRouter() *Router
	GetClientId() *identity.TokenId
	GetCircuitTags(terminator xt.CostedTerminator) map[string]string
	GetLogContext() logcontext.Context
	GetDeadline() time.Time
}

type DeleteTerminatorsBatchCommand added in v0.22.76

type DeleteTerminatorsBatchCommand struct {
	Context *change.Context
	Manager *TerminatorManager
	Ids     []string
}

func (*DeleteTerminatorsBatchCommand) Apply added in v0.22.76

func (*DeleteTerminatorsBatchCommand) Decode added in v0.22.76

func (*DeleteTerminatorsBatchCommand) Encode added in v0.22.76

func (self *DeleteTerminatorsBatchCommand) Encode() ([]byte, error)

func (*DeleteTerminatorsBatchCommand) GetChangeContext added in v0.23.0

func (self *DeleteTerminatorsBatchCommand) GetChangeContext() *change.Context

type ForwardingFaultReport added in v0.15.24

type ForwardingFaultReport struct {
	R            *Router
	CircuitIds   []string
	UnknownOwner bool
}

type InspectResult added in v0.17.9

type InspectResult struct {
	Success bool
	Errors  []string
	Results []*InspectResultValue
}

type InspectResultValue added in v0.17.9

type InspectResultValue struct {
	AppId string
	Name  string
	Value string
}

type InspectionsManager added in v0.18.0

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

func NewInspectionsManager added in v0.18.0

func NewInspectionsManager(network *Network) *InspectionsManager

func (*InspectionsManager) Inspect added in v0.18.0

func (self *InspectionsManager) Inspect(appRegex string, values []string) *InspectResult

type InvalidCircuitError added in v0.16.92

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

func (InvalidCircuitError) Error added in v0.16.92

func (err InvalidCircuitError) Error() string
type Link struct {
	SrcLatency  int64
	DstLatency  int64
	Cost        int64
	Id          string
	Src         *Router
	Dst         *Router
	Protocol    string
	DialAddress string

	StaticCost int32
	// contains filtered or unexported fields
}

func (*Link) CurrentState

func (link *Link) CurrentState() *LinkState

func (*Link) GetCost added in v0.13.0

func (link *Link) GetCost() int64

func (*Link) GetDstLatency added in v0.13.0

func (link *Link) GetDstLatency() int64

func (*Link) GetId added in v0.17.0

func (link *Link) GetId() string

func (*Link) GetSrcLatency added in v0.13.0

func (link *Link) GetSrcLatency() int64

func (*Link) GetStaticCost added in v0.13.0

func (link *Link) GetStaticCost() int32

func (*Link) IsDown added in v0.16.134

func (link *Link) IsDown() bool

func (*Link) IsUsable added in v0.16.134

func (link *Link) IsUsable() bool

func (*Link) SetDown added in v0.16.134

func (link *Link) SetDown(down bool)

func (*Link) SetDstLatency added in v0.13.0

func (link *Link) SetDstLatency(latency int64)

func (*Link) SetSrcLatency added in v0.13.0

func (link *Link) SetSrcLatency(latency int64)

func (*Link) SetStaticCost added in v0.13.0

func (link *Link) SetStaticCost(cost int32)

type LinkMode

type LinkMode byte
const (
	Pending LinkMode = iota
	Connected
	Failed
	Duplicate
)

func (LinkMode) String

func (t LinkMode) String() string

type LinkState

type LinkState struct {
	Mode      LinkMode
	Timestamp int64
}

type Listener added in v0.17.60

type Listener interface {
	AdvertiseAddress() string
	Protocol() string
	Groups() []string
}

type Managers added in v0.18.0

type Managers struct {
	Terminators     *TerminatorManager
	Routers         *RouterManager
	Services        *ServiceManager
	Inspections     *InspectionsManager
	Command         *CommandManager
	Dispatcher      command.Dispatcher
	Registry        ioc.Registry
	RouterMessaging *RouterMessaging
	// contains filtered or unexported fields
}

func NewManagers added in v0.18.0

func NewManagers(network *Network, dispatcher command.Dispatcher, db boltz.Db, stores *db.Stores, routerCommPool goroutines.Pool) *Managers

func (*Managers) Dispatch added in v0.18.0

func (self *Managers) Dispatch(command command.Command) error

type Network

type Network struct {
	*Managers

	VersionProvider versions.VersionProvider
	// contains filtered or unexported fields
}

func NewNetwork

func NewNetwork(config Config) (*Network, error)

func (*Network) AcceptMetricsMsg added in v0.19.28

func (network *Network) AcceptMetricsMsg(metrics *metrics_pb.MetricsMessage)

func (*Network) AddCapability

func (network *Network) AddCapability(capability string)

func (*Network) AddRouterPresenceHandler

func (network *Network) AddRouterPresenceHandler(h RouterPresenceHandler)

func (*Network) AllConnectedRouters

func (network *Network) AllConnectedRouters() []*Router

func (*Network) CircuitEvent added in v0.17.45

func (network *Network) CircuitEvent(eventType event.CircuitEventType, circuit *Circuit, creationTimespan *time.Duration)

func (*Network) CircuitFailedEvent added in v0.19.0

func (network *Network) CircuitFailedEvent(
	circuitId string,
	params CreateCircuitParams,
	startTime time.Time,
	path *Path,
	t xt.CostedTerminator,
	cause CircuitFailureCause)

func (*Network) ConnectRouter

func (network *Network) ConnectRouter(r *Router)

func (*Network) ConnectedRouter

func (network *Network) ConnectedRouter(id string) bool

func (*Network) CreateCircuit

func (network *Network) CreateCircuit(params CreateCircuitParams) (*Circuit, error)

func (*Network) CreatePath added in v0.16.92

func (network *Network) CreatePath(srcR, dstR *Router) (*Path, error)

func (*Network) CreatePathWithNodes added in v0.16.92

func (network *Network) CreatePathWithNodes(nodes []*Router) (*Path, CircuitError)

func (*Network) DisconnectRouter

func (network *Network) DisconnectRouter(r *Router)

func (*Network) GetAllCircuits added in v0.16.92

func (network *Network) GetAllCircuits() []*Circuit
func (network *Network) GetAllLinks() []*Link

func (*Network) GetAllLinksForRouter

func (network *Network) GetAllLinksForRouter(routerId string) []*Link

func (*Network) GetAppId

func (network *Network) GetAppId() string

func (*Network) GetCapabilities

func (network *Network) GetCapabilities() []string

func (*Network) GetCircuit added in v0.16.92

func (network *Network) GetCircuit(circuitId string) (*Circuit, bool)

func (*Network) GetCloseNotify added in v0.24.0

func (network *Network) GetCloseNotify() <-chan struct{}

func (*Network) GetConnectedRouter

func (network *Network) GetConnectedRouter(routerId string) *Router

func (*Network) GetDb

func (network *Network) GetDb() boltz.Db

func (*Network) GetEventDispatcher added in v0.12.1

func (network *Network) GetEventDispatcher() event.Dispatcher
func (network *Network) GetLink(linkId string) (*Link, bool)

func (*Network) GetManagers added in v0.18.0

func (network *Network) GetManagers() *Managers

func (*Network) GetMetricsRegistry added in v0.12.3

func (network *Network) GetMetricsRegistry() metrics.Registry

func (*Network) GetOptions added in v0.15.18

func (network *Network) GetOptions() *Options

func (*Network) GetReloadedRouter added in v0.21.15

func (network *Network) GetReloadedRouter(routerId string) (*Router, error)

func (*Network) GetRouter

func (network *Network) GetRouter(routerId string) (*Router, error)

func (*Network) GetServiceEventsMetricsRegistry added in v0.16.41

func (network *Network) GetServiceEventsMetricsRegistry() metrics.UsageRegistry

func (*Network) GetStores

func (network *Network) GetStores() *db.Stores

func (*Network) GetTraceController

func (network *Network) GetTraceController() trace.Controller

func (*Network) InitServiceCounterDispatch added in v0.16.23

func (network *Network) InitServiceCounterDispatch(handler metrics.Handler)

func (*Network) Inspect added in v0.17.9

func (network *Network) Inspect(name string) (*string, error)

func (*Network) LinkChanged

func (network *Network) LinkChanged(l *Link)

func (*Network) LinkConnected

func (network *Network) LinkConnected(msg *ctrl_pb.LinkConnected) error

func (*Network) LinkFaulted added in v0.19.28

func (network *Network) LinkFaulted(id string, dupe bool) error
func (network *Network) NotifyExistingLink(id, linkProtocol, dialAddress string, srcRouter *Router, dstRouterId string) (bool, error)

func (*Network) NotifyLinkConnected added in v0.19.28

func (network *Network) NotifyLinkConnected(link *Link, msg *ctrl_pb.LinkConnected)

func (*Network) NotifyLinkEvent added in v0.19.28

func (network *Network) NotifyLinkEvent(link *Link, eventType event.LinkEventType)

func (*Network) NotifyLinkIdEvent added in v0.19.28

func (network *Network) NotifyLinkIdEvent(linkId string, eventType event.LinkEventType)

func (*Network) RemoveCircuit added in v0.16.92

func (network *Network) RemoveCircuit(circuitId string, now bool) error
func (network *Network) RemoveLink(linkId string)

func (*Network) ReportForwardingFaults added in v0.15.24

func (network *Network) ReportForwardingFaults(ffr *ForwardingFaultReport)

func (*Network) RestoreSnapshot added in v0.22.4

func (network *Network) RestoreSnapshot(cmd *command.SyncSnapshotCommand) error

func (*Network) RouteResult added in v0.16.0

func (network *Network) RouteResult(rs *RouteStatus) bool

func (*Network) RouterChanged

func (network *Network) RouterChanged(r *Router)

func (*Network) Run

func (network *Network) Run()

func (*Network) ServiceDialFail added in v0.16.23

func (network *Network) ServiceDialFail(serviceId, terminatorId string)

func (*Network) ServiceDialOtherError added in v0.16.23

func (network *Network) ServiceDialOtherError(serviceId string)

func (*Network) ServiceDialSuccess added in v0.16.23

func (network *Network) ServiceDialSuccess(serviceId, terminatorId string)

func (*Network) ServiceDialTimeout added in v0.16.23

func (network *Network) ServiceDialTimeout(serviceId, terminatorId string)

func (*Network) ServiceInvalidTerminator added in v0.17.76

func (network *Network) ServiceInvalidTerminator(serviceId, terminatorId string)

func (*Network) ServiceMisconfiguredTerminator added in v0.17.76

func (network *Network) ServiceMisconfiguredTerminator(serviceId, terminatorId string)

func (*Network) ServiceTerminatorConnectionRefused added in v0.17.76

func (network *Network) ServiceTerminatorConnectionRefused(serviceId, terminatorId string)

func (*Network) ServiceTerminatorTimeout added in v0.17.76

func (network *Network) ServiceTerminatorTimeout(serviceId, terminatorId string)

func (*Network) SnapshotDatabase added in v0.11.40

func (network *Network) SnapshotDatabase() error

func (*Network) SnapshotDatabaseToFile added in v0.24.29

func (network *Network) SnapshotDatabaseToFile(path string) (string, error)

func (*Network) SnapshotToRaft added in v0.19.48

func (network *Network) SnapshotToRaft() error

func (*Network) UpdatePath added in v0.16.92

func (network *Network) UpdatePath(path *Path) (*Path, error)

func (*Network) ValidateTerminators

func (network *Network) ValidateTerminators(r *Router)

func (*Network) VerifyLinkSource added in v0.16.128

func (network *Network) VerifyLinkSource(targetRouter *Router, linkId string, fingerprints []string) error

func (*Network) VerifyRouter added in v0.17.123

func (network *Network) VerifyRouter(routerId string, fingerprints []string) error

type Options

type Options struct {
	CreateCircuitRetries    uint32
	CycleSeconds            uint32
	EnableLegacyLinkMgmt    bool
	InitialLinkLatency      time.Duration
	IntervalAgeThreshold    time.Duration
	MetricsReportInterval   time.Duration
	MinRouterCost           uint16
	PendingLinkTimeout      time.Duration
	RouteTimeout            time.Duration
	RouterConnectChurnLimit time.Duration
	RouterComm              struct {
		QueueSize  uint32
		MaxWorkers uint32
	}
	Smart struct {
		RerouteFraction float32
		RerouteCap      uint32
		MinCostDelta    uint32
	}
}

func DefaultOptions

func DefaultOptions() *Options

func LoadOptions

func LoadOptions(src map[interface{}]interface{}) (*Options, error)

type Path added in v0.16.92

type Path struct {
	Nodes                []*Router
	Links                []*Link
	IngressId            string
	EgressId             string
	InitiatorLocalAddr   string
	InitiatorRemoteAddr  string
	TerminatorLocalAddr  string
	TerminatorRemoteAddr string
}

func (*Path) CreateRouteMessages added in v0.16.92

func (self *Path) CreateRouteMessages(attempt uint32, circuitId string, terminator xt.Terminator, deadline time.Time) []*ctrl_pb.Route

func (*Path) EgressRouter added in v0.16.92

func (self *Path) EgressRouter() *Router

func (*Path) EqualPath added in v0.16.92

func (self *Path) EqualPath(other *Path) bool

func (*Path) String added in v0.16.92

func (self *Path) String() string

type PathAndCost

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

type RouteStatus added in v0.17.76

type RouteStatus struct {
	Router    *Router
	CircuitId string
	Attempt   uint32
	Success   bool
	Err       string
	PeerData  xt.PeerData
	ErrorCode *byte
}

type Router

type Router struct {
	models.BaseEntity
	Name        string
	Fingerprint *string
	Listeners   []*ctrl_pb.Listener
	Control     channel.Channel
	Connected   atomic.Bool
	ConnectTime time.Time
	VersionInfo *versions.VersionInfo

	Cost        uint16
	NoTraversal bool
	Disabled    bool
	Metadata    *ctrl_pb.RouterMetadata
	// contains filtered or unexported fields
}

func NewRouter

func NewRouter(id, name, fingerprint string, cost uint16, noTraversal bool) *Router

func (*Router) AddLinkListener added in v0.17.60

func (entity *Router) AddLinkListener(addr, linkProtocol string, linkCostTags []string, groups []string)

func (*Router) HasCapability added in v0.24.0

func (entity *Router) HasCapability(capability ctrl_pb.RouterCapability) bool

func (*Router) SetLinkListeners added in v0.24.0

func (entity *Router) SetLinkListeners(listeners []*ctrl_pb.Listener)

func (*Router) SetMetadata added in v0.24.0

func (entity *Router) SetMetadata(metadata *ctrl_pb.RouterMetadata)
type RouterLinks struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func (*RouterLinks) Add added in v0.16.133

func (self *RouterLinks) Add(link *Link, other *Router)

func (*RouterLinks) Clear added in v0.16.133

func (self *RouterLinks) Clear()
func (self *RouterLinks) GetLinks() []*Link

func (*RouterLinks) GetLinksByRouter added in v0.16.134

func (self *RouterLinks) GetLinksByRouter() map[string][]*Link

func (*RouterLinks) Remove added in v0.16.133

func (self *RouterLinks) Remove(link *Link, other *Router)

type RouterManager added in v0.18.0

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

func (*RouterManager) ApplyCreate added in v0.18.0

func (self *RouterManager) ApplyCreate(cmd *command.CreateEntityCommand[*Router], ctx boltz.MutateContext) error

func (*RouterManager) ApplyDelete added in v0.18.0

func (self *RouterManager) ApplyDelete(cmd *command.DeleteEntityCommand, ctx boltz.MutateContext) error

func (*RouterManager) ApplyDequiesce added in v0.23.34

func (self *RouterManager) ApplyDequiesce(cmd *command.UpdateEntityCommand[*Router], ctx boltz.MutateContext) error

func (*RouterManager) ApplyQuiesce added in v0.23.34

func (self *RouterManager) ApplyQuiesce(cmd *command.UpdateEntityCommand[*Router], ctx boltz.MutateContext) error

func (*RouterManager) ApplyUpdate added in v0.18.0

func (self *RouterManager) ApplyUpdate(cmd *command.UpdateEntityCommand[*Router], ctx boltz.MutateContext) error

func (*RouterManager) BaseList added in v0.18.0

func (ctrl *RouterManager) BaseList(query string) (*models.EntityListResult[ME], error)

func (*RouterManager) BaseLoad added in v0.18.0

func (ctrl *RouterManager) BaseLoad(id string) (ME, error)

func (*RouterManager) BaseLoadInTx added in v0.18.0

func (ctrl *RouterManager) BaseLoadInTx(tx *bbolt.Tx, id string) (ME, error)

func (*RouterManager) BasePreparedList added in v0.18.0

func (ctrl *RouterManager) BasePreparedList(query ast.Query) (*models.EntityListResult[ME], error)

func (*RouterManager) Create added in v0.18.0

func (self *RouterManager) Create(entity *Router, ctx *change.Context) error

func (*RouterManager) Delete added in v0.18.0

func (self *RouterManager) Delete(id string, ctx *change.Context) error

func (*RouterManager) DequiesceRouter added in v0.23.34

func (self *RouterManager) DequiesceRouter(entity *Router, ctx *change.Context) error

DequiesceRouter returns all routers with a saved precedence that are in a failed state back to their saved state

func (*RouterManager) GetEntityTypeId added in v0.18.0

func (self *RouterManager) GetEntityTypeId() string

func (*RouterManager) HandleRouterDelete added in v0.18.0

func (self *RouterManager) HandleRouterDelete(id string)

func (*RouterManager) IsConnected added in v0.18.0

func (self *RouterManager) IsConnected(id string) bool

func (*RouterManager) ListWithHandler added in v0.19.30

func (ctrl *RouterManager) ListWithHandler(queryString string, resultHandler models.ListResultHandler) error

func (*RouterManager) Marshall added in v0.18.0

func (self *RouterManager) Marshall(entity *Router) ([]byte, error)

func (*RouterManager) PreparedListAssociatedWithHandler added in v0.19.30

func (ctrl *RouterManager) PreparedListAssociatedWithHandler(id string, association string, query ast.Query, handler models.ListResultHandler) error

func (*RouterManager) PreparedListWithHandler added in v0.19.30

func (ctrl *RouterManager) PreparedListWithHandler(query ast.Query, resultHandler models.ListResultHandler) error

func (*RouterManager) QuiesceRouter added in v0.23.34

func (self *RouterManager) QuiesceRouter(entity *Router, ctx *change.Context) error

QuiesceRouter marks all terminators on the router as failed, so that new traffic will avoid this router, if there's any alternative path

func (*RouterManager) Read added in v0.18.0

func (self *RouterManager) Read(id string) (entity *Router, err error)

func (*RouterManager) RemoveFromCache added in v0.18.0

func (self *RouterManager) RemoveFromCache(id string)

func (*RouterManager) Unmarshall added in v0.18.0

func (self *RouterManager) Unmarshall(bytes []byte) (*Router, error)

func (*RouterManager) Update added in v0.18.0

func (self *RouterManager) Update(entity *Router, updatedFields fields.UpdatedFields, ctx *change.Context) error

func (*RouterManager) UpdateCachedRouter added in v0.18.0

func (self *RouterManager) UpdateCachedRouter(id string)

func (*RouterManager) UpdateTerminators added in v0.23.34

func (self *RouterManager) UpdateTerminators(router *Router, ctx boltz.MutateContext, f func(terminator *db.Terminator) error) error

type RouterMessaging added in v0.24.0

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

func NewRouterMessaging added in v0.24.0

func NewRouterMessaging(managers *Managers, routerCommPool goroutines.Pool) *RouterMessaging

func (*RouterMessaging) RouterConnected added in v0.24.0

func (self *RouterMessaging) RouterConnected(r *Router)

func (*RouterMessaging) RouterDeleted added in v0.24.0

func (self *RouterMessaging) RouterDeleted(routerId string)

func (*RouterMessaging) RouterDisconnected added in v0.24.0

func (self *RouterMessaging) RouterDisconnected(r *Router)

type RouterPresenceHandler

type RouterPresenceHandler interface {
	RouterConnected(r *Router)
	RouterDisconnected(r *Router)
}

type RoutingTerminator

type RoutingTerminator struct {
	RouteCost uint32
	*Terminator
}

func (*RoutingTerminator) GetRouteCost

func (r *RoutingTerminator) GetRouteCost() uint32

type Service

type Service struct {
	models.BaseEntity
	Name               string
	TerminatorStrategy string
	Terminators        []*Terminator
}

func (*Service) GetName added in v0.18.0

func (self *Service) GetName() string

type ServiceCounters added in v0.16.23

type ServiceCounters interface {
	ServiceDialSuccess(serviceId, terminatorId string)
	ServiceDialFail(serviceId, terminatorId string)
	ServiceDialTimeout(serviceId, terminatorId string)
	ServiceDialOtherError(serviceId string)

	ServiceTerminatorTimeout(serviceId, terminatorId string)
	ServiceTerminatorConnectionRefused(serviceId, terminatorId string)
	ServiceInvalidTerminator(serviceId, terminatorId string)
	ServiceMisconfiguredTerminator(serviceId, terminatorId string)
}

type ServiceManager added in v0.18.0

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

func (*ServiceManager) ApplyCreate added in v0.18.0

func (*ServiceManager) ApplyDelete added in v0.18.0

func (self *ServiceManager) ApplyDelete(cmd *command.DeleteEntityCommand, ctx boltz.MutateContext) error

func (*ServiceManager) ApplyUpdate added in v0.18.0

func (*ServiceManager) BaseList added in v0.18.0

func (ctrl *ServiceManager) BaseList(query string) (*models.EntityListResult[ME], error)

func (*ServiceManager) BaseLoad added in v0.18.0

func (ctrl *ServiceManager) BaseLoad(id string) (ME, error)

func (*ServiceManager) BaseLoadInTx added in v0.18.0

func (ctrl *ServiceManager) BaseLoadInTx(tx *bbolt.Tx, id string) (ME, error)

func (*ServiceManager) BasePreparedList added in v0.18.0

func (ctrl *ServiceManager) BasePreparedList(query ast.Query) (*models.EntityListResult[ME], error)

func (*ServiceManager) Create added in v0.18.0

func (self *ServiceManager) Create(entity *Service, ctx *change.Context) error

func (*ServiceManager) Delete added in v0.18.0

func (self *ServiceManager) Delete(id string, ctx *change.Context) error

func (*ServiceManager) GetEntityTypeId added in v0.18.0

func (self *ServiceManager) GetEntityTypeId() string

func (*ServiceManager) GetIdForName added in v0.18.0

func (self *ServiceManager) GetIdForName(id string) (string, error)

func (*ServiceManager) ListWithHandler added in v0.19.30

func (ctrl *ServiceManager) ListWithHandler(queryString string, resultHandler models.ListResultHandler) error

func (*ServiceManager) Marshall added in v0.18.0

func (self *ServiceManager) Marshall(entity *Service) ([]byte, error)

func (*ServiceManager) NotifyTerminatorChanged added in v0.18.0

func (self *ServiceManager) NotifyTerminatorChanged(terminator *db.Terminator) *db.Terminator

func (*ServiceManager) PreparedListAssociatedWithHandler added in v0.19.30

func (ctrl *ServiceManager) PreparedListAssociatedWithHandler(id string, association string, query ast.Query, handler models.ListResultHandler) error

func (*ServiceManager) PreparedListWithHandler added in v0.19.30

func (ctrl *ServiceManager) PreparedListWithHandler(query ast.Query, resultHandler models.ListResultHandler) error

func (*ServiceManager) Read added in v0.18.0

func (self *ServiceManager) Read(id string) (entity *Service, err error)

func (*ServiceManager) RemoveFromCache added in v0.18.0

func (self *ServiceManager) RemoveFromCache(id string)

func (*ServiceManager) Unmarshall added in v0.18.0

func (self *ServiceManager) Unmarshall(bytes []byte) (*Service, error)

func (*ServiceManager) Update added in v0.18.0

func (self *ServiceManager) Update(entity *Service, updatedFields fields.UpdatedFields, ctx *change.Context) error

type Terminator

type Terminator struct {
	models.BaseEntity
	Service         string
	Router          string
	Binding         string
	Address         string
	InstanceId      string
	InstanceSecret  []byte
	Cost            uint16
	Precedence      xt.Precedence
	PeerData        map[uint32][]byte
	HostId          string
	SavedPrecedence xt.Precedence
}

func (*Terminator) GetAddress

func (entity *Terminator) GetAddress() string

func (*Terminator) GetBinding

func (entity *Terminator) GetBinding() string

func (*Terminator) GetCost

func (entity *Terminator) GetCost() uint16

func (*Terminator) GetHostId added in v0.20.0

func (entity *Terminator) GetHostId() string

func (*Terminator) GetInstanceId added in v0.19.0

func (entity *Terminator) GetInstanceId() string

func (*Terminator) GetInstanceSecret added in v0.19.0

func (entity *Terminator) GetInstanceSecret() []byte

func (*Terminator) GetPeerData

func (entity *Terminator) GetPeerData() xt.PeerData

func (*Terminator) GetPrecedence added in v0.13.0

func (entity *Terminator) GetPrecedence() xt.Precedence

func (*Terminator) GetRouterId

func (entity *Terminator) GetRouterId() string

func (*Terminator) GetServiceId

func (entity *Terminator) GetServiceId() string

type TerminatorListResult

type TerminatorListResult struct {
	Entities []*Terminator
	models.QueryMetaData
	// contains filtered or unexported fields
}

type TerminatorManager added in v0.18.0

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

func (*TerminatorManager) ApplyCreate added in v0.18.0

func (*TerminatorManager) ApplyDelete added in v0.18.0

func (self *TerminatorManager) ApplyDelete(cmd *command.DeleteEntityCommand, ctx boltz.MutateContext) error

func (*TerminatorManager) ApplyDeleteBatch added in v0.22.76

func (self *TerminatorManager) ApplyDeleteBatch(cmd *DeleteTerminatorsBatchCommand, ctx boltz.MutateContext) error

func (*TerminatorManager) ApplyUpdate added in v0.18.0

func (*TerminatorManager) BaseList added in v0.18.0

func (ctrl *TerminatorManager) BaseList(query string) (*models.EntityListResult[ME], error)

func (*TerminatorManager) BaseLoad added in v0.18.0

func (ctrl *TerminatorManager) BaseLoad(id string) (ME, error)

func (*TerminatorManager) BaseLoadInTx added in v0.18.0

func (ctrl *TerminatorManager) BaseLoadInTx(tx *bbolt.Tx, id string) (ME, error)

func (*TerminatorManager) BasePreparedList added in v0.18.0

func (ctrl *TerminatorManager) BasePreparedList(query ast.Query) (*models.EntityListResult[ME], error)

func (*TerminatorManager) Create added in v0.18.0

func (self *TerminatorManager) Create(entity *Terminator, ctx *change.Context) error

func (*TerminatorManager) Delete added in v0.18.0

func (self *TerminatorManager) Delete(id string, ctx *change.Context) error

func (*TerminatorManager) DeleteBatch added in v0.22.76

func (self *TerminatorManager) DeleteBatch(ids []string, ctx *change.Context) error

func (*TerminatorManager) GetEntityTypeId added in v0.18.0

func (self *TerminatorManager) GetEntityTypeId() string

func (*TerminatorManager) ListWithHandler added in v0.19.30

func (ctrl *TerminatorManager) ListWithHandler(queryString string, resultHandler models.ListResultHandler) error

func (*TerminatorManager) Marshall added in v0.18.0

func (self *TerminatorManager) Marshall(entity *Terminator) ([]byte, error)

func (*TerminatorManager) PreparedListAssociatedWithHandler added in v0.19.30

func (ctrl *TerminatorManager) PreparedListAssociatedWithHandler(id string, association string, query ast.Query, handler models.ListResultHandler) error

func (*TerminatorManager) PreparedListWithHandler added in v0.19.30

func (ctrl *TerminatorManager) PreparedListWithHandler(query ast.Query, resultHandler models.ListResultHandler) error

func (*TerminatorManager) Query added in v0.18.0

func (self *TerminatorManager) Query(query string) (*TerminatorListResult, error)

func (*TerminatorManager) Read added in v0.18.0

func (self *TerminatorManager) Read(id string) (entity *Terminator, err error)

func (*TerminatorManager) Unmarshall added in v0.18.0

func (self *TerminatorManager) Unmarshall(bytes []byte) (*Terminator, error)

func (*TerminatorManager) Update added in v0.18.0

func (self *TerminatorManager) Update(entity *Terminator, updatedFields fields.UpdatedFields, ctx *change.Context) error

Jump to

Keyboard shortcuts

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