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 ¶
- Variables
- func IsPackageError(err error) bool
- type Advancer
- type AlreadyTerminatedError
- type ArgumentError
- type Behavior
- type CmdAbort
- type CmdAbortFiles
- type CmdAbortTartt
- type CmdBeginFiles
- type CmdBeginTartt
- type CmdCommit
- type CmdCommitFiles
- type CmdCommitGc
- type CmdCommitTartt
- type CmdEnd
- type CmdEndFiles
- type CmdInit
- type Event
- type EventTypeError
- type InvalidCommandError
- type JournalError
- type NewEventsError
- type NotIdempotentError
- type State
- func (*State) AggregateState()
- func (s *State) Id() uuid.I
- func (st *State) RegistryId() uuid.I
- func (st *State) RegistryName() string
- func (st *State) RepoGlobalPath() string
- func (st *State) RepoId() uuid.I
- func (s *State) SetVid(vid ulid.I)
- func (st *State) StateCode() StateCode
- func (st *State) StatusCode() int32
- func (st *State) StatusMessage() string
- func (s *State) Vid() ulid.I
- type StateCode
- type StateConflictError
- type UninitializedError
- type Workflows
- func (r *Workflows) Abort(id uuid.I, vid ulid.I, code int32, message string) (ulid.I, error)
- func (r *Workflows) AbortFiles(id uuid.I, vid ulid.I, code int32, message string) (ulid.I, error)
- func (r *Workflows) AbortTartt(id uuid.I, vid ulid.I, code int32, message string) (ulid.I, error)
- func (r *Workflows) BeginFiles(id uuid.I, vid ulid.I, cmd *CmdBeginFiles) (ulid.I, error)
- func (r *Workflows) BeginTartt(id uuid.I, vid ulid.I, cmd *CmdBeginTartt) (ulid.I, error)
- func (r *Workflows) Commit(id uuid.I, vid ulid.I) (ulid.I, error)
- func (r *Workflows) CommitFiles(id uuid.I, vid ulid.I) (ulid.I, error)
- func (r *Workflows) CommitGc(id uuid.I, vid ulid.I) (ulid.I, error)
- func (r *Workflows) CommitTartt(id uuid.I, vid ulid.I) (ulid.I, error)
- func (r *Workflows) End(id uuid.I, vid ulid.I) (ulid.I, error)
- func (r *Workflows) EndFiles(id uuid.I, vid ulid.I) (ulid.I, error)
- func (r *Workflows) FindId(id uuid.I) (*State, error)
- func (r *Workflows) Init(id uuid.I, cmd *CmdInit) (ulid.I, error)
Constants ¶
This section is empty.
Variables ¶
var NoVC = events.NoVC
var RetryNoVC = events.RetryNoVC
Functions ¶
func IsPackageError ¶
Types ¶
type Advancer ¶
type Advancer struct {
// contains filtered or unexported fields
}
The bools indicate which part of the state has been duplicated.
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 CmdAbort ¶
func (*CmdAbort) AggregateCommand ¶
func (*CmdAbort) AggregateCommand()
type CmdAbortFiles ¶
func (*CmdAbortFiles) AggregateCommand ¶
func (*CmdAbortFiles) AggregateCommand()
type CmdAbortTartt ¶
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 ¶
func (*Event) UnmarshalProto ¶
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) RegistryId ¶
func (*State) RegistryName ¶
func (*State) RepoGlobalPath ¶
func (*State) StatusCode ¶
func (*State) StatusMessage ¶
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
}