unarchiverepowf

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: 5 Imported by: 0

Documentation

Overview

Package `unarchiverepowf` implements the unarchive-repo ephemeral workflow.

Workflow Events

The workflow is initiated by gRPC `BeginUnarchiveRepo()`. It starts the workflow with `WorkflowEvent_EV_FSO_UNARCHIVE_REPO_STARTED` on the workflow and a corresponding `WorkflowEvent_EV_FSO_UNARCHIVE_REPO_STARTED` on the ephemeral registry workflow index.

Nogfsoregd observes the workflow. It changes the repo state to archiving in the registry with `RegistryEvent_EV_FSO_UNARCHIVE_REPO_STARTED` and on the repo with `RepoEvent_EV_FSO_UNARCHIVE_REPO_STARTED`. It then posts `WorkflowEvent_EV_FSO_UNARCHIVE_REPO_FILES_STARTED` on the workflow to notify Nogfsostad.

Nogfsostad observes the workflow. It creates the working directory and saves it in `WorkflowEvent_EV_FSO_UNARCHIVE_REPO_TARTT_STARTED` to tell Nogfsorstd to start `tartt restore`.

Nogfsorstd observes the workflow. It restores the tartt archive to the working directory and then posts `WorkflowEvent_EV_FSO_UNARCHIVE_REPO_TARTT_COMPLETED` to notify Nogfsostad. Errors may be handled by retrying or aborting the workflow.

Nogfsostad applies ACLs, swaps the restored data with the realdir placeholder, and posts `WorkflowEvent_EV_FSO_UNARCHIVE_REPO_FILES_COMPLETED`. Errors may be handled by retrying or by aborting the workflow.

Nogfsoregd then completes the main workflow work: `RepoEvent_EV_FSO_UNARCHIVE_REPO_COMPLETED` on the repo, `RegistryEvent_EV_FSO_UNARCHIVE_REPO_COMPLETED` on the registry, and `WorkflowEvent_EV_FSO_UNARCHIVE_REPO_FILES_COMMITTED`.

Nogfsostad regularly checks whether the garbage has expired. When it has expired, Nogfsostad removes the garbage and posts `WorkflowEvent_EV_FSO_UNARCHIVE_REPO_GC_COMPLETED`.

Nogfsoregd then completes the workflow: `WorkflowEvent_EV_FSO_UNARCHIVE_REPO_COMPLETED` on the workflow, `WorkflowEvent_EV_FSO_UNARCHIVE_REPO_COMPLETED` on the ephemeral registry workflow index, and a final `WorkflowEvent_EV_FSO_UNARCHIVE_REPO_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 was interrupted.

The workflow is eventually deleted from the index with `WorkflowEvent_EV_FSO_UNARCHIVE_REPO_DELETED` on the ephemeral registry workflow index. A workflow may be deleted with or without the final workflow event.

Possible State Paths

Successful unarchive: StateInitialized, StateFiles, StateTartt, StateTarttCompleted, StateFilesCompleted, StateFilesEnded, StateGcCompleted, StateCompleted, StateTerminated.

Error during begin registry or begin repo: StateInitialized, StateFailed, StateTerminated.

Error during tartt restore: StateInitialized, StateFiles, StateTartt, StateTarttFailed, StateFilesEnded, StateGcCompleted, StateFailed, StateTerminated.

Error while moving swapping restored files with the realdir placeholder: StateInitialized, StateFiles, StateTartt, StateTarttCompleted, StateFilesFailed, StateFilesEnded, StateGcCompleted, StateFailed, StateTerminated.

Index

Constants

This section is empty.

Variables

View Source
var NoVC = events.NoVC
View Source
var RetryNoVC = events.RetryNoVC

Functions

func IsPackageError

func IsPackageError(err error) bool

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 AlreadyTerminatedError

type AlreadyTerminatedError struct{}

func (*AlreadyTerminatedError) Error

func (err *AlreadyTerminatedError) Error() string

type ArgumentError

type ArgumentError struct {
	Reason string
}

func (*ArgumentError) Error

func (err *ArgumentError) Error() string

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 CmdAbort

type CmdAbort struct {
	Code    int32
	Message string
}

func (*CmdAbort) AggregateCommand

func (*CmdAbort) AggregateCommand()

type CmdAbortFiles

type CmdAbortFiles struct {
	Code    int32
	Message string
}

func (*CmdAbortFiles) AggregateCommand

func (*CmdAbortFiles) AggregateCommand()

type CmdAbortTartt

type CmdAbortTartt struct {
	Code    int32
	Message string
}

func (*CmdAbortTartt) AggregateCommand

func (*CmdAbortTartt) AggregateCommand()

type CmdBeginFiles

type CmdBeginFiles struct {
	AclPolicy *pb.RepoAclPolicy
}

func (*CmdBeginFiles) AggregateCommand

func (*CmdBeginFiles) AggregateCommand()

type CmdBeginTartt

type CmdBeginTartt struct {
	WorkingDir string
}

func (*CmdBeginTartt) AggregateCommand

func (*CmdBeginTartt) AggregateCommand()

type CmdCommit

type CmdCommit struct{}

func (*CmdCommit) AggregateCommand

func (*CmdCommit) AggregateCommand()

type CmdCommitFiles

type CmdCommitFiles struct{}

func (*CmdCommitFiles) AggregateCommand

func (*CmdCommitFiles) AggregateCommand()

type CmdCommitGc

type CmdCommitGc struct{}

func (*CmdCommitGc) AggregateCommand

func (*CmdCommitGc) AggregateCommand()

type CmdCommitTartt

type CmdCommitTartt struct{}

func (*CmdCommitTartt) AggregateCommand

func (*CmdCommitTartt) AggregateCommand()

type CmdEnd

type CmdEnd struct{}

func (*CmdEnd) AggregateCommand

func (*CmdEnd) AggregateCommand()

type CmdEndFiles

type CmdEndFiles struct{}

func (*CmdEndFiles) AggregateCommand

func (*CmdEndFiles) AggregateCommand()

type CmdInit

type CmdInit struct {
	RegistryId       uuid.I
	RegistryName     string
	StartRegistryVid ulid.I
	RepoId           uuid.I
	StartRepoVid     ulid.I
	RepoGlobalPath   string
	RepoArchiveURL   string
	TarttTarPath     string
	AuthorName       string
	AuthorEmail      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 EventTypeError

type EventTypeError struct{}

func (*EventTypeError) Error

func (err *EventTypeError) Error() string

type InvalidCommandError

type InvalidCommandError struct{}

func (*InvalidCommandError) Error

func (err *InvalidCommandError) Error() string

type JournalError

type JournalError struct {
	Err error
}

func (*JournalError) Error

func (err *JournalError) Error() string

func (*JournalError) Unwrap

func (err *JournalError) Unwrap() error

type NewEventsError

type NewEventsError struct {
	Err error
}

func (*NewEventsError) Error

func (err *NewEventsError) Error() string

func (*NewEventsError) Unwrap

func (err *NewEventsError) Unwrap() error

type NotIdempotentError

type NotIdempotentError struct {
}

func (*NotIdempotentError) Error

func (err *NotIdempotentError) Error() string

type State

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

func (*State) AggregateState

func (*State) AggregateState()

func (*State) Id

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

func (*State) RegistryId

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

func (*State) RegistryName

func (st *State) RegistryName() string

func (*State) RepoGlobalPath

func (st *State) RepoGlobalPath() string

func (*State) RepoId

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

func (*State) SetVid

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

func (*State) StateCode

func (st *State) StateCode() StateCode

func (*State) StatusCode

func (st *State) StatusCode() int32

func (*State) StatusMessage

func (st *State) StatusMessage() string

func (*State) Vid

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

type StateCode

type StateCode int

See package doc for possible state paths.

const (
	StateUninitialized StateCode = iota
	StateInitialized

	StateFiles
	StateTartt
	StateTarttCompleted
	StateTarttFailed
	StateFilesCompleted
	StateFilesFailed
	StateFilesEnded

	StateGcCompleted

	StateCompleted
	StateFailed

	StateTerminated
)

type StateConflictError

type StateConflictError struct{}

func (*StateConflictError) Error

func (err *StateConflictError) Error() string

type UninitializedError

type UninitializedError struct{}

func (*UninitializedError) Error

func (err *UninitializedError) Error() string

type Workflows

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

func New

func New(journal *events.Journal) *Workflows

func (*Workflows) Abort

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

func (*Workflows) AbortFiles

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

func (*Workflows) AbortTartt

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

func (*Workflows) BeginFiles

func (r *Workflows) BeginFiles(
	id uuid.I, vid ulid.I, cmd *CmdBeginFiles,
) (ulid.I, error)

func (*Workflows) BeginTartt

func (r *Workflows) BeginTartt(
	id uuid.I, vid ulid.I, cmd *CmdBeginTartt,
) (ulid.I, error)

func (*Workflows) Commit

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

func (*Workflows) CommitFiles

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

func (*Workflows) CommitGc

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

func (*Workflows) CommitTartt

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

func (*Workflows) End

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

func (*Workflows) EndFiles

func (r *Workflows) EndFiles(id uuid.I, vid ulid.I) (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