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
- Variables
- type ActionDescription
- type ActionsManager
- func (m *ActionsManager) ActionById(actionId string) (ConcreteAction, bool)
- func (m *ActionsManager) DescribeActions(languages ...string) map[string]ActionDescription
- func (m *ActionsManager) LoadActionForm(actionID string) (*forms.Form, error)
- func (m *ActionsManager) Register(name string, a Concrete)
- type Concrete
- type ConcreteAction
- type ControllableAction
- type DescriptionProviderAction
- type ProgressProviderAction
- type RecursiveNodeWalkerAction
- type RunnableChannels
- type TaskParameter
- func (f *TaskParameter) Bool(ctx context.Context, input *jobs.ActionMessage) (bool, error)
- func (f *TaskParameter) Int(ctx context.Context, input *jobs.ActionMessage) (int, error)
- func (f *TaskParameter) Int64(ctx context.Context, input *jobs.ActionMessage) (int64, error)
- func (f *TaskParameter) IsMultiple() bool
- func (f *TaskParameter) IsSwitch() bool
- func (f *TaskParameter) MustBool(ctx context.Context, input *jobs.ActionMessage) bool
- func (f *TaskParameter) MustInt(ctx context.Context, input *jobs.ActionMessage) int
- func (f *TaskParameter) MustInt64(ctx context.Context, input *jobs.ActionMessage) int64
- func (f *TaskParameter) Occurrences() (oo []*TaskParameters)
- func (f *TaskParameter) Raw() string
- func (f *TaskParameter) String(ctx context.Context, input *jobs.ActionMessage) string
- func (f *TaskParameter) SwitchValues() (string, *TaskParameters)
- type TaskParameters
- func (p *TaskParameters) Bool(name string) (bool, error)
- func (p *TaskParameters) Get(s string) *TaskParameter
- func (p *TaskParameters) InitParameters(f *forms.Form, a *jobs.Action)
- func (p *TaskParameters) Int(name string) (int, error)
- func (p *TaskParameters) Int64(name string) (int64, error)
- func (p *TaskParameters) MustBool(name string) bool
- func (p *TaskParameters) MustInt(name string) int
- func (p *TaskParameters) MustInt64(name string) int64
- func (p *TaskParameters) String(name string) string
- func (p *TaskParameters) WithParametersRuntime(ctx context.Context, input *jobs.ActionMessage)
- type TaskUpdaterDelegateAction
Constants ¶
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 ¶
var CategoryTints = map[string]string{ ActionCategoryTree: "#03a9f4", ActionCategoryArchives: "#fbc02d", ActionCategoryScheduler: "#009688", ActionCategoryPutGet: "#4caf50", ActionCategoryCmd: "#795548", ActionCategoryContents: "#f44336", ActionCategoryIDM: "#438db3", ActionCategoryNotify: "#ff9800", ActionCategoryETL: "#009688", }
var (
IgnoredActionName = "$action.internal.ignored$"
)
Functions ¶
This section is empty.
Types ¶
type ActionDescription ¶
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 { common.RuntimeProvider // GetName returns a unique identifier GetName() string // Init initialize parameters Init(job *jobs.Job, action *jobs.Action) error // Run performs 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 ¶
ControllableAction 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
}
ProgressProviderAction Actions that implement this interface will publish progress updates on the progress channel.
type RecursiveNodeWalkerAction ¶
type RecursiveNodeWalkerAction interface {
SetNodeFilterAsWalkFilter(*jobs.NodesSelector)
}
RecursiveNodeWalkerAction 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{} // 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(ctx context.Context, maxPauseTime ...time.Duration) chan interface{}
BlockUntilResume returns a blocking channel that can be inserted anywhere to block execution
func (*RunnableChannels) WrapReader ¶
func (r *RunnableChannels) WrapReader(readerOrCloser io.Reader, targetSize int64) io.ReadCloser
WrapReader wraps a reader (or a readCloser) into an io.ReadCloser and publishes the progress on the channels.Progress
type TaskParameter ¶
TaskParameter encapsulates a form parameter and its value at runtime. There are three modes :
- Basic types (FormField) always pass values as string (to be evaluated)
- Replicable Fields may find 0 or N occurrences of a map[string]*TaskParameter
- SwitchField has a switch value and corresponding set of subvalues as map[string]*TaskParameter
func (*TaskParameter) Bool ¶
func (f *TaskParameter) Bool(ctx context.Context, input *jobs.ActionMessage) (bool, error)
func (*TaskParameter) Int ¶
func (f *TaskParameter) Int(ctx context.Context, input *jobs.ActionMessage) (int, error)
func (*TaskParameter) Int64 ¶
func (f *TaskParameter) Int64(ctx context.Context, input *jobs.ActionMessage) (int64, error)
func (*TaskParameter) IsMultiple ¶
func (f *TaskParameter) IsMultiple() bool
func (*TaskParameter) IsSwitch ¶
func (f *TaskParameter) IsSwitch() bool
func (*TaskParameter) MustBool ¶
func (f *TaskParameter) MustBool(ctx context.Context, input *jobs.ActionMessage) bool
func (*TaskParameter) MustInt ¶
func (f *TaskParameter) MustInt(ctx context.Context, input *jobs.ActionMessage) int
func (*TaskParameter) MustInt64 ¶
func (f *TaskParameter) MustInt64(ctx context.Context, input *jobs.ActionMessage) int64
func (*TaskParameter) Occurrences ¶
func (f *TaskParameter) Occurrences() (oo []*TaskParameters)
Occurrences returns a slice of TaskParameters, each one containing the map of TaskParameter
func (*TaskParameter) Raw ¶
func (f *TaskParameter) Raw() string
Raw returns the raw value as string
func (*TaskParameter) String ¶
func (f *TaskParameter) String(ctx context.Context, input *jobs.ActionMessage) string
func (*TaskParameter) SwitchValues ¶
func (f *TaskParameter) SwitchValues() (string, *TaskParameters)
SwitchValues returns both the selected value and the sub form data as a TaskParameters container
type TaskParameters ¶
type TaskParameters struct {
// contains filtered or unexported fields
}
TaskParameters encapsulates action.Parameters at runtime. Use it as a composable struct in ConcreteAction implementations Do not forget to call InitParameters at runtime.
func (*TaskParameters) Bool ¶
func (p *TaskParameters) Bool(name string) (bool, error)
Bool evaluates underlying value to bool
func (*TaskParameters) Get ¶
func (p *TaskParameters) Get(s string) *TaskParameter
Get returns a *TaskParameter for a specific key
func (*TaskParameters) InitParameters ¶
func (p *TaskParameters) InitParameters(f *forms.Form, a *jobs.Action)
InitParameters MUST be called at action.Init
func (*TaskParameters) Int ¶
func (p *TaskParameters) Int(name string) (int, error)
Int evaluates underlying value to int
func (*TaskParameters) Int64 ¶
func (p *TaskParameters) Int64(name string) (int64, error)
Int64 evaluates underlying value to int64
func (*TaskParameters) MustBool ¶
func (p *TaskParameters) MustBool(name string) bool
MustBool evaluates underlying value to bool without error checking
func (*TaskParameters) MustInt ¶
func (p *TaskParameters) MustInt(name string) int
MustInt evaluates underlying value to int without error checking
func (*TaskParameters) MustInt64 ¶
func (p *TaskParameters) MustInt64(name string) int64
MustInt64 evaluates underlying value to int64 without error checking
func (*TaskParameters) String ¶
func (p *TaskParameters) String(name string) string
String evaluates underlying value to string
func (*TaskParameters) WithParametersRuntime ¶
func (p *TaskParameters) WithParametersRuntime(ctx context.Context, input *jobs.ActionMessage)
WithParametersRuntime sets context and input message for further evaluations
type TaskUpdaterDelegateAction ¶
TaskUpdaterDelegateAction 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 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. |