internal

package
v0.2.12 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2025 License: BSD-2-Clause Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BatchSubscriptionHandler

type BatchSubscriptionHandler interface {
	StartNotificationBatch(map[string]string, int)
	ads.RawSubscriptionHandler
	EndNotificationBatch()
}

BatchSubscriptionHandler is an extension of the SubscriptionHandler interface in the root package which allows a handler to be notified that a batch of calls to Notify is about to be received (StartNotificationBatch). The batch of notifications should not be sent to the client until all notifications for that batch have been received (EndNotificationBatch). Start and End will never be invoked out of order, i.e. there will never be a call to EndNotificationBatch without a call to StartNotificationBatch immediately preceding it. However, SubscriptionHandler.Notify can be invoked at any point.

func NewDeltaHandler

func NewDeltaHandler(
	ctx context.Context,
	granularLimiter *rate.Limiter,
	globalLimiter *rate.Limiter,
	statsHandler serverstats.Handler,
	maxChunkSize int,
	typeUrl string,
	send func(res *ads.DeltaDiscoveryResponse) error,
) BatchSubscriptionHandler

func NewSotWHandler

func NewSotWHandler(
	ctx context.Context,
	granularLimiter *rate.Limiter,
	globalLimiter *rate.Limiter,
	statsHandler serverstats.Handler,
	typeURL string,
	send func(res *ads.SotWDiscoveryResponse) error,
) BatchSubscriptionHandler

type ResourceLocator

type ResourceLocator interface {
	Subscribe(
		streamCtx context.Context,
		typeURL, resourceName string,
		handler ads.RawSubscriptionHandler,
	) (unsubscribe func())
}

ResourceLocator is a copy of the interface in the root package, to avoid import cycles.

type SendBufferSizeEstimator added in v0.2.9

type SendBufferSizeEstimator interface {
	EstimateSubscriptionSize(streamCtx context.Context, typeURL string, resourceNamesSubscribe []string) int
}

SendBufferSizeEstimator is a copy of the interface in the root package, to avoid import cycles.

type SubscriptionManager

type SubscriptionManager[REQ proto.Message] interface {
	// ProcessSubscriptions handles subscribing/unsubscribing from the resources provided in the given
	// xDS request. This function will always invoke BatchSubscriptionHandler.StartNotificationBatch
	// before it starts processing the subscriptions and always complete with
	// BatchSubscriptionHandler.EndNotificationBatch. Since the cache implementation always notifies the
	// SubscriptionHandler with the current value of the subscribed resource,
	// BatchSubscriptionHandler.EndNotificationBatch will be invoked after the handler has been notified
	// of all the resources requested.
	ProcessSubscriptions(REQ)
	// IsSubscribedTo checks whether the client has subscribed to the given resource name.
	IsSubscribedTo(name string) bool
	// UnsubscribeAll cleans up any active subscriptions and disables the wildcard subscription if enabled.
	UnsubscribeAll()
}

func NewDeltaSubscriptionManager

func NewDeltaSubscriptionManager(
	ctx context.Context,
	locator ResourceLocator,
	typeURL string,
	handler BatchSubscriptionHandler,
	sizeEstimator SendBufferSizeEstimator,
) SubscriptionManager[*ads.DeltaDiscoveryRequest]

NewDeltaSubscriptionManager creates a new SubscriptionManager specifically designed to handle the Delta xDS protocol's subscription semantics.

func NewSotWSubscriptionManager

func NewSotWSubscriptionManager(
	ctx context.Context,
	locator ResourceLocator,
	typeURL string,
	handler BatchSubscriptionHandler,
	sizeEstimator SendBufferSizeEstimator,
) SubscriptionManager[*ads.SotWDiscoveryRequest]

NewSotWSubscriptionManager creates a new SubscriptionManager specifically designed to handle the State-of-the-World xDS protocol's subscription semantics.

Jump to

Keyboard shortcuts

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