sync_strats

package
v1.1.7 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2024 License: Apache-2.0 Imports: 33 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RouterSyncStrategyInstant env.RouterSyncStrategyType = "instant"
	ZdbIndexKey               string                     = "index"
	ZdbKey                    string                     = "zdb"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type IndexProvider added in v0.34.0

type IndexProvider interface {
	// NextIndex provides an index for the supplied MutateContext.
	NextIndex(ctx boltz.MutateContext) (uint64, error)

	// CurrentIndex provides the current index
	CurrentIndex() uint64

	ContextIndex(ctx boltz.MutateContext) *uint64
}

type InstantStrategy

type InstantStrategy struct {
	InstantStrategyOptions

	*common.RouterDataModel
	// contains filtered or unexported fields
}

InstantStrategy 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 queues and workers to managed synchronization state. The order of events is as follows:

  1. An edge router connects to the controller, triggering RouterConnected()
  2. A RouterSender is created encapsulating the Edge Router, Router, and Sync State
  3. The RouterSender is queued on the routerConnectedQueue channel which buffers up to options.MaxQueuedRouterConnects
  4. The routerConnectedQueue is read and the edge server hello is sent
  5. The controller waits for a client hello to be received via ReceiveClientHello message
  6. 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
  7. 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) AddPublicKey added in v0.34.0

func (strategy *InstantStrategy) AddPublicKey(cert *tls.Certificate)

func (*InstantStrategy) ApiSessionAdded

func (strategy *InstantStrategy) ApiSessionAdded(apiSession *db.ApiSession)

func (*InstantStrategy) ApiSessionDeleted

func (strategy *InstantStrategy) ApiSessionDeleted(apiSession *db.ApiSession)

func (*InstantStrategy) ApiSessionUpdated

func (strategy *InstantStrategy) ApiSessionUpdated(apiSession *db.ApiSession, _ *db.ApiSessionCertificate)

func (*InstantStrategy) BuildAll added in v0.34.0

func (strategy *InstantStrategy) BuildAll() error

func (*InstantStrategy) BuildIdentities added in v0.34.0

func (strategy *InstantStrategy) BuildIdentities(tx *bbolt.Tx) error

func (*InstantStrategy) BuildPostureChecks added in v0.34.0

func (strategy *InstantStrategy) BuildPostureChecks(tx *bbolt.Tx) error

func (*InstantStrategy) BuildPublicKeys added in v0.34.0

func (strategy *InstantStrategy) BuildPublicKeys(tx *bbolt.Tx) error

func (*InstantStrategy) BuildServicePolicies added in v0.34.0

func (strategy *InstantStrategy) BuildServicePolicies(tx *bbolt.Tx) error

func (*InstantStrategy) BuildServices added in v0.34.0

func (strategy *InstantStrategy) BuildServices(tx *bbolt.Tx) error

func (*InstantStrategy) CaCreate added in v0.34.0

func (strategy *InstantStrategy) CaCreate(index uint64, ca *db.Ca)

func (*InstantStrategy) CaDelete added in v0.34.0

func (strategy *InstantStrategy) CaDelete(index uint64, ca *db.Ca)

func (*InstantStrategy) CaUpdate added in v0.34.0

func (strategy *InstantStrategy) CaUpdate(index uint64, ca *db.Ca)

func (*InstantStrategy) ControllerCreate added in v0.34.2

func (strategy *InstantStrategy) ControllerCreate(index uint64, controller *db.Controller)

func (*InstantStrategy) ControllerUpdate added in v0.34.2

func (strategy *InstantStrategy) ControllerUpdate(index uint64, controller *db.Controller)

func (*InstantStrategy) GetEdgeRouterState

func (strategy *InstantStrategy) GetEdgeRouterState(id string) env.RouterStateValues

func (*InstantStrategy) GetReceiveHandlers

func (strategy *InstantStrategy) GetReceiveHandlers() []channel.TypedReceiveHandler

func (*InstantStrategy) IdentityCreate added in v0.34.0

func (strategy *InstantStrategy) IdentityCreate(index uint64, identity *db.Identity)

func (*InstantStrategy) IdentityDelete added in v0.34.0

func (strategy *InstantStrategy) IdentityDelete(index uint64, identity *db.Identity)

func (*InstantStrategy) IdentityUpdate added in v0.34.0

func (strategy *InstantStrategy) IdentityUpdate(index uint64, identity *db.Identity)

func (*InstantStrategy) Initialize added in v0.34.0

func (strategy *InstantStrategy) Initialize(logSize uint64, bufferSize uint) error

Initialize implements RouterDataModelCache

func (*InstantStrategy) PostureCheckCreate added in v0.34.0

func (strategy *InstantStrategy) PostureCheckCreate(index uint64, postureCheck *db.PostureCheck)

func (*InstantStrategy) PostureCheckDelete added in v0.34.0

func (strategy *InstantStrategy) PostureCheckDelete(index uint64, postureCheck *db.PostureCheck)

func (*InstantStrategy) PostureCheckUpdate added in v0.34.0

func (strategy *InstantStrategy) PostureCheckUpdate(index uint64, postureCheck *db.PostureCheck)

func (*InstantStrategy) ReceiveClientHello

func (strategy *InstantStrategy) ReceiveClientHello(routerId string, msg *channel.Message, respHello *edge_ctrl_pb.ClientHello)

func (*InstantStrategy) ReceiveResync

func (strategy *InstantStrategy) ReceiveResync(routerId string, _ *edge_ctrl_pb.RequestClientReSync)

func (*InstantStrategy) RevocationCreate added in v0.34.0

func (strategy *InstantStrategy) RevocationCreate(index uint64, revocation *db.Revocation)

func (*InstantStrategy) RevocationDelete added in v0.34.0

func (strategy *InstantStrategy) RevocationDelete(index uint64, revocation *db.Revocation)

func (*InstantStrategy) RevocationUpdate added in v0.34.0

func (strategy *InstantStrategy) RevocationUpdate(index uint64, revocation *db.Revocation)

func (*InstantStrategy) RouterConnected

func (strategy *InstantStrategy) RouterConnected(edgeRouter *model.EdgeRouter, router *model.Router)

func (*InstantStrategy) RouterDisconnected

func (strategy *InstantStrategy) RouterDisconnected(router *model.Router)

func (*InstantStrategy) ServiceCreate added in v0.34.0

func (strategy *InstantStrategy) ServiceCreate(index uint64, service *db.EdgeService)

func (*InstantStrategy) ServiceDelete added in v0.34.0

func (strategy *InstantStrategy) ServiceDelete(index uint64, service *db.EdgeService)

func (*InstantStrategy) ServicePolicyCreate added in v0.34.0

func (strategy *InstantStrategy) ServicePolicyCreate(index uint64, servicePolicy *db.ServicePolicy)

func (*InstantStrategy) ServicePolicyDelete added in v0.34.0

func (strategy *InstantStrategy) ServicePolicyDelete(index uint64, servicePolicy *db.ServicePolicy)

func (*InstantStrategy) ServicePolicyUpdate added in v0.34.0

func (strategy *InstantStrategy) ServicePolicyUpdate(index uint64, servicePolicy *db.ServicePolicy)

func (*InstantStrategy) ServiceUpdate added in v0.34.0

func (strategy *InstantStrategy) ServiceUpdate(index uint64, service *db.EdgeService)

func (*InstantStrategy) SessionDeleted

func (strategy *InstantStrategy) SessionDeleted(session *db.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
}

InstantStrategyOptions is the 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 InstantSyncState struct {
	Id       string `json:"id"`       //unique id for the sync attempt
	IsLast   bool   `json:"isLast"`   //
	Sequence int    `json:"sequence"` //increasing id from 0 per id for the
}

type NonHaIndexProvider added in v0.34.0

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

func (*NonHaIndexProvider) ContextIndex added in v1.1.1

func (p *NonHaIndexProvider) ContextIndex(ctx boltz.MutateContext) *uint64

func (*NonHaIndexProvider) CurrentIndex added in v0.34.0

func (p *NonHaIndexProvider) CurrentIndex() uint64

func (*NonHaIndexProvider) NextIndex added in v0.34.0

func (p *NonHaIndexProvider) NextIndex(ctx boltz.MutateContext) (uint64, error)

type RaftIndexProvider added in v0.34.0

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

func (*RaftIndexProvider) ContextIndex added in v1.1.1

func (p *RaftIndexProvider) ContextIndex(ctx boltz.MutateContext) *uint64

func (*RaftIndexProvider) CurrentIndex added in v0.34.0

func (p *RaftIndexProvider) CurrentIndex() uint64

func (*RaftIndexProvider) NextIndex added in v0.34.0

func (p *RaftIndexProvider) NextIndex(ctx boltz.MutateContext) (uint64, error)

type RouterSender

type RouterSender struct {
	env.RouterState
	Id         string
	EdgeRouter *model.EdgeRouter
	Router     *model.Router

	SupportsRouterModel bool
	RouterModelIndex    *uint64

	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

func (rtx *RouterSender) GetState() env.RouterStateValues

func (*RouterSender) Send

func (rtx *RouterSender) Send(msg *channel.Message) error

func (*RouterSender) Stop

func (rtx *RouterSender) Stop()

Jump to

Keyboard shortcuts

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