Documentation
¶
Overview ¶
This file contains code derived from Contour, https://github.com/projectcontour/contour from the source file https://github.com/projectcontour/contour/blob/main/internal/xds/v3/snapshotter.go and is provided here subject to the following: Copyright Project Contour Authors SPDX-License-Identifier: Apache-2.0
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Hash = cachev3.IDHash{}
Functions ¶
This section is empty.
Types ¶
type SnapshotCacheWithCallbacks ¶
type SnapshotCacheWithCallbacks interface {
cachev3.SnapshotCache
serverv3.Callbacks
// GenerateNewSnapshot updates the snapshot for the given ir key. It
// returns true when the resources differed from the last snapshot and a
// new version was pushed, and false when the push was skipped because the
// content was identical.
GenerateNewSnapshot(string, types.XdsResources) (bool, error)
}
SnapshotCacheWithCallbacks uses the go-control-plane SimpleCache to store snapshots of Envoy resources, sliced by Node ID so that we can do incremental xDS properly. It does this by also implementing callbacks to make sure that the cache is kept up to date for each new node.
Having the cache also implement the callbacks is a little bit hacky, but it makes sure that all the required bookkeeping happens. TODO(youngnick): Talk to the go-control-plane maintainers and see if we can upstream this in a better way.
func NewSnapshotCache ¶
func NewSnapshotCache(ads bool, logger *slog.Logger, resources *message.ProviderResources) SnapshotCacheWithCallbacks
NewSnapshotCache gives you a fresh SnapshotCache. It needs a logger that supports the go-control-plane required interface (Debugf, Infof, Warnf, and Errorf).