actions

package
v2.0.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2019 License: AGPL-3.0 Imports: 5 Imported by: 125

Documentation

Overview

Package actions provides interfaces to manage tasks and provides default implementation for common actions.

Action are registered by ID during the init phase of each actions' subfolder

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ActionsManager

type ActionsManager struct {
	// contains filtered or unexported fields
}

func GetActionsManager

func GetActionsManager() *ActionsManager

GetActionsManager provides global access to the default action manager.

func (*ActionsManager) ActionById

func (m *ActionsManager) ActionById(actionId string) (ConcreteAction, bool)

func (*ActionsManager) Register

func (m *ActionsManager) Register(name string, a Concrete)

type Concrete

type Concrete func() ConcreteAction

type ConcreteAction

type ConcreteAction interface {

	// Unique identifier
	GetName() string
	// Pass parameters
	Init(job *jobs.Job, cl client.Client, action *jobs.Action) error
	// Run the actual action code
	Run(ctx context.Context, channels *RunnableChannels, input jobs.ActionMessage) (jobs.ActionMessage, error)
}

ConcreteAction is the base interface for pydio actions. All actions must implement this interface.

type ControllableAction

type ControllableAction interface {
	CanPause() bool
	CanStop() bool
}

Actions that implement this interface can eventually be stopped and/or paused+resumed

type ProgressProviderAction

type ProgressProviderAction interface {
	ProvidesProgress() bool
}

Actions that implement this interface will publish progress updates on the progress channel.

type RunnableChannels

type RunnableChannels struct {
	// Input Channels
	Pause  chan interface{}
	Resume chan interface{}
	Stop   chan interface{}
	// Output Channels
	Status    chan jobs.TaskStatus
	StatusMsg chan string
	Progress  chan float32
}

RunnableChannels defines the API to communicate with a Runnable via Channels

func (*RunnableChannels) BlockUntilResume

func (r *RunnableChannels) BlockUntilResume(maxPauseTime ...time.Duration) chan interface{}

BlockUntilResume returns a blocking channel that can be inserted anywhere to block execution

type TaskUpdaterDelegateAction

type TaskUpdaterDelegateAction interface {
	SetTask(task *jobs.Task)
}

Actions that implement this interface can send their status updates to a parent task

Directories

Path Synopsis
Package archive provides implementation of actions to work with archive files.
Package archive provides implementation of actions to work with archive files.
Package archive provides implementation of actions to work with archive files.
Package archive provides implementation of actions to work with archive files.
Package cmd provides default implementation for command-line-like actions.
Package cmd provides default implementation for command-line-like actions.
Package images provides default implementation of image related tasks.
Package images provides default implementation of image related tasks.
Package scheduler provides default implementation for basic scheduler tasks.
Package scheduler provides default implementation for basic scheduler tasks.
Package tree provides default implementation for tree related tasks.
Package tree provides default implementation for tree related tasks.

Jump to

Keyboard shortcuts

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