callbacks

package
v0.0.0-...-10220f9 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2024 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DataplaneCallbacksToXdsCallbacks

func DataplaneCallbacksToXdsCallbacks(callbacks DataplaneCallbacks) util_xds.Callbacks

func NewNackBackoff

func NewNackBackoff(backoff time.Duration) util_xds.Callbacks

Types

type DataplaneCallbacks

type DataplaneCallbacks interface {
	// OnProxyConnected is executed when proxy is connected after it was disconnected before.
	OnProxyConnected(streamID core_xds.StreamID, dpKey core_model.ResourceKey, ctx context.Context, metadata core_xds.DataplaneMetadata) error
	// OnProxyReconnected is executed when proxy is already connected, but there is another stream.
	// This can happen when there is a delay with closing the old connection from the proxy to the control plane.
	OnProxyReconnected(streamID core_xds.StreamID, dpKey core_model.ResourceKey, ctx context.Context, metadata core_xds.DataplaneMetadata) error
	// OnProxyDisconnected is executed only when the last stream of the proxy disconnects.
	OnProxyDisconnected(ctx context.Context, streamID core_xds.StreamID, dpKey core_model.ResourceKey)
}

DataplaneCallbacks are XDS callbacks that keep the context of Dubbo Dataplane. In the ideal world we could assume that one Dataplane has one xDS stream. Due to race network latencies etc. there might be a situation when one Dataplane has many xDS streams for the short period of time. Those callbacks helps us to deal with such situation.

Keep in mind that it does not solve many xDS streams across many instances of the Control Plane. If there are many instances of the Control Plane and Dataplane reconnects, there might be an old stream in one instance of CP and a new stream in a new instance of CP.

func NewDataplaneSyncTracker

func NewDataplaneSyncTracker(factoryFunc NewDataplaneWatchdogFunc) DataplaneCallbacks

type DataplaneInsightSink

type DataplaneInsightSink interface {
	Start(stop <-chan struct{})
}

func NewDataplaneInsightSink

func NewDataplaneInsightSink(
	dataplaneType core_model.ResourceType,
	accessor SubscriptionStatusAccessor,
	newTicker func() *time.Ticker,
	generationTicker func() *time.Ticker,
	flushBackoff time.Duration,
	store DataplaneInsightStore,
) DataplaneInsightSink

type DataplaneInsightStore

type DataplaneInsightStore interface {
	// Upsert creates or updates the subscription, storing it with
	// the key dataplaneID. dataplaneType gives the resource type of
	// the dataplane proxy that has subscribed.
	Upsert(ctx context.Context, dataplaneType core_model.ResourceType, dataplaneID core_model.ResourceKey, subscription *mesh_proto.DiscoverySubscription) error
}

func NewDataplaneInsightStore

func NewDataplaneInsightStore(resManager manager.ResourceManager) DataplaneInsightStore

type DataplaneLifecycle

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

func NewDataplaneLifecycle

func NewDataplaneLifecycle(
	appCtx context.Context,
	resManager manager.ResourceManager,
	deregistrationDelay time.Duration,
	cpInstanceID string,
) *DataplaneLifecycle

func (*DataplaneLifecycle) OnProxyConnected

func (d *DataplaneLifecycle) OnProxyConnected(streamID core_xds.StreamID, proxyKey core_model.ResourceKey, ctx context.Context, md core_xds.DataplaneMetadata) error

func (*DataplaneLifecycle) OnProxyDisconnected

func (d *DataplaneLifecycle) OnProxyDisconnected(ctx context.Context, streamID core_xds.StreamID, proxyKey core_model.ResourceKey)

func (*DataplaneLifecycle) OnProxyReconnected

func (d *DataplaneLifecycle) OnProxyReconnected(streamID core_xds.StreamID, proxyKey core_model.ResourceKey, ctx context.Context, md core_xds.DataplaneMetadata) error

type DataplaneMetadataTracker

type DataplaneMetadataTracker struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func NewDataplaneMetadataTracker

func NewDataplaneMetadataTracker() *DataplaneMetadataTracker

func (*DataplaneMetadataTracker) Metadata

func (*DataplaneMetadataTracker) OnProxyConnected

func (*DataplaneMetadataTracker) OnProxyDisconnected

func (d *DataplaneMetadataTracker) OnProxyDisconnected(_ context.Context, _ core_xds.StreamID, dpKey core_model.ResourceKey)

func (*DataplaneMetadataTracker) OnProxyReconnected

type DataplaneStatusTracker

type DataplaneStatusTracker interface {
	util_xds.Callbacks
	GetStatusAccessor(streamID int64) (SubscriptionStatusAccessor, bool)
}

func NewDataplaneStatusTracker

func NewDataplaneStatusTracker(
	runtimeInfo core_runtime.RuntimeInfo,
	createStatusSink DataplaneInsightSinkFactoryFunc,
) DataplaneStatusTracker

type NewDataplaneWatchdogFunc

type NewDataplaneWatchdogFunc func(key core_model.ResourceKey) util_watchdog.Watchdog

type NoopDataplaneCallbacks

type NoopDataplaneCallbacks struct{}

NoopDataplaneCallbacks are empty callbacks that helps to implement DataplaneCallbacks without need to implement every function.

func (*NoopDataplaneCallbacks) OnProxyDisconnected

type SubscriptionStatusAccessor

type SubscriptionStatusAccessor interface {
	GetStatus() (core_model.ResourceKey, *mesh_proto.DiscoverySubscription)
}

Jump to

Keyboard shortcuts

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