runner

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

runner package contains the implementation of a queue of tasks that can perfom actions against a remote api-server

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FakeState

type FakeState struct {
	Context    context.Context
	SentEvents []event.Event
}

func (*FakeState) GetContext

func (s *FakeState) GetContext() context.Context

func (*FakeState) SendEvent

func (s *FakeState) SendEvent(event event.Event)

func (*FakeState) SkipWaitCurrentStatus added in v0.3.0

func (s *FakeState) SkipWaitCurrentStatus(*unstructured.Unstructured) bool

type State

type State interface {
	// GetContext return the Context where to execute task
	GetContext() context.Context

	// SendEvent is used for sending back status updates for the current task
	SendEvent(event.Event)

	// SkipWaitCurrentStatus return if the object has to be skipped for waiting.
	// Return true if for some reasons is knowns that the object cannot be watched
	SkipWaitCurrentStatus(*unstructured.Unstructured) bool
}

State encapsulate the state of the run for sharing data between different tasks execution

type Task

type Task interface {
	// Run is used to execute the action implemented by the Task, progress in the task
	// is expected to be communicated through State
	Run(State)
}

Task provides abstractions that a Task must implement to be able to be used by a Runner

type TaskRunner

type TaskRunner interface {
	// RunWithQueue will start to execute all the tasks that will be found in the channel
	RunWithQueue(State, <-chan Task) error
}

TaskRunner provides abstraction for a TaskRunner implementation

func NewTaskRunner

func NewTaskRunner() TaskRunner

NewTaskRunner return an implementation of TaskRunner

Directories

Path Synopsis
task package contains Tasks implementation that encapsulate actions against an api-server
task package contains Tasks implementation that encapsulate actions against an api-server

Jump to

Keyboard shortcuts

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