poll

package
v0.10.0-rc.1 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GitFetcher

type GitFetcher interface {
	LatestCommit(ctx context.Context, gitrepo *v1alpha1.GitRepo, client client.Client) (string, error)
}

type Handler

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

Handler handles all the watches for the git repositories. These watches are pulling the latest commit every syncPeriod.

func NewHandler

func NewHandler(client client.Client) *Handler

func (*Handler) AddOrModifyGitRepoWatch

func (h *Handler) AddOrModifyGitRepoWatch(ctx context.Context, gitRepo v1alpha1.GitRepo)

AddOrModifyGitRepoWatch adds a new watch for the gitrepo if no watch was already present. It updates the existing watch for this gitrepo if present.

func (*Handler) CleanUpWatches

func (h *Handler) CleanUpWatches(ctx context.Context)

CleanUpWatches removes all watches whose gitrepo is not present in the cluster.

type Watch

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

Watch fetches the latest commit of a git repository referenced by a gitRepo with the syncInterval provided.

func (*Watch) Finish

func (w *Watch) Finish()

Finish stops watching for changes in the git repo.

func (*Watch) GetSyncInterval

func (w *Watch) GetSyncInterval() float64

func (*Watch) Restart

func (w *Watch) Restart(ctx context.Context)

func (*Watch) StartBackgroundSync

func (w *Watch) StartBackgroundSync(ctx context.Context)

StartBackgroundSync fetches the latest commit every syncInternal in a goroutine.

func (*Watch) UpdateGitRepo

func (w *Watch) UpdateGitRepo(gitRepo v1alpha1.GitRepo)

type Watcher

type Watcher interface {
	StartBackgroundSync(ctx context.Context)
	Finish()
	Restart(ctx context.Context)
	UpdateGitRepo(gitRepo v1alpha1.GitRepo)
	GetSyncInterval() float64
}

func NewWatch

func NewWatch(gitRepo v1alpha1.GitRepo, client client.Client) Watcher

Jump to

Keyboard shortcuts

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