poller

package
v0.0.0-...-6a5243a Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2020 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Change

type Change struct {
	Repository string
	Reference  string
	Old        string
	New        string
}

Change is a difference in repository

func (Change) String

func (c Change) String() string

String returns the string representation of Change

type Git

type Git struct {
}

Git is a git client that implemnts the SourceControl interface

func (Git) GetRef

func (g Git) GetRef(repository, reference string) (string, error)

GetRef retrieves the git commit id of a reference in repository

type PollError

type PollError struct {
	Err        error
	Repository string
	Reference  string
}

PollError represents an error during polling

func (PollError) Error

func (p PollError) Error() string

Error describes the polling error

type PollOpts

type PollOpts struct {
	Repositories []RepositoryPollOpts
}

PollOpts defines configuration for polling, including what to poll and polling interval

type Poller

type Poller interface {
	// Poll checks for changes in a remote
	Poll(ctx context.Context, opts *PollOpts, changes chan<- Change, errs chan<- PollError)
}

Poller is an abstract interface for polling

func New

func New(logger *log.Logger, store store.Store, scm SourceControl) Poller

New creates a new poller object

type RepositoryPollOpts

type RepositoryPollOpts struct {
	RemoteURL string `yaml:"remote_url"`
	Reference string
	Interval  time.Duration
}

RepositoryPollOpts defines configuration for a single reference polling

type SourceControl

type SourceControl interface {
	GetRef(repository, reference string) (string, error)
}

SourceControl is an abstract type of SCM

Jump to

Keyboard shortcuts

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