Documentation ¶
Index ¶
- Constants
- func GetFilesystemPlugins(dc plugins.DiscoveryConfig) (*controlv1.PluginArchive, error)
- func LeftJoinOn(gateway, agent *controlv1.UpdateManifest) *controlv1.PatchList
- type BinaryPatcher
- type BsdiffPatcher
- type Cache
- type CacheMetrics
- type CacheMetricsTracker
- func (c *CacheMetricsTracker) AddToPatchCount(value int64)
- func (c *CacheMetricsTracker) AddToPluginCount(value int64)
- func (c *CacheMetricsTracker) AddToTotalSizeBytes(digest string, value int64)
- func (c *CacheMetricsTracker) CacheHit(oldDigest, newDigest string)
- func (c *CacheMetricsTracker) CacheMiss(oldDigest, newDigest string)
- func (c *CacheMetricsTracker) IncPatchCalcCount(oldDigest, newDigest string)
- func (c *CacheMetricsTracker) IncPatchCalcSecsTotal(oldDigest, newDigest string, value float64)
- func (c *CacheMetricsTracker) MetricsCollectors() []prometheus.Collector
- func (c *CacheMetricsTracker) MetricsSnapshot() CacheMetrics
- func (c *CacheMetricsTracker) SetPatchCount(count int64)
- func (c *CacheMetricsTracker) SetPluginCount(count int64)
- func (c *CacheMetricsTracker) SetTotalSizeBytes(digest string, size int64)
- type FilesystemCache
- func (p *FilesystemCache) Archive(manifest *controlv1.PluginArchive) error
- func (p *FilesystemCache) Clean(hashes ...string)
- func (p *FilesystemCache) GetBinaryFile(dir, hash string) ([]byte, error)
- func (p *FilesystemCache) ListDigests() ([]string, error)
- func (*FilesystemCache) PatchKey(oldDigest, newDigest string) string
- func (p *FilesystemCache) RequestPatch(oldDigest, newDigest string) ([]byte, error)
- type ZstdPatcher
Constants ¶
View Source
const ( PluginsDir = "plugins" PatchesDir = "patches" )
View Source
const (
UpdateStrategy = "binary"
)
Variables ¶
This section is empty.
Functions ¶
func GetFilesystemPlugins ¶
func GetFilesystemPlugins(dc plugins.DiscoveryConfig) (*controlv1.PluginArchive, error)
func LeftJoinOn ¶
func LeftJoinOn(gateway, agent *controlv1.UpdateManifest) *controlv1.PatchList
Types ¶
type BinaryPatcher ¶
type BinaryPatcher interface { GeneratePatch(old io.Reader, new io.Reader, patchOut io.Writer) error ApplyPatch(old io.Reader, patch io.Reader, newOut io.Writer) error CheckFormat(reader io.ReaderAt) bool }
func NewPatcherFromFormat ¶
func NewPatcherFromFormat(reader io.ReaderAt) (BinaryPatcher, bool)
type BsdiffPatcher ¶
type BsdiffPatcher struct{}
func (BsdiffPatcher) ApplyPatch ¶
func (BsdiffPatcher) CheckFormat ¶
func (BsdiffPatcher) CheckFormat(reader io.ReaderAt) bool
func (BsdiffPatcher) GeneratePatch ¶
type Cache ¶
type Cache interface { // RequestPatch will return a patch which will transform the binary at oldHash to the binary at newHash. If the patch // does not exist, and both referenced binaries exist, the patch will be generated and stored in the cache before // returning. // This function is thread-safe and reentrant. The patch will only be computed once regardless of how many // concurrent calls are made. // If the patch does not exist, and one or both of the referenced plugins do not exist, this function will return // an error, and the patch will not be generated. RequestPatch(oldHash, newHash string) ([]byte, error) // PatchKey Returns an opaque unique key representing a patch between the two revisions. The key is guaranteed to be // unique for the inputs but is not guaranteed to have a specific format, or even contain the input strings. PatchKey(oldHash, newHash string) string // Archive compresses and saves all plugins in the given plugin manifest to the cache, if they do not exist. Archive(manifest *controlv1.PluginArchive) error // GetBinaryFile returns the plugin with the given hash, if it exists. GetBinaryFile(dir, hash string) ([]byte, error) // ListDigests returns a list of all plugin digests in the cache. It does not return patch digests. ListDigests() ([]string, error) // Clean removes all objects in the cache associated with the given plugin hashes, including any patches that // reference those plugins. Clean(hashes ...string) // MetricsCollectors returns a list of prometheus collectors that can be used to track cache metrics. MetricsCollectors() []prometheus.Collector // MetricsSnapshot returns a snapshot of the current cache metrics. MetricsSnapshot() CacheMetrics }
func NewFilesystemCache ¶
func NewFilesystemCache(fsys afero.Fs, conf v1beta1.FilesystemCacheSpec, patcher BinaryPatcher, lg *slog.Logger) (Cache, error)
type CacheMetrics ¶
type CacheMetricsTracker ¶
type CacheMetricsTracker struct {
// contains filtered or unexported fields
}
func NewCacheMetricsTracker ¶
func NewCacheMetricsTracker(constLabels map[string]string) CacheMetricsTracker
func (*CacheMetricsTracker) AddToPatchCount ¶
func (c *CacheMetricsTracker) AddToPatchCount(value int64)
func (*CacheMetricsTracker) AddToPluginCount ¶
func (c *CacheMetricsTracker) AddToPluginCount(value int64)
func (*CacheMetricsTracker) AddToTotalSizeBytes ¶
func (c *CacheMetricsTracker) AddToTotalSizeBytes(digest string, value int64)
func (*CacheMetricsTracker) CacheHit ¶
func (c *CacheMetricsTracker) CacheHit(oldDigest, newDigest string)
func (*CacheMetricsTracker) CacheMiss ¶
func (c *CacheMetricsTracker) CacheMiss(oldDigest, newDigest string)
func (*CacheMetricsTracker) IncPatchCalcCount ¶
func (c *CacheMetricsTracker) IncPatchCalcCount(oldDigest, newDigest string)
func (*CacheMetricsTracker) IncPatchCalcSecsTotal ¶
func (c *CacheMetricsTracker) IncPatchCalcSecsTotal(oldDigest, newDigest string, value float64)
func (*CacheMetricsTracker) MetricsCollectors ¶
func (c *CacheMetricsTracker) MetricsCollectors() []prometheus.Collector
func (*CacheMetricsTracker) MetricsSnapshot ¶
func (c *CacheMetricsTracker) MetricsSnapshot() CacheMetrics
func (*CacheMetricsTracker) SetPatchCount ¶
func (c *CacheMetricsTracker) SetPatchCount(count int64)
func (*CacheMetricsTracker) SetPluginCount ¶
func (c *CacheMetricsTracker) SetPluginCount(count int64)
func (*CacheMetricsTracker) SetTotalSizeBytes ¶
func (c *CacheMetricsTracker) SetTotalSizeBytes(digest string, size int64)
type FilesystemCache ¶
type FilesystemCache struct { CacheMetricsTracker // contains filtered or unexported fields }
func (*FilesystemCache) Archive ¶
func (p *FilesystemCache) Archive(manifest *controlv1.PluginArchive) error
func (*FilesystemCache) Clean ¶
func (p *FilesystemCache) Clean(hashes ...string)
func (*FilesystemCache) GetBinaryFile ¶
func (p *FilesystemCache) GetBinaryFile(dir, hash string) ([]byte, error)
func (*FilesystemCache) ListDigests ¶
func (p *FilesystemCache) ListDigests() ([]string, error)
func (*FilesystemCache) PatchKey ¶
func (*FilesystemCache) PatchKey(oldDigest, newDigest string) string
func (*FilesystemCache) RequestPatch ¶
func (p *FilesystemCache) RequestPatch(oldDigest, newDigest string) ([]byte, error)
type ZstdPatcher ¶ added in v0.11.2
type ZstdPatcher struct{}
func (ZstdPatcher) ApplyPatch ¶ added in v0.11.2
func (ZstdPatcher) CheckFormat ¶ added in v0.11.2
func (ZstdPatcher) CheckFormat(reader io.ReaderAt) bool
func (ZstdPatcher) GeneratePatch ¶ added in v0.11.2
Source Files ¶
Click to show internal directories.
Click to hide internal directories.