Documentation ¶
Overview ¶
Package `fsorepos` implements an event-sourced aggregate that contains FSO repos. See package `fsomain` for an oveview.
Index ¶
- Constants
- Variables
- type Advancer
- type Behavior
- type CmdAbortArchive
- type CmdAbortFreeze
- type CmdAbortUnarchive
- type CmdAbortUnfreeze
- type CmdBeginArchive
- type CmdBeginFreeze
- type CmdBeginMoveRepo
- type CmdBeginMoveShadow
- type CmdBeginUnarchive
- type CmdBeginUnfreeze
- type CmdClearRepoError
- type CmdCommitArchive
- type CmdCommitFreeze
- type CmdCommitMoveRepo
- type CmdCommitMoveShadow
- type CmdCommitUnarchive
- type CmdCommitUnfreeze
- type CmdConfirmGit
- type CmdConfirmShadow
- type CmdDeleteArchiveRecipients
- type CmdDeleteShadowBackupRecipients
- type CmdEnableGitlab
- type CmdInitRepo
- type CmdInitShadowBackup
- type CmdInitTartt
- type CmdMoveShadowBackup
- type CmdSetRepoError
- type CmdUpdateArchiveRecipients
- type CmdUpdateShadowBackupRecipients
- type Event
- func (e *Event) Id() ulid.I
- func (e *Event) MarshalProto() ([]byte, error)
- func (e *Event) Parent() ulid.I
- func (e *Event) PbRepoEvent() *pb.RepoEvent
- func (e *Event) UnmarshalProto(data []byte) error
- func (e Event) WithId(id ulid.I) events.Event
- func (e Event) WithParent(parent ulid.I) events.Event
- type EventDetailsError
- type Repos
- func (r *Repos) AbortArchive(id uuid.I, vid ulid.I, cmd *CmdAbortArchive) (ulid.I, error)
- func (r *Repos) AbortFreeze(id uuid.I, vid ulid.I, cmd *CmdAbortFreeze) (ulid.I, error)
- func (r *Repos) AbortUnarchive(id uuid.I, vid ulid.I, cmd *CmdAbortUnarchive) (ulid.I, error)
- func (r *Repos) AbortUnfreeze(id uuid.I, vid ulid.I, cmd *CmdAbortUnfreeze) (ulid.I, error)
- func (r *Repos) BeginArchive(id uuid.I, vid ulid.I, cmd *CmdBeginArchive) (ulid.I, error)
- func (r *Repos) BeginFreeze(id uuid.I, vid ulid.I, cmd *CmdBeginFreeze) (ulid.I, error)
- func (r *Repos) BeginMoveRepo(id uuid.I, vid ulid.I, cmd *CmdBeginMoveRepo) (ulid.I, error)
- func (r *Repos) BeginMoveShadow(id uuid.I, vid ulid.I, workflowId uuid.I, newShadowPath string) (ulid.I, error)
- func (r *Repos) BeginUnarchive(id uuid.I, vid ulid.I, cmd *CmdBeginUnarchive) (ulid.I, error)
- func (r *Repos) BeginUnfreeze(id uuid.I, vid ulid.I, cmd *CmdBeginUnfreeze) (ulid.I, error)
- func (r *Repos) ClearRepoError(id uuid.I, vid ulid.I, cmd *CmdClearRepoError) (ulid.I, error)
- func (r *Repos) CommitArchive(id uuid.I, vid ulid.I, cmd *CmdCommitArchive) (ulid.I, error)
- func (r *Repos) CommitFreeze(id uuid.I, vid ulid.I, cmd *CmdCommitFreeze) (ulid.I, error)
- func (r *Repos) CommitMoveRepo(id uuid.I, vid ulid.I, cmd *CmdCommitMoveRepo) (ulid.I, error)
- func (r *Repos) CommitMoveShadow(id uuid.I, vid ulid.I, workflowId uuid.I, workflowEventId ulid.I) (ulid.I, error)
- func (r *Repos) CommitUnarchive(id uuid.I, vid ulid.I, cmd *CmdCommitUnarchive) (ulid.I, error)
- func (r *Repos) CommitUnfreeze(id uuid.I, vid ulid.I, cmd *CmdCommitUnfreeze) (ulid.I, error)
- func (r *Repos) ConfirmGit(id uuid.I, vid ulid.I, gitlabProjectId int64) (ulid.I, error)
- func (r *Repos) ConfirmShadow(id uuid.I, vid ulid.I, shadowPath string) (ulid.I, error)
- func (r *Repos) DeleteArchiveRecipients(id uuid.I, vid ulid.I) (ulid.I, error)
- func (r *Repos) DeleteShadowBackupRecipients(id uuid.I, vid ulid.I) (ulid.I, error)
- func (r *Repos) EnableGitlab(id uuid.I, vid ulid.I, gitlabNamespace string) (ulid.I, error)
- func (r *Repos) FindId(id uuid.I) (*State, error)
- func (r *Repos) Init(id uuid.I, info *CmdInitRepo) (ulid.I, error)
- func (r *Repos) InitShadowBackup(id uuid.I, vid ulid.I, shadowBackupURL string) (ulid.I, error)
- func (r *Repos) InitTartt(id uuid.I, vid ulid.I, tarttURL string) (ulid.I, error)
- func (r *Repos) MoveShadowBackup(id uuid.I, vid ulid.I, shadowBackupURL string) (ulid.I, error)
- func (r *Repos) SetRepoError(id uuid.I, vid ulid.I, cmd *CmdSetRepoError) (ulid.I, error)
- func (r *Repos) UpdateArchiveRecipients(id uuid.I, vid ulid.I, keys gpg.Fingerprints) (*State, error)
- func (r *Repos) UpdateShadowBackupRecipients(id uuid.I, vid ulid.I, keys gpg.Fingerprints) (*State, error)
- type State
- func (*State) AggregateState()
- func (s *State) ArchiveRecipients() gpg.Fingerprints
- func (s *State) ArchiveURL() string
- func (s *State) ErrorMessage() string
- func (s *State) FileLocation() string
- func (s *State) GitlabLocation() string
- func (s *State) GitlabProjectId() int64
- func (s *State) GlobalPath() string
- func (s *State) HasActiveMoveRepo() bool
- func (s *State) HasActiveMoveShadow() bool
- func (s *State) Id() uuid.I
- func (st *State) MayArchive() (ok bool, reason string)
- func (s *State) MoveRepoId() uuid.I
- func (s *State) MoveShadowId() uuid.I
- func (s *State) Registry() string
- func (s *State) SetVid(vid ulid.I)
- func (s *State) ShadowBackupRecipients() gpg.Fingerprints
- func (s *State) ShadowBackupURL() string
- func (s *State) ShadowLocation() string
- func (st *State) StorageTier() StorageTierCode
- func (s *State) TarttTarPath() string
- func (s *State) Vid() ulid.I
- type StorageTierCode
- type SubdirTracking
Constants ¶
const ConfigMaxStatusMessageLength = 150
Variables ¶
var ErrClearMessageEmpty = errors.New("empty clear message")
var ErrClearMessageMismatch = errors.New("clear message mismatch")
var ErrCommandConflict = errors.New("command conflict")
var ErrCommandUnknown = errors.New("unknown command")
var ErrConflictRepoError = errors.New("cannot proceed due to repo error")
var ErrConflictShadowPath = errors.New("shadow path conflict")
var ErrConflictStorageWorkflow = errors.New("storage workflow conflict")
var ErrConflictWorkflow = errors.New("workflow conflict")
var ErrDuplicateGPGKeys = errors.New("duplicate GPG keys")
var ErrEmptyTarPath = errors.New("empty tar path")
var ErrGitlabConfigInvalid = fmt.Errorf("invalid Gitlab config")
var ErrGitlabNamespaceInvalid = errors.New("invalid Gitlab namespace")
var ErrGitlabPathConflict = errors.New("conflicting GitLab path")
var ErrInitConflict = errors.New("init conflict")
var ErrInvalidErrorStatusCode = errors.New("invalid error status code")
var ErrInvalidErrorStatusMessage = errors.New("invalid error status message")
var ErrMalformedShadowBackupURL = errors.New("malformed shadow backup URL")
var ErrMalformedTarttURL = errors.New("malformed tartt URL")
var ErrMalformedWorkflowId = errors.New("malformed workflow ID")
var ErrMissingShadow = errors.New("missing shadow repo")
var ErrNoGPGKeys = errors.New("no GPG keys")
var ErrNoTarttRepo = errors.New("no tartt repo")
var ErrNotInitialized = errors.New("repo is not initialized")
var ErrNotInitializedShadowBackup = errors.New("shadow backup is not initialized")
var ErrShadowPathUnchanged = errors.New("unchanged shadow path")
var ErrStatusMessageTooLong = errors.New("status message too long")
var ErrSubdirTrackingInvalid = errors.New("invalid SubdirTracking")
var ErrUninitialized = errors.New("uninitialized repo")
var ErrWorkflowActive = errors.New("the workflow is already active")
var ErrWorkflowReuse = errors.New("workflow ID must not be reused")
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 CmdAbortArchive ¶
func (*CmdAbortArchive) AggregateCommand ¶
func (*CmdAbortArchive) AggregateCommand()
type CmdAbortFreeze ¶
func (*CmdAbortFreeze) AggregateCommand ¶
func (*CmdAbortFreeze) AggregateCommand()
type CmdAbortUnarchive ¶
func (*CmdAbortUnarchive) AggregateCommand ¶
func (*CmdAbortUnarchive) AggregateCommand()
type CmdAbortUnfreeze ¶
func (*CmdAbortUnfreeze) AggregateCommand ¶
func (*CmdAbortUnfreeze) AggregateCommand()
type CmdBeginArchive ¶
func (*CmdBeginArchive) AggregateCommand ¶
func (*CmdBeginArchive) AggregateCommand()
type CmdBeginFreeze ¶
func (*CmdBeginFreeze) AggregateCommand ¶
func (*CmdBeginFreeze) AggregateCommand()
type CmdBeginMoveRepo ¶
type CmdBeginMoveRepo struct { RegistryEventId ulid.I WorkflowId uuid.I NewGlobalPath string NewFileHost string NewHostPath string }
func (*CmdBeginMoveRepo) AggregateCommand ¶
func (*CmdBeginMoveRepo) AggregateCommand()
type CmdBeginMoveShadow ¶
func (*CmdBeginMoveShadow) AggregateCommand ¶
func (*CmdBeginMoveShadow) AggregateCommand()
type CmdBeginUnarchive ¶
func (*CmdBeginUnarchive) AggregateCommand ¶
func (*CmdBeginUnarchive) AggregateCommand()
type CmdBeginUnfreeze ¶
func (*CmdBeginUnfreeze) AggregateCommand ¶
func (*CmdBeginUnfreeze) AggregateCommand()
type CmdClearRepoError ¶
type CmdClearRepoError struct {
ErrorMessage string
}
func (*CmdClearRepoError) AggregateCommand ¶
func (*CmdClearRepoError) AggregateCommand()
type CmdCommitArchive ¶
func (*CmdCommitArchive) AggregateCommand ¶
func (*CmdCommitArchive) AggregateCommand()
type CmdCommitFreeze ¶
func (*CmdCommitFreeze) AggregateCommand ¶
func (*CmdCommitFreeze) AggregateCommand()
type CmdCommitMoveRepo ¶
type CmdCommitMoveRepo struct { WorkflowId uuid.I WorkflowEventId ulid.I GlobalPath string FileHost string HostPath string ShadowPath string }
func (*CmdCommitMoveRepo) AggregateCommand ¶
func (*CmdCommitMoveRepo) AggregateCommand()
type CmdCommitMoveShadow ¶
func (*CmdCommitMoveShadow) AggregateCommand ¶
func (*CmdCommitMoveShadow) AggregateCommand()
type CmdCommitUnarchive ¶
func (*CmdCommitUnarchive) AggregateCommand ¶
func (*CmdCommitUnarchive) AggregateCommand()
type CmdCommitUnfreeze ¶
func (*CmdCommitUnfreeze) AggregateCommand ¶
func (*CmdCommitUnfreeze) AggregateCommand()
type CmdConfirmGit ¶
type CmdConfirmGit struct {
GitlabProjectId int64
}
func (*CmdConfirmGit) AggregateCommand ¶
func (*CmdConfirmGit) AggregateCommand()
type CmdConfirmShadow ¶
type CmdConfirmShadow struct {
ShadowPath string
}
func (*CmdConfirmShadow) AggregateCommand ¶
func (*CmdConfirmShadow) AggregateCommand()
type CmdDeleteArchiveRecipients ¶
type CmdDeleteArchiveRecipients struct{}
func (*CmdDeleteArchiveRecipients) AggregateCommand ¶
func (*CmdDeleteArchiveRecipients) AggregateCommand()
type CmdDeleteShadowBackupRecipients ¶
type CmdDeleteShadowBackupRecipients struct{}
func (*CmdDeleteShadowBackupRecipients) AggregateCommand ¶
func (*CmdDeleteShadowBackupRecipients) AggregateCommand()
type CmdEnableGitlab ¶
type CmdEnableGitlab struct {
GitlabNamespace string
}
func (*CmdEnableGitlab) AggregateCommand ¶
func (*CmdEnableGitlab) AggregateCommand()
type CmdInitRepo ¶
type CmdInitRepo struct { Registry string GlobalPath string CreatorName string CreatorEmail string FileHost string HostPath string GitlabHost string GitlabPath string GitToNogAddr string SubdirTracking SubdirTracking ArchiveRecipients gpg.Fingerprints ShadowBackupRecipients gpg.Fingerprints }
func (*CmdInitRepo) AggregateCommand ¶
func (*CmdInitRepo) AggregateCommand()
type CmdInitShadowBackup ¶
type CmdInitShadowBackup struct {
ShadowBackupURL string
}
func (*CmdInitShadowBackup) AggregateCommand ¶
func (*CmdInitShadowBackup) AggregateCommand()
type CmdInitTartt ¶
type CmdInitTartt struct {
TarttURL string
}
func (*CmdInitTartt) AggregateCommand ¶
func (*CmdInitTartt) AggregateCommand()
type CmdMoveShadowBackup ¶
type CmdMoveShadowBackup struct {
ShadowBackupURL string
}
func (*CmdMoveShadowBackup) AggregateCommand ¶
func (*CmdMoveShadowBackup) AggregateCommand()
type CmdSetRepoError ¶
type CmdSetRepoError struct {
ErrorMessage string
}
func (*CmdSetRepoError) AggregateCommand ¶
func (*CmdSetRepoError) AggregateCommand()
type CmdUpdateArchiveRecipients ¶
type CmdUpdateArchiveRecipients struct {
Keys gpg.Fingerprints
}
func (*CmdUpdateArchiveRecipients) AggregateCommand ¶
func (*CmdUpdateArchiveRecipients) AggregateCommand()
type CmdUpdateShadowBackupRecipients ¶
type CmdUpdateShadowBackupRecipients struct {
Keys gpg.Fingerprints
}
func (*CmdUpdateShadowBackupRecipients) AggregateCommand ¶
func (*CmdUpdateShadowBackupRecipients) AggregateCommand()
type Event ¶
type Event struct {
// contains filtered or unexported fields
}
func (*Event) MarshalProto ¶
func (*Event) PbRepoEvent ¶
func (*Event) UnmarshalProto ¶
type EventDetailsError ¶
type EventDetailsError struct {
Err error
}
func (*EventDetailsError) Error ¶
func (err *EventDetailsError) Error() string
type Repos ¶
type Repos struct {
// contains filtered or unexported fields
}
func (*Repos) AbortArchive ¶
`AbortArchive()` completes a failed freeze.
func (*Repos) AbortFreeze ¶
`AbortFreeze()` completes a failed freeze.
func (*Repos) AbortUnarchive ¶
`AbortUnarchive()` completes a failed freeze.
func (*Repos) AbortUnfreeze ¶
`AbortUnfreeze()` completes a failed freeze.
func (*Repos) BeginArchive ¶
`BeginArchive()` starts a freeze.
func (*Repos) BeginFreeze ¶
`BeginFreeze()` starts a freeze.
func (*Repos) BeginMoveRepo ¶
`BeginMoveRepo()` is used by repoinit to start a move-repo workflow from on a corresponding `RegistryEvent`. See `moverepowf` for details.
func (*Repos) BeginMoveShadow ¶
func (r *Repos) BeginMoveShadow( id uuid.I, vid ulid.I, workflowId uuid.I, newShadowPath string, ) (ulid.I, error)
`BeginMoveShadow()` starts a workflow to change the shadow location. `workflowId` is a client-generated nonce that is used to identify the workflow instance and to handle concurrent and repeated invocations.
func (*Repos) BeginUnarchive ¶
`BeginUnarchive()` starts a freeze.
func (*Repos) BeginUnfreeze ¶
`BeginUnfreeze()` starts a freeze.
func (*Repos) ClearRepoError ¶
func (*Repos) CommitArchive ¶
`CommitArchive()` completes a successful freeze.
func (*Repos) CommitFreeze ¶
`CommitFreeze()` completes a successful freeze.
func (*Repos) CommitMoveRepo ¶
`CommitMoveRepo()` completes the workflow that started with `BeginMoveRepo()`.
func (*Repos) CommitMoveShadow ¶
func (r *Repos) CommitMoveShadow( id uuid.I, vid ulid.I, workflowId uuid.I, workflowEventId ulid.I, ) (ulid.I, error)
`CommitMoveShadow()` completes the workflow that started with `BeginMoveShadow()`.
func (*Repos) CommitUnarchive ¶
`CommitUnarchive()` completes a successful freeze.
func (*Repos) CommitUnfreeze ¶
`CommitUnfreeze()` completes a successful freeze.
func (*Repos) ConfirmGit ¶
func (*Repos) ConfirmShadow ¶
func (*Repos) DeleteArchiveRecipients ¶
`DeleteArchiveRecipients()` disables archive encryption.
func (*Repos) DeleteShadowBackupRecipients ¶
`DeleteShadowBackupRecipients()` disables shadow backup encryption.
func (*Repos) EnableGitlab ¶
Internal use only. External clients must enable GitLab via fsoregistry.
func (*Repos) InitShadowBackup ¶
`InitShadowBackup()` sets the archive URL.
func (*Repos) MoveShadowBackup ¶
`MoveShadowBackup()` changes the archive URL.
func (*Repos) SetRepoError ¶
type State ¶
type State struct {
// contains filtered or unexported fields
}
func (*State) AggregateState ¶
func (*State) AggregateState()
func (*State) ArchiveRecipients ¶
func (s *State) ArchiveRecipients() gpg.Fingerprints
func (*State) ArchiveURL ¶
func (*State) ErrorMessage ¶
func (*State) FileLocation ¶
func (*State) GitlabLocation ¶
func (*State) GitlabProjectId ¶
func (*State) GlobalPath ¶
func (*State) HasActiveMoveRepo ¶
func (*State) HasActiveMoveShadow ¶
func (*State) MayArchive ¶
`MayArchiveRepo()` is used in `BeginArchiveRepo()` to check preconditions before initializing an archive-repo workflow.
func (*State) MoveRepoId ¶
func (*State) MoveShadowId ¶
func (*State) ShadowBackupRecipients ¶
func (s *State) ShadowBackupRecipients() gpg.Fingerprints
func (*State) ShadowBackupURL ¶
func (*State) ShadowLocation ¶
func (*State) StorageTier ¶
func (st *State) StorageTier() StorageTierCode
func (*State) TarttTarPath ¶
type StorageTierCode ¶
type StorageTierCode int
XXX Maybe factor out into a common package, e.g. `storagetier`, that is used by packages `fsoregistry` and `fsorepos`.
const ( StorageTierUnspecified StorageTierCode = iota StorageOnline StorageFrozen StorageArchived StorageFreezing StorageFreezeFailed StorageUnfreezing StorageUnfreezeFailed StorageArchiving StorageArchiveFailed StorageUnarchiving StorageUnarchiveFailed )
type SubdirTracking ¶
type SubdirTracking int
const ( SubdirTrackingUnspecified SubdirTracking = iota EnterSubdirs BundleSubdirs IgnoreSubdirs IgnoreMost )