follower

package
v0.0.0-...-7f2378c Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2024 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Overview

Package follower defines the Follower type. It is used to track a specific artifact version denoted by its tag. Periodically it checks if a new version has been pushed and if so pulls and installs it in a given directory. Each Follower can track only one artifact, if you need to track multiple artiacts then instantiate a follower for each one.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	WaitGroup *sync.WaitGroup
	// CloseChan used to close the follower.
	CloseChan <-chan bool
	// Resync time after which periodically it checks for new a new version.
	Resync cron.Schedule
	// RulesfilesDir directory where the rulesfile are stored.
	RulesfilesDir string
	// PluginsDir directory where  plugins are stored.
	PluginsDir string
	// AssetsDir directory where assets are stored.
	AssetsDir string
	// ArtifactReference reference to the artifact in a remote repository.
	ArtifactReference string
	// PlainHTTP is set to true if all registry interaction must be in plain http.
	PlainHTTP bool
	// TmpDir directory where to save temporary files.
	TmpDir string
	// DiginfraVersions is a struct containing all the required Diginfra versions that this follower
	// has to take into account when installing artifacts.
	DiginfraVersions config.DiginfraVersions
	// AllowedTypes specify a list of artifacts that we are allowed to download.
	AllowedTypes oci.ArtifactTypeSlice
	// Signature has the data needed for signature checking
	Signature *index.Signature
}

Config configuration options for the Follower.

type Follower

type Follower struct {
	*ocipuller.Puller
	*Config

	config.DiginfraVersions
	*output.Printer
	// contains filtered or unexported fields
}

Follower knows how to track an artifact in a remote repository given the reference. It starts a new goroutine to check for updates periodically. If an update is available it pulls the new version and installs it in the correct directory.

func New

func New(ref string, printer *output.Printer, conf *Config) (*Follower, error)

New creates a Follower configured with the passed parameters and ready to be used. It does not check the correctness of the parameters, make sure everything is initialized.

func (*Follower) Follow

func (f *Follower) Follow(ctx context.Context)

Follow starts a goroutine that periodically checks for updates for the configured artifact.

Jump to

Keyboard shortcuts

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