poll

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Copyright (c) 2021-2024 SUSE LLC

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GitRepoPollKey

func GitRepoPollKey(gitRepo v1alpha1.GitRepo) *quartz.JobKey

Types

type GitFetcher

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

type GitRepoPollJob

type GitRepoPollJob struct {
	GitRepo v1alpha1.GitRepo
	// contains filtered or unexported fields
}

func NewGitRepoPollJob

func NewGitRepoPollJob(c client.Client, f GitFetcher, gitRepo v1alpha1.GitRepo) *GitRepoPollJob

func (*GitRepoPollJob) Description

func (j *GitRepoPollJob) Description() string

func (*GitRepoPollJob) Execute

func (j *GitRepoPollJob) Execute(ctx context.Context) error

func (*GitRepoPollJob) String

func (j *GitRepoPollJob) String() string

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(ctx context.Context, client client.Client) *Handler

func (*Handler) AddOrModifyGitRepoPollJob

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

AddOrModifyGitRepoPollJob adds a new scheduled job for the gitrepo if no job was already present. It updates the existing job for this gitrepo if present.

func (*Handler) CleanUpGitRepoPollJobs

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

CleanUpGitRepoPollJobs removes all poll jobs whose gitrepo is not present in the cluster.

type Watcher

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

Jump to

Keyboard shortcuts

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