Documentation ¶
Index ¶
- Constants
- type InstantStrategy
- func (strategy *InstantStrategy) ApiSessionAdded(apiSession *persistence.ApiSession)
- func (strategy *InstantStrategy) ApiSessionDeleted(apiSession *persistence.ApiSession)
- func (strategy *InstantStrategy) ApiSessionUpdated(apiSession *persistence.ApiSession, _ *persistence.ApiSessionCertificate)
- func (strategy *InstantStrategy) GetEdgeRouterState(id string) env.RouterStateValues
- func (strategy *InstantStrategy) ReceiveClientHello(r *network.Router, respHello *edge_ctrl_pb.ClientHello)
- func (strategy *InstantStrategy) ReceiveResync(r *network.Router, _ *edge_ctrl_pb.RequestClientReSync)
- func (strategy *InstantStrategy) RouterConnected(edgeRouter *model.EdgeRouter, router *network.Router)
- func (strategy *InstantStrategy) RouterDisconnected(router *network.Router)
- func (strategy *InstantStrategy) SessionDeleted(session *persistence.Session)
- func (strategy *InstantStrategy) Stop()
- func (strategy *InstantStrategy) Type() env.RouterSyncStrategyType
- type InstantStrategyOptions
- type InstantSyncState
- type RouterSender
Constants ¶
const (
RouterSyncStrategyInstant env.RouterSyncStrategyType = "instant"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type InstantStrategy ¶
type InstantStrategy struct { InstantStrategyOptions // contains filtered or unexported fields }
Original API Session synchronization implementation. Assumes that on connect, the router requires and instant and full set of API Sessions. Send individual create, update, delete events for sessions after synchronization.
This strategy uses a series of queus and workers to managed sychronization state. The order of events is as follows:
- An edge router connects to the controller, triggering RouterConnected()
- A RouterSender is created encapsulating the Edge Router, Router, and Sync State
- The RouterSender is queued on the routerConnectedQueue channel which buffers up to options.MaxQueuedRouterConnects
- The routerConnectedQueue is read and the edge server hello is sent
- The controller waits for a client hello to be recieved via ReceiveClientHello message
- The client hello is used to identity the RouterSender associated with the client and is queued on the receivedClientHelloQueue channel which buffers up to options.MaxQueuedClientHellos
- A startSynchronizeWorker will pick up the RouterSender from the receivedClientHelloQueue and being to send data to the edge router via the RouterSender
func NewInstantStrategy ¶
func NewInstantStrategy(ae *env.AppEnv, options InstantStrategyOptions) *InstantStrategy
func (*InstantStrategy) ApiSessionAdded ¶
func (strategy *InstantStrategy) ApiSessionAdded(apiSession *persistence.ApiSession)
func (*InstantStrategy) ApiSessionDeleted ¶
func (strategy *InstantStrategy) ApiSessionDeleted(apiSession *persistence.ApiSession)
func (*InstantStrategy) ApiSessionUpdated ¶
func (strategy *InstantStrategy) ApiSessionUpdated(apiSession *persistence.ApiSession, _ *persistence.ApiSessionCertificate)
func (*InstantStrategy) GetEdgeRouterState ¶ added in v0.19.20
func (strategy *InstantStrategy) GetEdgeRouterState(id string) env.RouterStateValues
func (*InstantStrategy) ReceiveClientHello ¶
func (strategy *InstantStrategy) ReceiveClientHello(r *network.Router, respHello *edge_ctrl_pb.ClientHello)
func (*InstantStrategy) ReceiveResync ¶
func (strategy *InstantStrategy) ReceiveResync(r *network.Router, _ *edge_ctrl_pb.RequestClientReSync)
func (*InstantStrategy) RouterConnected ¶
func (strategy *InstantStrategy) RouterConnected(edgeRouter *model.EdgeRouter, router *network.Router)
func (*InstantStrategy) RouterDisconnected ¶
func (strategy *InstantStrategy) RouterDisconnected(router *network.Router)
func (*InstantStrategy) SessionDeleted ¶
func (strategy *InstantStrategy) SessionDeleted(session *persistence.Session)
func (*InstantStrategy) Stop ¶
func (strategy *InstantStrategy) Stop()
func (*InstantStrategy) Type ¶
func (strategy *InstantStrategy) Type() env.RouterSyncStrategyType
type InstantStrategyOptions ¶
type InstantStrategyOptions struct { MaxQueuedRouterConnects int32 MaxQueuedClientHellos int32 RouterConnectWorkerCount int32 SyncWorkerCount int32 RouterTxBufferSize int HelloSendTimeout time.Duration SessionChunkSize int }
Options for the instant strategy. - MaxQueuedRouterConnects - max number of router connected events to buffer - MaxQueuedClientHellos - max number of client hello messages to buffer - RouterConnectWorkerCount - max number of workers used to process router connections - SyncWorkerCount - max number of workers used to send api sessions/session data - RouterTxBufferSize - max number of messages buffered to be send to a router - HelloSendTimeout - the max amount of time per worker to wait to send hellos - SessionChunkSize - the number of sessions to send in each message
type InstantSyncState ¶
type RouterSender ¶
type RouterSender struct { env.RouterState Id string EdgeRouter *model.EdgeRouter Router *network.Router sync.Mutex // contains filtered or unexported fields }
RouterSender represents a connection from an Edge Router to the controller. Used to asynchronously buffer and send messages to an Edge Router via Start() then Send()
func (*RouterSender) GetState ¶ added in v0.19.20
func (rtx *RouterSender) GetState() env.RouterStateValues
func (*RouterSender) Send ¶
func (rtx *RouterSender) Send(msg *channel2.Message)
func (*RouterSender) Start ¶
func (rtx *RouterSender) Start()
func (*RouterSender) Stop ¶
func (rtx *RouterSender) Stop()