Documentation ¶
Index ¶
- Constants
- Variables
- func DispatchCreate[T models.Entity](c creator[T], entity T, ctx *change.Context) error
- func DispatchUpdate[T models.Entity](u updater[T], entity T, updatedFields fields.UpdatedFields, ...) error
- func IterateCMap[T any](m cmap.ConcurrentMap[string, T]) objectz.ObjectIterator[T]
- func RegisterCommand[MT any, CT any, M CommandMsg[MT], C decodableCommand[CT, M]](managers *Managers, _ C, _ M)
- func RegisterCreateDecoder[T models.Entity](managers *Managers, creator command.EntityCreator[T])
- func RegisterDeleteDecoder(managers *Managers, deleter command.EntityDeleter)
- func RegisterManagerDecoder[T models.Entity](managers *Managers, ctrl command.EntityManager[T])
- func RegisterUpdateDecoder[T models.Entity](managers *Managers, updater command.EntityUpdater[T])
- type Cache
- type Circuit
- func (self *Circuit) GetCreatedAt() time.Time
- func (self *Circuit) GetId() string
- func (self *Circuit) GetTags() map[string]interface{}
- func (self *Circuit) GetUpdatedAt() time.Time
- func (self *Circuit) HasRouter(routerId string) bool
- func (self *Circuit) IsEndpointRouter(routerId string) bool
- func (self *Circuit) IsSystemEntity() bool
- func (self *Circuit) SetId(string)
- type CircuitError
- type CircuitFailureCause
- type CommandManager
- type CommandMsg
- type Config
- type Controller
- type CreateCircuitParams
- type DbProvider
- type DeleteTerminatorsBatchCommand
- func (self *DeleteTerminatorsBatchCommand) Apply(ctx boltz.MutateContext) error
- func (self *DeleteTerminatorsBatchCommand) Decode(n *Network, msg *cmd_pb.DeleteTerminatorsBatchCommand) error
- func (self *DeleteTerminatorsBatchCommand) Encode() ([]byte, error)
- func (self *DeleteTerminatorsBatchCommand) GetChangeContext() *change.Context
- type ForwardingFaultReport
- type InspectResult
- type InspectResultValue
- type InspectionsManager
- type InvalidCircuitError
- type Link
- func (link *Link) CurrentState() *LinkState
- func (link *Link) GetCost() int64
- func (link *Link) GetDest() *Router
- func (link *Link) GetDstLatency() int64
- func (link *Link) GetId() string
- func (link *Link) GetSrcLatency() int64
- func (link *Link) GetStaticCost() int32
- func (link *Link) IsDown() bool
- func (link *Link) IsUsable() bool
- func (link *Link) SetDown(down bool)
- func (link *Link) SetDstLatency(latency int64)
- func (link *Link) SetSrcLatency(latency int64)
- func (link *Link) SetStaticCost(cost int32)
- type LinkMode
- type LinkState
- type LinkValidationCallback
- type Listener
- type Managers
- type Network
- func (network *Network) AcceptMetricsMsg(metrics *metrics_pb.MetricsMessage)
- func (network *Network) AddCapability(capability string)
- func (network *Network) AddRouterPresenceHandler(h RouterPresenceHandler)
- func (network *Network) AllConnectedRouters() []*Router
- func (network *Network) CircuitEvent(eventType event.CircuitEventType, circuit *Circuit, ...)
- func (network *Network) CircuitFailedEvent(circuitId string, params CreateCircuitParams, startTime time.Time, path *Path, ...)
- func (network *Network) ConnectRouter(r *Router)
- func (network *Network) ConnectedRouter(id string) bool
- func (network *Network) CreateCircuit(params CreateCircuitParams) (*Circuit, error)
- func (network *Network) CreatePath(srcR, dstR *Router) (*Path, error)
- func (network *Network) CreatePathWithNodes(nodes []*Router) (*Path, CircuitError)
- func (network *Network) DisconnectRouter(r *Router)
- func (network *Network) GetAllCircuits() []*Circuit
- func (network *Network) GetAllLinks() []*Link
- func (network *Network) GetAllLinksForRouter(routerId string) []*Link
- func (network *Network) GetAppId() string
- func (network *Network) GetCapabilities() []string
- func (network *Network) GetCircuit(circuitId string) (*Circuit, bool)
- func (network *Network) GetCircuitStore() *objectz.ObjectStore[*Circuit]
- func (network *Network) GetCloseNotify() <-chan struct{}
- func (network *Network) GetConnectedRouter(routerId string) *Router
- func (network *Network) GetDb() boltz.Db
- func (network *Network) GetEventDispatcher() event.Dispatcher
- func (network *Network) GetLink(linkId string) (*Link, bool)
- func (network *Network) GetLinkStore() *objectz.ObjectStore[*Link]
- func (network *Network) GetManagers() *Managers
- func (network *Network) GetMetricsRegistry() metrics.Registry
- func (network *Network) GetOptions() *Options
- func (network *Network) GetReloadedRouter(routerId string) (*Router, error)
- func (network *Network) GetRouter(routerId string) (*Router, error)
- func (network *Network) GetServiceEventsMetricsRegistry() metrics.UsageRegistry
- func (network *Network) GetStores() *db.Stores
- func (network *Network) GetTraceController() trace.Controller
- func (network *Network) InitServiceCounterDispatch(handler metrics.Handler)
- func (network *Network) Inspect(name string) (*string, error)
- func (network *Network) LinkChanged(l *Link)
- func (network *Network) LinkConnected(msg *ctrl_pb.LinkConnected) error
- func (network *Network) LinkFaulted(l *Link, dupe bool) error
- func (network *Network) NotifyExistingLink(id string, iteration uint32, linkProtocol, dialAddress string, ...)
- func (network *Network) NotifyLinkConnected(link *Link, msg *ctrl_pb.LinkConnected)
- func (network *Network) NotifyLinkEvent(link *Link, eventType event.LinkEventType)
- func (network *Network) NotifyLinkIdEvent(linkId string, eventType event.LinkEventType)
- func (network *Network) RemoveCircuit(circuitId string, now bool) error
- func (network *Network) RemoveLink(linkId string)
- func (network *Network) ReportForwardingFaults(ffr *ForwardingFaultReport)
- func (network *Network) RestoreSnapshot(cmd *command.SyncSnapshotCommand) error
- func (network *Network) RouteResult(rs *RouteStatus) bool
- func (network *Network) Run()
- func (network *Network) ServiceDialFail(serviceId, terminatorId string)
- func (network *Network) ServiceDialOtherError(serviceId string)
- func (network *Network) ServiceDialSuccess(serviceId, terminatorId string)
- func (network *Network) ServiceDialTimeout(serviceId, terminatorId string)
- func (network *Network) ServiceInvalidTerminator(serviceId, terminatorId string)
- func (network *Network) ServiceMisconfiguredTerminator(serviceId, terminatorId string)
- func (network *Network) ServiceTerminatorConnectionRefused(serviceId, terminatorId string)
- func (network *Network) ServiceTerminatorTimeout(serviceId, terminatorId string)
- func (network *Network) SnapshotDatabase() error
- func (network *Network) SnapshotDatabaseToFile(path string) (string, error)
- func (network *Network) SnapshotToRaft() error
- func (network *Network) UpdatePath(path *Path) (*Path, error)
- func (n *Network) ValidateLinks(filter string, cb LinkValidationCallback) (int64, func(), error)
- func (n *Network) ValidateRouterSdkTerminators(filter string, cb SdkTerminatorValidationCallback) (int64, func(), error)
- func (network *Network) ValidateTerminators(r *Router)
- func (network *Network) VerifyRouter(routerId string, fingerprints []string) error
- type Options
- type Path
- type PathAndCost
- type RouteStatus
- type Router
- func (entity *Router) AddLinkListener(addr, linkProtocol string, linkCostTags []string, groups []string)
- func (entity *Router) HasCapability(capability ctrl_pb.RouterCapability) bool
- func (entity *Router) SetLinkListeners(listeners []*ctrl_pb.Listener)
- func (entity *Router) SetMetadata(metadata *ctrl_pb.RouterMetadata)
- type RouterLinks
- type RouterManager
- func (self *RouterManager) ApplyCreate(cmd *command.CreateEntityCommand[*Router], ctx boltz.MutateContext) error
- func (self *RouterManager) ApplyDelete(cmd *command.DeleteEntityCommand, ctx boltz.MutateContext) error
- func (self *RouterManager) ApplyDequiesce(cmd *command.UpdateEntityCommand[*Router], ctx boltz.MutateContext) error
- func (self *RouterManager) ApplyQuiesce(cmd *command.UpdateEntityCommand[*Router], ctx boltz.MutateContext) error
- func (self *RouterManager) ApplyUpdate(cmd *command.UpdateEntityCommand[*Router], ctx boltz.MutateContext) error
- func (ctrl *RouterManager) BaseList(query string) (*models.EntityListResult[ME], error)
- func (ctrl *RouterManager) BaseLoad(id string) (ME, error)
- func (ctrl *RouterManager) BaseLoadInTx(tx *bbolt.Tx, id string) (ME, error)
- func (ctrl *RouterManager) BasePreparedList(query ast.Query) (*models.EntityListResult[ME], error)
- func (self *RouterManager) Create(entity *Router, ctx *change.Context) error
- func (self *RouterManager) Delete(id string, ctx *change.Context) error
- func (self *RouterManager) DequiesceRouter(entity *Router, ctx *change.Context) error
- func (self *RouterManager) Exists(id string) (bool, error)
- func (self *RouterManager) GetEntityTypeId() string
- func (self *RouterManager) HandleRouterDelete(id string)
- func (self *RouterManager) IsConnected(id string) bool
- func (ctrl *RouterManager) ListWithHandler(queryString string, resultHandler models.ListResultHandler) error
- func (self *RouterManager) Marshall(entity *Router) ([]byte, error)
- func (ctrl *RouterManager) PreparedListAssociatedWithHandler(id string, association string, query ast.Query, ...) error
- func (ctrl *RouterManager) PreparedListWithHandler(query ast.Query, resultHandler models.ListResultHandler) error
- func (self *RouterManager) QuiesceRouter(entity *Router, ctx *change.Context) error
- func (self *RouterManager) Read(id string) (entity *Router, err error)
- func (self *RouterManager) RemoveFromCache(id string)
- func (self *RouterManager) Unmarshall(bytes []byte) (*Router, error)
- func (self *RouterManager) Update(entity *Router, updatedFields fields.UpdatedFields, ctx *change.Context) error
- func (self *RouterManager) UpdateCachedRouter(id string)
- func (self *RouterManager) UpdateTerminators(router *Router, ctx boltz.MutateContext, ...) error
- func (self *RouterManager) ValidateRouterSdkTerminators(router *Router, cb SdkTerminatorValidationCallback)
- type RouterMessaging
- func (self *RouterMessaging) Inspect() (*inspect.RouterMessagingState, error)
- func (self *RouterMessaging) NewValidationResponseHandler(n *Network, r *Router) channel.ReceiveHandlerF
- func (self *RouterMessaging) RouterConnected(r *Router)
- func (self *RouterMessaging) RouterDeleted(routerId string)
- func (self *RouterMessaging) RouterDisconnected(r *Router)
- func (self *RouterMessaging) TerminatorCreated(terminator *db.Terminator)
- func (self *RouterMessaging) ValidateRouterTerminators(terminators []*Terminator)
- type RouterPresenceHandler
- type RoutingTerminator
- type SdkTerminatorValidationCallback
- type Service
- type ServiceCounters
- type ServiceManager
- func (self *ServiceManager) ApplyCreate(cmd *command.CreateEntityCommand[*Service], ctx boltz.MutateContext) error
- func (self *ServiceManager) ApplyDelete(cmd *command.DeleteEntityCommand, ctx boltz.MutateContext) error
- func (self *ServiceManager) ApplyUpdate(cmd *command.UpdateEntityCommand[*Service], ctx boltz.MutateContext) error
- func (ctrl *ServiceManager) BaseList(query string) (*models.EntityListResult[ME], error)
- func (ctrl *ServiceManager) BaseLoad(id string) (ME, error)
- func (ctrl *ServiceManager) BaseLoadInTx(tx *bbolt.Tx, id string) (ME, error)
- func (ctrl *ServiceManager) BasePreparedList(query ast.Query) (*models.EntityListResult[ME], error)
- func (self *ServiceManager) Create(entity *Service, ctx *change.Context) error
- func (self *ServiceManager) Delete(id string, ctx *change.Context) error
- func (self *ServiceManager) GetEntityTypeId() string
- func (self *ServiceManager) GetIdForName(id string) (string, error)
- func (ctrl *ServiceManager) ListWithHandler(queryString string, resultHandler models.ListResultHandler) error
- func (self *ServiceManager) Marshall(entity *Service) ([]byte, error)
- func (self *ServiceManager) NotifyTerminatorChanged(terminator *db.Terminator) *db.Terminator
- func (ctrl *ServiceManager) PreparedListAssociatedWithHandler(id string, association string, query ast.Query, ...) error
- func (ctrl *ServiceManager) PreparedListWithHandler(query ast.Query, resultHandler models.ListResultHandler) error
- func (self *ServiceManager) Read(id string) (entity *Service, err error)
- func (self *ServiceManager) RemoveFromCache(id string)
- func (self *ServiceManager) Unmarshall(bytes []byte) (*Service, error)
- func (self *ServiceManager) Update(entity *Service, updatedFields fields.UpdatedFields, ctx *change.Context) error
- type Terminator
- func (entity *Terminator) GetAddress() string
- func (entity *Terminator) GetBinding() string
- func (entity *Terminator) GetCost() uint16
- func (entity *Terminator) GetHostId() string
- func (entity *Terminator) GetInstanceId() string
- func (entity *Terminator) GetInstanceSecret() []byte
- func (entity *Terminator) GetPeerData() xt.PeerData
- func (entity *Terminator) GetPrecedence() xt.Precedence
- func (entity *Terminator) GetRouterId() string
- func (entity *Terminator) GetServiceId() string
- type TerminatorListResult
- type TerminatorManager
- func (self *TerminatorManager) ApplyCreate(cmd *command.CreateEntityCommand[*Terminator], ctx boltz.MutateContext) error
- func (self *TerminatorManager) ApplyDelete(cmd *command.DeleteEntityCommand, ctx boltz.MutateContext) error
- func (self *TerminatorManager) ApplyDeleteBatch(cmd *DeleteTerminatorsBatchCommand, ctx boltz.MutateContext) error
- func (self *TerminatorManager) ApplyUpdate(cmd *command.UpdateEntityCommand[*Terminator], ctx boltz.MutateContext) error
- func (ctrl *TerminatorManager) BaseList(query string) (*models.EntityListResult[ME], error)
- func (ctrl *TerminatorManager) BaseLoad(id string) (ME, error)
- func (ctrl *TerminatorManager) BaseLoadInTx(tx *bbolt.Tx, id string) (ME, error)
- func (ctrl *TerminatorManager) BasePreparedList(query ast.Query) (*models.EntityListResult[ME], error)
- func (self *TerminatorManager) Create(entity *Terminator, ctx *change.Context) error
- func (self *TerminatorManager) Delete(id string, ctx *change.Context) error
- func (self *TerminatorManager) DeleteBatch(ids []string, ctx *change.Context) error
- func (self *TerminatorManager) GetEntityTypeId() string
- func (ctrl *TerminatorManager) ListWithHandler(queryString string, resultHandler models.ListResultHandler) error
- func (self *TerminatorManager) Marshall(entity *Terminator) ([]byte, error)
- func (ctrl *TerminatorManager) PreparedListAssociatedWithHandler(id string, association string, query ast.Query, ...) error
- func (ctrl *TerminatorManager) PreparedListWithHandler(query ast.Query, resultHandler models.ListResultHandler) error
- func (self *TerminatorManager) Query(query string) (*TerminatorListResult, error)
- func (self *TerminatorManager) Read(id string) (entity *Terminator, err error)
- func (self *TerminatorManager) Unmarshall(bytes []byte) (*Terminator, error)
- func (self *TerminatorManager) Update(entity *Terminator, updatedFields fields.UpdatedFields, ctx *change.Context) error
- func (self *TerminatorManager) ValidateTerminators(filter string, fixInvalid bool, cb TerminatorValidationCallback) (uint64, error)
- type TerminatorValidationCallback
- type ValidateTerminatorRequestSendable
- func (self *ValidateTerminatorRequestSendable) AcceptReply(message *channel.Message)
- func (self *ValidateTerminatorRequestSendable) Context() context.Context
- func (self *ValidateTerminatorRequestSendable) ReplyReceiver() channel.ReplyReceiver
- func (self *ValidateTerminatorRequestSendable) SendListener() channel.SendListener
Constants ¶
const ( CreateDecoder = "CreateDecoder" UpdateDecoder = "UpdateDecoder" DeleteDecoder = "DeleteDecoder" )
const ( DefaultOptionsCreateCircuitRetries = 2 DefaultOptionsCycleSeconds = 60 DefaultOptionsEnableLegacyLinkMgmt = false 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 )
const ( RouterQuiesceFlag uint32 = 1 RouterDequiesceFlag uint32 = 2 )
const SmartRerouteAttempt = 99969996
Variables ¶
var DbSnapshotTooFrequentError = dbSnapshotTooFrequentError{}
Functions ¶
func DispatchCreate ¶
func DispatchUpdate ¶
func IterateCMap ¶ added in v0.31.1
func IterateCMap[T any](m cmap.ConcurrentMap[string, T]) objectz.ObjectIterator[T]
func RegisterCommand ¶
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 ¶
func RegisterCreateDecoder[T models.Entity](managers *Managers, creator command.EntityCreator[T])
func RegisterDeleteDecoder ¶
func RegisterDeleteDecoder(managers *Managers, deleter command.EntityDeleter)
func RegisterManagerDecoder ¶
func RegisterManagerDecoder[T models.Entity](managers *Managers, ctrl command.EntityManager[T])
func RegisterUpdateDecoder ¶
func RegisterUpdateDecoder[T models.Entity](managers *Managers, updater command.EntityUpdater[T])
Types ¶
type Circuit ¶
type Circuit struct { Id string ClientId string ServiceId string Terminator xt.CostedTerminator Path *Path Tags map[string]string Rerouting atomic.Bool PeerData xt.PeerData CreatedAt time.Time UpdatedAt time.Time }
func (*Circuit) GetCreatedAt ¶ added in v0.31.1
func (*Circuit) GetUpdatedAt ¶ added in v0.31.1
func (*Circuit) IsEndpointRouter ¶ added in v0.31.3
func (*Circuit) IsSystemEntity ¶ added in v0.31.1
type CircuitError ¶
type CircuitError interface { error Cause() CircuitFailureCause }
type CircuitFailureCause ¶
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 ¶
type CommandMsg ¶
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 ¶
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 ¶
type DbProvider ¶ added in v0.31.1
type DeleteTerminatorsBatchCommand ¶
type DeleteTerminatorsBatchCommand struct { Context *change.Context Manager *TerminatorManager Ids []string }
func (*DeleteTerminatorsBatchCommand) Apply ¶
func (self *DeleteTerminatorsBatchCommand) Apply(ctx boltz.MutateContext) error
func (*DeleteTerminatorsBatchCommand) Decode ¶
func (self *DeleteTerminatorsBatchCommand) Decode(n *Network, msg *cmd_pb.DeleteTerminatorsBatchCommand) error
func (*DeleteTerminatorsBatchCommand) Encode ¶
func (self *DeleteTerminatorsBatchCommand) Encode() ([]byte, error)
func (*DeleteTerminatorsBatchCommand) GetChangeContext ¶
func (self *DeleteTerminatorsBatchCommand) GetChangeContext() *change.Context
type ForwardingFaultReport ¶
type InspectResult ¶
type InspectResult struct { Success bool Errors []string Results []*InspectResultValue }
type InspectResultValue ¶
type InspectionsManager ¶
type InspectionsManager struct {
// contains filtered or unexported fields
}
func NewInspectionsManager ¶
func NewInspectionsManager(network *Network) *InspectionsManager
func (*InspectionsManager) Inspect ¶
func (self *InspectionsManager) Inspect(appRegex string, values []string) *InspectResult
type InvalidCircuitError ¶
type InvalidCircuitError struct {
// contains filtered or unexported fields
}
func (InvalidCircuitError) Error ¶
func (err InvalidCircuitError) Error() string
type Link ¶
type Link struct { SrcLatency int64 DstLatency int64 Cost int64 Id string Iteration uint32 Src *Router DstId string Dst concurrenz.AtomicValue[*Router] Protocol string DialAddress string StaticCost int32 // contains filtered or unexported fields }
func (*Link) CurrentState ¶
func (*Link) GetDstLatency ¶
func (*Link) GetSrcLatency ¶
func (*Link) GetStaticCost ¶
func (*Link) SetDstLatency ¶
func (*Link) SetSrcLatency ¶
func (*Link) SetStaticCost ¶
type LinkValidationCallback ¶ added in v0.32.0
type LinkValidationCallback func(detail *mgmt_pb.RouterLinkDetails)
type Managers ¶
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 ¶
func NewManagers(network *Network, dispatcher command.Dispatcher, db boltz.Db, stores *db.Stores, routerCommPool goroutines.Pool) *Managers
type Network ¶
type Network struct { *Managers VersionProvider versions.VersionProvider // contains filtered or unexported fields }
func NewNetwork ¶
func (*Network) AcceptMetricsMsg ¶
func (network *Network) AcceptMetricsMsg(metrics *metrics_pb.MetricsMessage)
func (*Network) AddCapability ¶
func (*Network) AddRouterPresenceHandler ¶
func (network *Network) AddRouterPresenceHandler(h RouterPresenceHandler)
func (*Network) AllConnectedRouters ¶
func (*Network) CircuitEvent ¶
func (*Network) CircuitFailedEvent ¶
func (network *Network) CircuitFailedEvent( circuitId string, params CreateCircuitParams, startTime time.Time, path *Path, t xt.CostedTerminator, cause CircuitFailureCause)
func (*Network) ConnectRouter ¶
func (*Network) ConnectedRouter ¶
func (*Network) CreateCircuit ¶
func (network *Network) CreateCircuit(params CreateCircuitParams) (*Circuit, error)
func (*Network) CreatePathWithNodes ¶
func (network *Network) CreatePathWithNodes(nodes []*Router) (*Path, CircuitError)
func (*Network) DisconnectRouter ¶
func (*Network) GetAllCircuits ¶
func (*Network) GetAllLinks ¶
func (*Network) GetAllLinksForRouter ¶
func (*Network) GetCapabilities ¶
func (*Network) GetCircuitStore ¶ added in v0.31.1
func (network *Network) GetCircuitStore() *objectz.ObjectStore[*Circuit]
func (*Network) GetCloseNotify ¶
func (network *Network) GetCloseNotify() <-chan struct{}
func (*Network) GetConnectedRouter ¶
func (*Network) GetEventDispatcher ¶
func (network *Network) GetEventDispatcher() event.Dispatcher
func (*Network) GetLinkStore ¶ added in v0.31.1
func (network *Network) GetLinkStore() *objectz.ObjectStore[*Link]
func (*Network) GetManagers ¶
func (*Network) GetMetricsRegistry ¶
func (*Network) GetOptions ¶
func (*Network) GetReloadedRouter ¶
func (*Network) GetServiceEventsMetricsRegistry ¶
func (network *Network) GetServiceEventsMetricsRegistry() metrics.UsageRegistry
func (*Network) GetTraceController ¶
func (network *Network) GetTraceController() trace.Controller
func (*Network) InitServiceCounterDispatch ¶
func (*Network) LinkChanged ¶
func (*Network) LinkConnected ¶
func (network *Network) LinkConnected(msg *ctrl_pb.LinkConnected) error
func (*Network) NotifyExistingLink ¶
func (*Network) NotifyLinkConnected ¶
func (network *Network) NotifyLinkConnected(link *Link, msg *ctrl_pb.LinkConnected)
func (*Network) NotifyLinkEvent ¶
func (network *Network) NotifyLinkEvent(link *Link, eventType event.LinkEventType)
func (*Network) NotifyLinkIdEvent ¶
func (network *Network) NotifyLinkIdEvent(linkId string, eventType event.LinkEventType)
func (*Network) RemoveCircuit ¶
func (*Network) RemoveLink ¶
func (*Network) ReportForwardingFaults ¶
func (network *Network) ReportForwardingFaults(ffr *ForwardingFaultReport)
func (*Network) RestoreSnapshot ¶
func (network *Network) RestoreSnapshot(cmd *command.SyncSnapshotCommand) error
func (*Network) RouteResult ¶
func (network *Network) RouteResult(rs *RouteStatus) bool
func (*Network) ServiceDialFail ¶
func (*Network) ServiceDialOtherError ¶
func (*Network) ServiceDialSuccess ¶
func (*Network) ServiceDialTimeout ¶
func (*Network) ServiceInvalidTerminator ¶
func (*Network) ServiceMisconfiguredTerminator ¶
func (*Network) ServiceTerminatorConnectionRefused ¶
func (*Network) ServiceTerminatorTimeout ¶
func (*Network) SnapshotDatabase ¶
func (*Network) SnapshotDatabaseToFile ¶
func (*Network) SnapshotToRaft ¶
func (*Network) ValidateLinks ¶ added in v0.32.0
func (n *Network) ValidateLinks(filter string, cb LinkValidationCallback) (int64, func(), error)
func (*Network) ValidateRouterSdkTerminators ¶ added in v0.33.0
func (n *Network) ValidateRouterSdkTerminators(filter string, cb SdkTerminatorValidationCallback) (int64, func(), error)
func (*Network) ValidateTerminators ¶
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 ¶
type Path ¶
type Path struct { Nodes []*Router Links []*Link IngressId string EgressId string InitiatorLocalAddr string InitiatorRemoteAddr string TerminatorLocalAddr string TerminatorRemoteAddr string }
func (*Path) CreateRouteMessages ¶
func (*Path) EgressRouter ¶
type PathAndCost ¶
type PathAndCost struct {
// contains filtered or unexported fields
}
type RouteStatus ¶
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 (*Router) AddLinkListener ¶
func (*Router) HasCapability ¶
func (entity *Router) HasCapability(capability ctrl_pb.RouterCapability) bool
func (*Router) SetLinkListeners ¶
func (*Router) SetMetadata ¶
func (entity *Router) SetMetadata(metadata *ctrl_pb.RouterMetadata)
type RouterLinks ¶
func (*RouterLinks) Add ¶
func (self *RouterLinks) Add(link *Link, otherRouterId string)
func (*RouterLinks) Clear ¶
func (self *RouterLinks) Clear()
func (*RouterLinks) GetLinks ¶
func (self *RouterLinks) GetLinks() []*Link
func (*RouterLinks) GetLinksByRouter ¶
func (self *RouterLinks) GetLinksByRouter() map[string][]*Link
func (*RouterLinks) Remove ¶
func (self *RouterLinks) Remove(link *Link, otherRouterId string)
type RouterManager ¶
type RouterManager struct {
// contains filtered or unexported fields
}
func (*RouterManager) ApplyCreate ¶
func (self *RouterManager) ApplyCreate(cmd *command.CreateEntityCommand[*Router], ctx boltz.MutateContext) error
func (*RouterManager) ApplyDelete ¶
func (self *RouterManager) ApplyDelete(cmd *command.DeleteEntityCommand, ctx boltz.MutateContext) error
func (*RouterManager) ApplyDequiesce ¶
func (self *RouterManager) ApplyDequiesce(cmd *command.UpdateEntityCommand[*Router], ctx boltz.MutateContext) error
func (*RouterManager) ApplyQuiesce ¶
func (self *RouterManager) ApplyQuiesce(cmd *command.UpdateEntityCommand[*Router], ctx boltz.MutateContext) error
func (*RouterManager) ApplyUpdate ¶
func (self *RouterManager) ApplyUpdate(cmd *command.UpdateEntityCommand[*Router], ctx boltz.MutateContext) error
func (*RouterManager) BaseList ¶
func (ctrl *RouterManager) BaseList(query string) (*models.EntityListResult[ME], error)
func (*RouterManager) BaseLoadInTx ¶
func (*RouterManager) BasePreparedList ¶
func (ctrl *RouterManager) BasePreparedList(query ast.Query) (*models.EntityListResult[ME], error)
func (*RouterManager) Create ¶
func (self *RouterManager) Create(entity *Router, ctx *change.Context) error
func (*RouterManager) DequiesceRouter ¶
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) Exists ¶ added in v0.32.1
func (self *RouterManager) Exists(id string) (bool, error)
func (*RouterManager) GetEntityTypeId ¶
func (self *RouterManager) GetEntityTypeId() string
func (*RouterManager) HandleRouterDelete ¶
func (self *RouterManager) HandleRouterDelete(id string)
func (*RouterManager) IsConnected ¶
func (self *RouterManager) IsConnected(id string) bool
func (*RouterManager) ListWithHandler ¶
func (ctrl *RouterManager) ListWithHandler(queryString string, resultHandler models.ListResultHandler) error
func (*RouterManager) Marshall ¶
func (self *RouterManager) Marshall(entity *Router) ([]byte, error)
func (*RouterManager) PreparedListAssociatedWithHandler ¶
func (*RouterManager) PreparedListWithHandler ¶
func (ctrl *RouterManager) PreparedListWithHandler(query ast.Query, resultHandler models.ListResultHandler) error
func (*RouterManager) QuiesceRouter ¶
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) RemoveFromCache ¶
func (self *RouterManager) RemoveFromCache(id string)
func (*RouterManager) Unmarshall ¶
func (self *RouterManager) Unmarshall(bytes []byte) (*Router, error)
func (*RouterManager) Update ¶
func (self *RouterManager) Update(entity *Router, updatedFields fields.UpdatedFields, ctx *change.Context) error
func (*RouterManager) UpdateCachedRouter ¶
func (self *RouterManager) UpdateCachedRouter(id string)
func (*RouterManager) UpdateTerminators ¶
func (self *RouterManager) UpdateTerminators(router *Router, ctx boltz.MutateContext, f func(terminator *db.Terminator) error) error
func (*RouterManager) ValidateRouterSdkTerminators ¶ added in v0.33.0
func (self *RouterManager) ValidateRouterSdkTerminators(router *Router, cb SdkTerminatorValidationCallback)
type RouterMessaging ¶
type RouterMessaging struct {
// contains filtered or unexported fields
}
func NewRouterMessaging ¶
func NewRouterMessaging(managers *Managers, routerCommPool goroutines.Pool) *RouterMessaging
func (*RouterMessaging) Inspect ¶ added in v0.33.0
func (self *RouterMessaging) Inspect() (*inspect.RouterMessagingState, error)
func (*RouterMessaging) NewValidationResponseHandler ¶ added in v0.33.0
func (self *RouterMessaging) NewValidationResponseHandler(n *Network, r *Router) channel.ReceiveHandlerF
func (*RouterMessaging) RouterConnected ¶
func (self *RouterMessaging) RouterConnected(r *Router)
func (*RouterMessaging) RouterDeleted ¶
func (self *RouterMessaging) RouterDeleted(routerId string)
func (*RouterMessaging) RouterDisconnected ¶
func (self *RouterMessaging) RouterDisconnected(r *Router)
func (*RouterMessaging) TerminatorCreated ¶ added in v0.33.0
func (self *RouterMessaging) TerminatorCreated(terminator *db.Terminator)
func (*RouterMessaging) ValidateRouterTerminators ¶ added in v0.33.0
func (self *RouterMessaging) ValidateRouterTerminators(terminators []*Terminator)
type RouterPresenceHandler ¶
type RoutingTerminator ¶
type RoutingTerminator struct { RouteCost uint32 *Terminator }
func (*RoutingTerminator) GetRouteCost ¶
func (r *RoutingTerminator) GetRouteCost() uint32
type SdkTerminatorValidationCallback ¶ added in v0.33.0
type SdkTerminatorValidationCallback func(detail *mgmt_pb.RouterSdkTerminatorsDetails)
type Service ¶
type Service struct { models.BaseEntity Name string TerminatorStrategy string Terminators []*Terminator MaxIdleTime time.Duration }
type ServiceCounters ¶
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 ¶
type ServiceManager struct {
// contains filtered or unexported fields
}
func (*ServiceManager) ApplyCreate ¶
func (self *ServiceManager) ApplyCreate(cmd *command.CreateEntityCommand[*Service], ctx boltz.MutateContext) error
func (*ServiceManager) ApplyDelete ¶
func (self *ServiceManager) ApplyDelete(cmd *command.DeleteEntityCommand, ctx boltz.MutateContext) error
func (*ServiceManager) ApplyUpdate ¶
func (self *ServiceManager) ApplyUpdate(cmd *command.UpdateEntityCommand[*Service], ctx boltz.MutateContext) error
func (*ServiceManager) BaseList ¶
func (ctrl *ServiceManager) BaseList(query string) (*models.EntityListResult[ME], error)
func (*ServiceManager) BaseLoadInTx ¶
func (*ServiceManager) BasePreparedList ¶
func (ctrl *ServiceManager) BasePreparedList(query ast.Query) (*models.EntityListResult[ME], error)
func (*ServiceManager) Create ¶
func (self *ServiceManager) Create(entity *Service, ctx *change.Context) error
func (*ServiceManager) GetEntityTypeId ¶
func (self *ServiceManager) GetEntityTypeId() string
func (*ServiceManager) GetIdForName ¶
func (self *ServiceManager) GetIdForName(id string) (string, error)
func (*ServiceManager) ListWithHandler ¶
func (ctrl *ServiceManager) ListWithHandler(queryString string, resultHandler models.ListResultHandler) error
func (*ServiceManager) Marshall ¶
func (self *ServiceManager) Marshall(entity *Service) ([]byte, error)
func (*ServiceManager) NotifyTerminatorChanged ¶
func (self *ServiceManager) NotifyTerminatorChanged(terminator *db.Terminator) *db.Terminator
func (*ServiceManager) PreparedListAssociatedWithHandler ¶
func (*ServiceManager) PreparedListWithHandler ¶
func (ctrl *ServiceManager) PreparedListWithHandler(query ast.Query, resultHandler models.ListResultHandler) error
func (*ServiceManager) Read ¶
func (self *ServiceManager) Read(id string) (entity *Service, err error)
func (*ServiceManager) RemoveFromCache ¶
func (self *ServiceManager) RemoveFromCache(id string)
func (*ServiceManager) Unmarshall ¶
func (self *ServiceManager) Unmarshall(bytes []byte) (*Service, error)
func (*ServiceManager) Update ¶
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 ¶
func (entity *Terminator) GetHostId() string
func (*Terminator) GetInstanceId ¶
func (entity *Terminator) GetInstanceId() string
func (*Terminator) GetInstanceSecret ¶
func (entity *Terminator) GetInstanceSecret() []byte
func (*Terminator) GetPeerData ¶
func (entity *Terminator) GetPeerData() xt.PeerData
func (*Terminator) GetPrecedence ¶
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 ¶
type TerminatorManager struct {
// contains filtered or unexported fields
}
func (*TerminatorManager) ApplyCreate ¶
func (self *TerminatorManager) ApplyCreate(cmd *command.CreateEntityCommand[*Terminator], ctx boltz.MutateContext) error
func (*TerminatorManager) ApplyDelete ¶
func (self *TerminatorManager) ApplyDelete(cmd *command.DeleteEntityCommand, ctx boltz.MutateContext) error
func (*TerminatorManager) ApplyDeleteBatch ¶
func (self *TerminatorManager) ApplyDeleteBatch(cmd *DeleteTerminatorsBatchCommand, ctx boltz.MutateContext) error
func (*TerminatorManager) ApplyUpdate ¶
func (self *TerminatorManager) ApplyUpdate(cmd *command.UpdateEntityCommand[*Terminator], ctx boltz.MutateContext) error
func (*TerminatorManager) BaseList ¶
func (ctrl *TerminatorManager) BaseList(query string) (*models.EntityListResult[ME], error)
func (*TerminatorManager) BaseLoadInTx ¶
func (*TerminatorManager) BasePreparedList ¶
func (ctrl *TerminatorManager) BasePreparedList(query ast.Query) (*models.EntityListResult[ME], error)
func (*TerminatorManager) Create ¶
func (self *TerminatorManager) Create(entity *Terminator, ctx *change.Context) error
func (*TerminatorManager) DeleteBatch ¶
func (self *TerminatorManager) DeleteBatch(ids []string, ctx *change.Context) error
func (*TerminatorManager) GetEntityTypeId ¶
func (self *TerminatorManager) GetEntityTypeId() string
func (*TerminatorManager) ListWithHandler ¶
func (ctrl *TerminatorManager) ListWithHandler(queryString string, resultHandler models.ListResultHandler) error
func (*TerminatorManager) Marshall ¶
func (self *TerminatorManager) Marshall(entity *Terminator) ([]byte, error)
func (*TerminatorManager) PreparedListAssociatedWithHandler ¶
func (*TerminatorManager) PreparedListWithHandler ¶
func (ctrl *TerminatorManager) PreparedListWithHandler(query ast.Query, resultHandler models.ListResultHandler) error
func (*TerminatorManager) Query ¶
func (self *TerminatorManager) Query(query string) (*TerminatorListResult, error)
func (*TerminatorManager) Read ¶
func (self *TerminatorManager) Read(id string) (entity *Terminator, err error)
func (*TerminatorManager) Unmarshall ¶
func (self *TerminatorManager) Unmarshall(bytes []byte) (*Terminator, error)
func (*TerminatorManager) Update ¶
func (self *TerminatorManager) Update(entity *Terminator, updatedFields fields.UpdatedFields, ctx *change.Context) error
func (*TerminatorManager) ValidateTerminators ¶ added in v0.31.1
func (self *TerminatorManager) ValidateTerminators(filter string, fixInvalid bool, cb TerminatorValidationCallback) (uint64, error)
type TerminatorValidationCallback ¶ added in v0.32.0
type TerminatorValidationCallback func(detail *mgmt_pb.TerminatorDetail)
type ValidateTerminatorRequestSendable ¶ added in v0.31.1
type ValidateTerminatorRequestSendable struct { channel.BaseSendListener *channel.Message // contains filtered or unexported fields }
func (*ValidateTerminatorRequestSendable) AcceptReply ¶ added in v0.31.1
func (self *ValidateTerminatorRequestSendable) AcceptReply(message *channel.Message)
func (*ValidateTerminatorRequestSendable) Context ¶ added in v0.31.1
func (self *ValidateTerminatorRequestSendable) Context() context.Context
func (*ValidateTerminatorRequestSendable) ReplyReceiver ¶ added in v0.31.1
func (self *ValidateTerminatorRequestSendable) ReplyReceiver() channel.ReplyReceiver
func (*ValidateTerminatorRequestSendable) SendListener ¶ added in v0.31.1
func (self *ValidateTerminatorRequestSendable) SendListener() channel.SendListener