polling

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2017 License: BSD-3-Clause Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	RunningPollers = struct {
		Workers map[string]*Worker
		mutex   *sync.RWMutex
	}{
		Workers: map[string]*Worker{},
		// contains filtered or unexported fields
	}
)

RunningPollers is the map of all runningPollers

Functions

func ExecutionCleaner

func ExecutionCleaner()

ExecutionCleaner is globale goroutine to remove all old polling traces

func Initialize

func Initialize()

Initialize all existing pollers (one poller per project)

func TriggerPipeline

func TriggerPipeline(tx *sql.Tx, rm *sdk.RepositoriesManager, poller *sdk.RepositoryPoller, e sdk.VCSPushEvent, projectData *sdk.Project) (bool, error)

TriggerPipeline linked to received hook

Types

type Worker

type Worker struct {
	ProjectKey string `json:"project"`
}

Worker represent a goroutine for each project responsible of repo polling

func NewWorker

func NewWorker(key string) *Worker

NewWorker Initializes a new worker struct

func (*Worker) Poll

func (w *Worker) Poll() (bool, chan bool, error)

Poll initiate a poller

type WorkerExecution

type WorkerExecution struct {
	ID          int64              `json:"id"`
	Project     string             `json:"project"`
	Application string             `json:"application"`
	Pipeline    string             `json:"pipeline"`
	Execution   time.Time          `json:"execution"`
	Status      string             `json:"status"`
	Events      []sdk.VCSPushEvent `json:"events,omitempty"`
}

WorkerExecution represents a worker execution for a poller instance

func LoadExecutions

func LoadExecutions(db database.QueryExecuter, project, application, pipeline string) ([]WorkerExecution, error)

LoadExecutions returns all executions in database

Jump to

Keyboard shortcuts

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