Documentation ¶
Overview ¶
Package `moverepowf` implements the move-repo workflow, which simultaneously changes the location of a real repo and its shadow repo.
The workflow supports passing the repo to a different Nogfsostad instance.
Workflow Events ¶
The workflow is initiated on a registry with `RegistryEvent_EV_FSO_REPO_MOVE_ACCEPTED`, currently by an admin using `nogfsoctl begin-move-repo`.
The old Nogfsostad, the new Nogfsostad, and Nogappd observe the registry event and start watching the workflow.
Nogfsoregd repoinit determines the file host details and posts `RepoEvent_EV_FSO_REPO_MOVE_STARTED`.
Nogfsoregd replicate initializes the workflow aggregate with `WorkflowEvent_EV_FSO_REPO_MOVE_STARTED`.
Nogappd posts `WorkflowEvent_EV_FSO_REPO_MOVE_APP_ACCEPTED` to confirm that the repo has been disabled and is ready to be moved to the the new repo location. The event should only be used on a system level, for example to confirm that Nogappd has updated the MongoDB state. The event should not be used to implement a GUI workflow that involves user interaction. One assumption is that a workflow makes steady progress if all systems are functioning properly, without being blocked for an unknown period, because it is waiting for a user.
The old Nogfsostad disables the repo and posts `WorkflowEvent_EV_FSO_REPO_MOVE_STA_RELEASED` to confirm that the repo has been released.
The new Nogfsostad determines the new shadow location. It logs a message that asks an admin to move the real repo and the shadow repo. This step should be automated in the future, by calling a sudo-like service to execute a privileged operation. For now, an admin moves the repos, changes ownership if necessary, and confirms with `nogfsoctl commit-move-repo` which yields `WorkflowEvent_EV_FSO_REPO_MOVED`.
Nogfsoregd replicate commits the move with `RepoEvent_EV_FSO_REPO_MOVED` and `RegistryEvent_EV_FSO_REPO_MOVED`. It terminates the workflow with `WorkflowEvent_EV_FSO_REPO_MOVE_COMMITTED`.
Nogappd and the new Nogfsostad both enable the repo at the new location.
Index ¶
- Variables
- type Advancer
- type Behavior
- type CmdCommit
- type CmdExit
- type CmdInit
- type CmdPostAppAccepted
- type CmdPostStadReleased
- type Event
- type State
- type Workflows
- func (r *Workflows) Commit(id uuid.I, vid ulid.I, newShadowPath string) (ulid.I, error)
- func (r *Workflows) Exit(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)
- func (r *Workflows) PostAppAccepted(id uuid.I, vid ulid.I) (ulid.I, error)
- func (r *Workflows) PostStadReleased(id uuid.I, vid ulid.I) (ulid.I, error)
Constants ¶
This section is empty.
Variables ¶
var ErrConflict = errors.New("workflow conflict")
var ErrConflictInit = errors.New("workflow init conflict")
var ErrConflictStateAdvanced = errors.New("workflow state has advanced")
var ErrInvalidCommand = errors.New("invalid workflow command")
var ErrInvalidEventType = errors.New("invalid event type")
var ErrMoved = errors.New("workflow move completed")
var ErrNotMoved = errors.New("workflow did not complete move")
var ErrStaActive = errors.New("nogfsostad has yet not disabled the repo")
var ErrTerminated = errors.New("workflow terminated")
var ErrUninitialized = errors.New("workflow uninitialized")
var NoVC = events.NoVC
`NoVC` is a sentinel value that can be passed in place of `vid` to indicate that concurrency version checks are skipped.
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.
type CmdCommit ¶
type CmdCommit struct {
NewShadowPath string
}
func (*CmdCommit) AggregateCommand ¶
func (*CmdCommit) AggregateCommand()
type CmdExit ¶
type CmdExit struct{}
func (*CmdExit) AggregateCommand ¶
func (*CmdExit) AggregateCommand()
type CmdInit ¶
type CmdInit struct { RepoId uuid.I RepoEventId ulid.I OldGlobalPath string OldFileHost string OldHostPath string OldShadowPath string NewGlobalPath string NewFileHost string NewHostPath string }
func (*CmdInit) AggregateCommand ¶
func (*CmdInit) AggregateCommand()
type CmdPostAppAccepted ¶
type CmdPostAppAccepted struct{}
func (*CmdPostAppAccepted) AggregateCommand ¶
func (*CmdPostAppAccepted) AggregateCommand()
type CmdPostStadReleased ¶
type CmdPostStadReleased struct{}
func (*CmdPostStadReleased) AggregateCommand ¶
func (*CmdPostStadReleased) AggregateCommand()
type Event ¶
func (*Event) UnmarshalProto ¶
type State ¶
type State struct {
// contains filtered or unexported fields
}
func (*State) AggregateState ¶
func (*State) AggregateState()
func (*State) IsTerminated ¶
type Workflows ¶
type Workflows struct {
// contains filtered or unexported fields
}
func (*Workflows) Exit ¶
`Exit()` terminates the workflow.
The workflow can currently only terminate successfully, which may change in the future when we add more error handling.
func (*Workflows) Init ¶
`Init()` initializes a workflow.
Nogfsoregd replicate calls it on `RepoEvent_EV_FSO_REPO_MOVE_STARTED`.
func (*Workflows) PostAppAccepted ¶
`PostAppAccepted()` adds an event that indicates that Nogappd has acknowledged the move.