cache

package
v1.18.0-beta.1 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2024 License: Apache-2.0, BSD-2-Clause, BSD-3-Clause, + 3 more Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildCacheKey

func BuildCacheKey(typeUrl string, tlsMode resource.TLSMode, client *resource.XDSClient) string

Types

type CacheHook

type CacheHook interface {
	// OnCreateWatch
	OnCreateWatch(request *cachev3.Request, streamState stream.StreamState,
		value chan cachev3.Response)
	// OnCreateDeltaWatch
	OnCreateDeltaWatch(request *cachev3.DeltaRequest, state stream.StreamState,
		value chan cachev3.DeltaResponse)
	// OnFetch
	OnFetch(ctx context.Context, request *cachev3.Request)
}

CacheHook

type Callbacks

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

func NewCallback

func NewCallback(cacheMgr *XDSCache, nodeMgr *resource.XDSNodeManager) *Callbacks

func (*Callbacks) OnDeltaStreamClosed

func (cb *Callbacks) OnDeltaStreamClosed(id int64, node *corev3.Node)

func (*Callbacks) OnDeltaStreamOpen

func (cb *Callbacks) OnDeltaStreamOpen(_ context.Context, id int64, typ string) error

func (*Callbacks) OnFetchRequest

func (cb *Callbacks) OnFetchRequest(_ context.Context, req *discovery.DiscoveryRequest) error

func (*Callbacks) OnFetchResponse

func (cb *Callbacks) OnFetchResponse(req *discovery.DiscoveryRequest, resp *discovery.DiscoveryResponse)

func (*Callbacks) OnStreamClosed

func (cb *Callbacks) OnStreamClosed(id int64, node *corev3.Node)

func (*Callbacks) OnStreamDeltaRequest

func (cb *Callbacks) OnStreamDeltaRequest(id int64, req *discovery.DeltaDiscoveryRequest) error

func (*Callbacks) OnStreamDeltaResponse

func (cb *Callbacks) OnStreamDeltaResponse(id int64, req *discovery.DeltaDiscoveryRequest,
	resp *discovery.DeltaDiscoveryResponse)

func (*Callbacks) OnStreamOpen

func (cb *Callbacks) OnStreamOpen(_ context.Context, id int64, typ string) error

func (*Callbacks) OnStreamRequest

func (cb *Callbacks) OnStreamRequest(id int64, req *discovery.DiscoveryRequest) error

func (*Callbacks) OnStreamResponse

func (cb *Callbacks) OnStreamResponse(_ context.Context, id int64, req *discovery.DiscoveryRequest,
	resp *discovery.DiscoveryResponse)

type NoReadyXdsResponse

type NoReadyXdsResponse struct {
	cachev3.DeltaResponse
}

func (*NoReadyXdsResponse) GetDeltaDiscoveryResponse

func (r *NoReadyXdsResponse) GetDeltaDiscoveryResponse() (*discovery.DeltaDiscoveryResponse, error)

func (*NoReadyXdsResponse) GetDeltaRequest

func (r *NoReadyXdsResponse) GetDeltaRequest() *discovery.DeltaDiscoveryRequest

type XDSCache

type XDSCache struct {

	// Muxed caches.
	Caches *utils.SyncMap[string, cachev3.Cache]
	// contains filtered or unexported fields
}

func NewCache

func NewCache(hook CacheHook) *XDSCache

NewCache create a XDS SnapshotCache to proxy cachev3.SnapshotCache

func (*XDSCache) CleanEnvoyNodeCache

func (sc *XDSCache) CleanEnvoyNodeCache(node *corev3.Node)

CleanEnvoyNodeCache 清理和 Envoy Node 强相关的缓存数据

func (*XDSCache) CreateDeltaWatch

func (sc *XDSCache) CreateDeltaWatch(request *cachev3.DeltaRequest, state stream.StreamState,
	value chan cachev3.DeltaResponse) func()

CreateDeltaWatch returns a watch for a delta xDS request which implements the Simple SnapshotCache.

func (*XDSCache) CreateWatch

func (sc *XDSCache) CreateWatch(request *cachev3.Request, streamState stream.StreamState,
	value chan cachev3.Response) func()

CreateWatch returns a watch for an xDS request.

func (*XDSCache) DeltaRemoveResource

func (sc *XDSCache) DeltaRemoveResource(key, typeUrl string, current map[string]types.Resource) error

DeltaRemoveResource .

func (*XDSCache) DeltaUpdateResource

func (sc *XDSCache) DeltaUpdateResource(key, typeUrl string, current map[string]types.Resource) error

DeltaUpdateResource .

func (*XDSCache) Fetch

func (sc *XDSCache) Fetch(ctx context.Context, request *cachev3.Request) (cachev3.Response, error)

Fetch implements the cache fetch function. Fetch is called on multiple streams, so responding to individual names with the same version works.

Jump to

Keyboard shortcuts

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