durootwf

package
v0.0.0-...-4450389 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2019 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package `durootwf` implements the du-root ephemeral workflow, which runs the Unix command `du` on an FSO root.

Workflow Events

The workflow is initialized with `WorkflowEvent_EV_FSO_DU_ROOT_STARTED` on the workflow aggregated and a corresponding `WorkflowEvent_EV_FSO_DU_ROOT_STARTED` on the ephemeral workflow index.

Nogfsostad observes the workflow and posts the `du` output as multiple `WorkflowEvent_EV_FSO_DU_UPDATED` events, followed by `WorkflowEvent_EV_FSO_DU_ROOT_COMPLETED`.

Nogfsostad commits the workflow, which stores `WorkflowEvent_EV_FSO_DU_ROOT_COMPLETED` on the workflow index and a final `WorkflowEvent_EV_FSO_DU_ROOT_COMMITTED` on the workflow.

The final workflow event has no observable side effect. Its only purpose is to explicitly confirm termination of the workflow history. The final event may be missing if a multi-step command to complete the workflow gets interrupted.

Index

Constants

View Source
const StatusCodeExpired = 104

Use same value as `GetSplitRootO_SC_EXPIRED` in case we want to unify in the future.

Variables

View Source
var ErrConflictInit = errors.New("workflow init conflict")
View Source
var ErrConflictState = errors.New("command conflicts with current state")
View Source
var ErrConflictStateAdvanced = errors.New("workflow state has advanced")
View Source
var ErrInvalidCommand = errors.New("invalid workflow command")
View Source
var ErrInvalidEventType = errors.New("invalid event type")
View Source
var ErrUninitialized = errors.New("workflow uninitialized")
View Source
var NoVC = events.NoVC
View Source
var RetryNoVC = events.RetryNoVC

Functions

This section is empty.

Types

type Advancer

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

The bools indicate which part of the state has been duplicated.

func (*Advancer) Advance

func (a *Advancer) Advance(s events.State, ev events.Event) events.State

type Behavior

type Behavior struct{}

func (Behavior) NewAdvancer

func (Behavior) NewAdvancer() events.Advancer

func (Behavior) NewEvent

func (Behavior) NewEvent() events.Event

func (Behavior) NewState

func (Behavior) NewState(id uuid.I) events.State

func (Behavior) Tell

func (Behavior) Tell(
	s events.State, c events.Command,
) ([]events.Event, error)

type CmdAbortExpired

type CmdAbortExpired struct{}

func (*CmdAbortExpired) AggregateCommand

func (*CmdAbortExpired) AggregateCommand()

type CmdAppend

type CmdAppend struct {
	Path  string
	Usage int64
}

func (*CmdAppend) AggregateCommand

func (*CmdAppend) AggregateCommand()

type CmdCommit

type CmdCommit struct{}

func (*CmdCommit) AggregateCommand

func (*CmdCommit) AggregateCommand()

type CmdDelete

type CmdDelete struct{}

func (*CmdDelete) AggregateCommand

func (*CmdDelete) AggregateCommand()

type CmdEnd

type CmdEnd struct{}

func (*CmdEnd) AggregateCommand

func (*CmdEnd) AggregateCommand()

type CmdFail

type CmdFail struct {
	Code    int32
	Message string
}

func (*CmdFail) AggregateCommand

func (*CmdFail) AggregateCommand()

type CmdInit

type CmdInit struct {
	RegistryId uuid.I
	GlobalRoot string
	Host       string
	HostRoot   string
}

func (*CmdInit) AggregateCommand

func (*CmdInit) AggregateCommand()

type Event

type Event struct{ wfev.Event }

func (*Event) UnmarshalProto

func (ev *Event) UnmarshalProto(data []byte) error

type State

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

func (*State) AggregateState

func (*State) AggregateState()

func (*State) GlobalRoot

func (st *State) GlobalRoot() string

func (*State) Id

func (s *State) Id() uuid.I

func (*State) RegistryId

func (st *State) RegistryId() uuid.I

func (*State) SetVid

func (s *State) SetVid(vid ulid.I)

func (*State) Vid

func (s *State) Vid() ulid.I

type StateCode

type StateCode int
const (
	StateUninitialized StateCode = iota
	StateInitialized
	StateAppending
	StateCompleted
	StateTerminated
)

type Workflows

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

func New

func New(journal *events.Journal) *Workflows

func (*Workflows) AbortExpired

func (r *Workflows) AbortExpired(id uuid.I, vid ulid.I) (ulid.I, error)

func (*Workflows) Append

func (r *Workflows) Append(
	id uuid.I, vid ulid.I, cmd *CmdAppend,
) (ulid.I, error)

func (*Workflows) Commit

func (r *Workflows) Commit(id uuid.I, vid ulid.I) (ulid.I, error)

func (*Workflows) Delete

func (w *Workflows) Delete(id uuid.I, vid ulid.I) error

func (*Workflows) End

func (r *Workflows) End(id uuid.I, vid ulid.I) (ulid.I, error)

func (*Workflows) Fail

func (r *Workflows) Fail(
	id uuid.I, vid ulid.I, code int32, message string,
) (ulid.I, error)

func (*Workflows) FindId

func (r *Workflows) FindId(id uuid.I) (*State, error)

func (*Workflows) Init

func (r *Workflows) Init(id uuid.I, cmd *CmdInit) (ulid.I, error)

Jump to

Keyboard shortcuts

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