Documentation ¶
Overview ¶
Package `splitrootwf` implements the split-root ephemeral workflow, which analyzes the disk usage below a root an suggests new repos.
Registry Configuration Events ¶
The configuration is stored as essential registry state.
`RegistryEvent_EV_FSO_SPLIT_ROOT_ENABLED` enables the workflow for a root, so that an admin can use `nogfsoctl split-root begin`.
`RegistryEvent_EV_FSO_SPLIT_ROOT_DISABLED` disables the workflow.
`RegistryEvent_FSO_SPLIT_ROOT_PARAMS_UPDATED` sets new workflow parameters for a root. A workflow uses default parameters if the parameters were never set.
`RegistryEvent_EV_FSO_PATH_FLAG_SET` adds a path flag, such as `DONT_SPLIT`. Path flags are conceptually a set `{ (path, flag) }`. The flags are encoded as a bit mask. `RegistryEvent_EV_FSO_PATH_FLAG_UNSET` removes a path flag.
Workflow Events ¶
An admin uses `nogfsoctl split-root begin` to initialize a workflow to determine the current disk usage and compare it to the existing repos in order to suggest new repos. The first events are `WorkflowEvent_EV_FSO_SPLIT_REPO_STARTED` on the workflow and a corresponding `WorkflowEvent_EV_FSO_SPLIT_REPO_STARTED` on the ephemeral registry workflow index.
Nogfsostad observes the workflow. It posts the `du` output as multiple `WorkflowEvent_EV_FSO_SPLIT_ROOT_DU_APPENDED`, followed by `WorkflowEvent_EV_FSO_SPLIT_ROOT_DU_COMPLETED`.
Nogfsoregd analyzes the disk usage and posts suggestions as a series of `WorkflowEvent_EV_FSO_SPLIT_ROOT_SUGGESTION_APPENDED` followed by `WorkflowEvent_EV_FSO_SPLIT_ROOT_ANALYSIS_COMPLETED`.
The admin uses `nogfsoctl split-root get` and `nogfsoctl split-root decide` to post the conclusion as a series of `WorkflowEvent_EV_FSO_SPLIT_ROOT_DECISION_APPENDED`, which may initialize new repos and modify the registry split-root configuration.
The admin finally uses `nogfsoctl split-root commit` to complete the workflow with `WorkflowEvent_EV_FSO_SPLIT_ROOT_COMPLETED` on the workflow, `WorkflowEvent_EV_FSO_SPLIT_ROOT_COMPLETED` on the workflow index, and a final `WorkflowEvent_EV_FSO_SPLIT_ROOT_COMMITTED` on the workflow.
The admin can use `nogfsoctl split-root abort` to cancel the workflow without decisions.
XXX Nogfsoregd could be change to automatically commit the workflow when there are no more pending decisions.
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.
Workflows are eventually deleted from the index with `WorkflowEvent_EV_FSO_SPLIT_ROOT_DELETED` on the index. Workflows may be deleted with or without the final `WorkflowEvent_EV_FSO_SPLIT_ROOT_COMMITTED` on the workflow.
Authorization ¶
See implementation in `nogfsoregd/registryd/split-root.go` for details.
Workflow config:
A root admin may read the config.
But only an registry admin may change it.
read: action `fso/read-root` on root path.
create, update, delete: action `fso/admin-registry` on registry name.
Path flags:
A root admin may read and add flags.
But only an registry admin may delete flags.
Nogfsoregd may list the flags for workflow execution.
create: action `fso/admin-root` on root path.
delete: action `fso/admin-registry` on registry name.
list: action `fso/read-root` or `fso/exec-split-root` on root path.
Workflow:
A root admin may start a workflow.
Nogfsostad and Nogfsoregd may execute their tasks.
A root admin may append decisions and commit.
Nogfsoregd may abort the workflow to handle errors.
begin: action `fso/admin-root` on root path.
append, commit, abort du: action `fso/exec-du` on root path.
append, commit, abort suggestions: action `fso/exec-split-root` on root path.
decisions: action `fso/admin-root` on root path and `fso/init-repo` for new repo paths.
commit workflow: action `fso/admin-root` on root path.
abort workflow: action `fso/admin-root` or `fso/exec-split-root` on root path.
Index ¶
- Constants
- Variables
- func IsPackageError(err error) bool
- type Advancer
- type Behavior
- type CmdAbort
- type CmdAbortAnalysis
- type CmdAbortDu
- type CmdAbortExpired
- type CmdAppendDecision
- type CmdAppendDus
- type CmdAppendSuggestions
- type CmdCommit
- type CmdCommitAnalysis
- type CmdCommitDu
- type CmdDelete
- type CmdEnd
- type CmdInit
- type Decision
- type Event
- type EventTypeError
- type InvalidCommandError
- type JournalError
- type NewEventsError
- type NotCandidateError
- type NotIdempotentError
- type PathUsage
- type ResourceExhaustedError
- type State
- func (*State) AggregateState()
- func (st *State) Decisions() []Decision
- func (st *State) Du() []PathUsage
- func (st *State) GlobalRoot() string
- func (s *State) Id() uuid.I
- func (st *State) IsCandidate(path string) bool
- func (st *State) RegistryId() 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 (st *State) Suggestions() []Suggestion
- func (s *State) Vid() ulid.I
- type StateCode
- type StateConflictError
- type Suggestion
- type UndecidedCandidatesError
- type UninitializedError
- type Workflows
- func (r *Workflows) Abort(id uuid.I, vid ulid.I, code int32, message string) (ulid.I, error)
- func (r *Workflows) AbortAnalysis(id uuid.I, vid ulid.I, code int32, message string) (ulid.I, error)
- func (r *Workflows) AbortDu(id uuid.I, vid ulid.I, code int32, message string) (ulid.I, error)
- func (r *Workflows) AbortExpired(id uuid.I, vid ulid.I) (ulid.I, error)
- func (r *Workflows) AppendDecision(id uuid.I, vid ulid.I, path string, decision pb.FsoSplitRootDecision_Decision) (ulid.I, error)
- func (r *Workflows) AppendDu(id uuid.I, vid ulid.I, path string, usage int64) (ulid.I, error)
- func (r *Workflows) AppendDus(id uuid.I, vid ulid.I, dus []PathUsage) (ulid.I, error)
- func (r *Workflows) AppendSuggestion(id uuid.I, vid ulid.I, path string, ...) (ulid.I, error)
- func (r *Workflows) AppendSuggestions(id uuid.I, vid ulid.I, suggestions []Suggestion) (ulid.I, error)
- func (r *Workflows) Commit(id uuid.I, vid ulid.I) (ulid.I, error)
- func (r *Workflows) CommitAnalysis(id uuid.I, vid ulid.I) (ulid.I, error)
- func (r *Workflows) CommitDu(id uuid.I, vid ulid.I) (ulid.I, error)
- func (w *Workflows) Delete(id uuid.I, vid ulid.I) error
- func (r *Workflows) End(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 ¶
const ConfigMaxDuPaths = 300
const ConfigMaxSuggestions = 300
const StatusCodeExpired = int32(pb.GetSplitRootO_SC_EXPIRED)
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 CmdAbort ¶
func (*CmdAbort) AggregateCommand ¶
func (*CmdAbort) AggregateCommand()
type CmdAbortAnalysis ¶
func (*CmdAbortAnalysis) AggregateCommand ¶
func (*CmdAbortAnalysis) AggregateCommand()
type CmdAbortDu ¶
func (*CmdAbortDu) AggregateCommand ¶
func (*CmdAbortDu) AggregateCommand()
type CmdAbortExpired ¶
type CmdAbortExpired struct{}
func (*CmdAbortExpired) AggregateCommand ¶
func (*CmdAbortExpired) AggregateCommand()
type CmdAppendDecision ¶
type CmdAppendDecision struct { Path string Decision pb.FsoSplitRootDecision_Decision }
func (*CmdAppendDecision) AggregateCommand ¶
func (*CmdAppendDecision) AggregateCommand()
type CmdAppendDus ¶
type CmdAppendDus struct {
Paths []PathUsage
}
func (*CmdAppendDus) AggregateCommand ¶
func (*CmdAppendDus) AggregateCommand()
type CmdAppendSuggestions ¶
type CmdAppendSuggestions struct {
Suggestions []Suggestion
}
func (*CmdAppendSuggestions) AggregateCommand ¶
func (*CmdAppendSuggestions) AggregateCommand()
type CmdCommit ¶
type CmdCommit struct{}
func (*CmdCommit) AggregateCommand ¶
func (*CmdCommit) AggregateCommand()
type CmdCommitAnalysis ¶
type CmdCommitAnalysis struct{}
func (*CmdCommitAnalysis) AggregateCommand ¶
func (*CmdCommitAnalysis) AggregateCommand()
type CmdCommitDu ¶
type CmdCommitDu struct{}
func (*CmdCommitDu) AggregateCommand ¶
func (*CmdCommitDu) AggregateCommand()
type CmdDelete ¶
type CmdDelete struct{}
func (*CmdDelete) AggregateCommand ¶
func (*CmdDelete) AggregateCommand()
type CmdEnd ¶
type CmdEnd struct{}
func (*CmdEnd) AggregateCommand ¶
func (*CmdEnd) AggregateCommand()
type CmdInit ¶
type CmdInit struct { RegistryId uuid.I GlobalRoot string Host string HostRoot string MaxDepth int32 MinDiskUsage int64 MaxDiskUsage int64 }
func (*CmdInit) AggregateCommand ¶
func (*CmdInit) AggregateCommand()
type Decision ¶
type Decision struct { Path string Decision pb.FsoSplitRootDecision_Decision }
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 NotCandidateError ¶
type NotCandidateError struct {
Path string
}
func (*NotCandidateError) Error ¶
func (err *NotCandidateError) Error() string
type NotIdempotentError ¶
type NotIdempotentError struct { }
func (*NotIdempotentError) Error ¶
func (err *NotIdempotentError) Error() string
type ResourceExhaustedError ¶
type ResourceExhaustedError struct {
Err string
}
func (*ResourceExhaustedError) Error ¶
func (err *ResourceExhaustedError) Error() string
type State ¶
type State struct {
// contains filtered or unexported fields
}
func (*State) AggregateState ¶
func (*State) AggregateState()
func (*State) GlobalRoot ¶
func (*State) IsCandidate ¶
func (*State) RegistryId ¶
func (*State) StatusCode ¶
func (*State) StatusMessage ¶
func (*State) Suggestions ¶
func (st *State) Suggestions() []Suggestion
type StateConflictError ¶
type StateConflictError struct{}
func (*StateConflictError) Error ¶
func (err *StateConflictError) Error() string
type Suggestion ¶
type Suggestion struct { Path string Suggestion pb.FsoSplitRootSuggestion_Suggestion }
type UndecidedCandidatesError ¶
type UndecidedCandidatesError struct{}
func (*UndecidedCandidatesError) Error ¶
func (err *UndecidedCandidatesError) 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
}