poll

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2023 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, gitjob *v1.GitJob, 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, gitJob v1.GitJob)

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

func (*Handler) CleanUpWatches

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

CleanUpWatches removes all watches whose gitjob 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 gitJob 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() int

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) UpdateGitJob

func (w *Watch) UpdateGitJob(gitJob v1.GitJob)

type Watcher

type Watcher interface {
	StartBackgroundSync(ctx context.Context)
	Finish()
	Restart(ctx context.Context)
	UpdateGitJob(gitJob v1.GitJob)
	GetSyncInterval() int
}

func NewWatch

func NewWatch(gitJob v1.GitJob, client client.Client) Watcher

Jump to

Keyboard shortcuts

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