actions

package
v2.2.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2021 License: AGPL-3.0 Imports: 7 Imported by: 0

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

View Source
const (
	ActionCategoryTree      = "01 - Files/Folders Operations"
	ActionCategoryArchives  = "02 - Archives Operations"
	ActionCategoryScheduler = "03 - Scheduler Tools / Internals"
	ActionCategoryPutGet    = "04 - Upload/Download to External Servers"
	ActionCategoryCmd       = "05 - Atomic Commands and Scripts"
	ActionCategoryContents  = "06 - Contents Processing"
	ActionCategoryIDM       = "07 - Identity Management"
	ActionCategoryNotify    = "08 - Notifications and Emails"
	ActionCategoryETL       = "09 - Extract/Load/Transform"
)

Variables

View Source
var CategoryTints = map[string]string{
	ActionCategoryTree:      "#03a9f4",
	ActionCategoryArchives:  "#fbc02d",
	ActionCategoryScheduler: "#009688",
	ActionCategoryPutGet:    "#4caf50",
	ActionCategoryCmd:       "#795548",
	ActionCategoryContents:  "#f44336",
	ActionCategoryIDM:       "#438db3",
	ActionCategoryNotify:    "#ff9800",
	ActionCategoryETL:       "#009688",
}
View Source
var (
	IgnoredActionName = "$action.internal.ignored$"
)

Functions

This section is empty.

Types

type ActionDescription

type ActionDescription struct {
	ID                string
	Label             string
	Icon              string
	IsInternal        bool
	Description       string
	Category          string
	Tint              string
	InputDescription  string
	OutputDescription string
	SummaryTemplate   string
	HasForm           bool
	FormModule        string
	FormModuleProps   string
}

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) DescribeActions

func (m *ActionsManager) DescribeActions(languages ...string) map[string]ActionDescription

DescribeActions provides a list of all registered actions

func (*ActionsManager) LoadActionForm

func (m *ActionsManager) LoadActionForm(actionID string) (*forms.Form, error)

LoadActionForm tries to load a forms.Form object that can be serialized for frontend

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 DescriptionProviderAction

type DescriptionProviderAction interface {
	GetDescription(lang ...string) ActionDescription
	GetParametersForm() *forms.Form
}

DescriptionProviderAction has a human-readable label

type ProgressProviderAction

type ProgressProviderAction interface {
	ProvidesProgress() bool
}

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

type RecursiveNodeWalkerAction

type RecursiveNodeWalkerAction interface {
	SetNodeFilterAsWalkFilter(*jobs.NodesSelector)
}

Actions that implement this interface may perform some recursive nodes listing internally. If the action definition has a NodeFilter set, pass this along to the running instance to filter nodes on the go.

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