fsoregistry

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

Documentation

Overview

Package `fsoregistry` implements an event-sourced aggregate that contains FSO registries. See package `fsomain` for an oveview.

Registries manage lists of roots and lists of repos. Repo details are in separate entities, implemented by package `fsorepos`.

Index

Constants

This section is empty.

Variables

View Source
var ErrCannotArchiveRepo = errors.New("cannot archive repo")
View Source
var ErrCannotFreezeRepo = errors.New("cannot freeze repo")
View Source
var ErrCannotMoveUnconfirmed = errors.New("cannot move unconfirmed repo")
View Source
var ErrCannotUnarchiveRepo = errors.New("cannot unarchive repo")
View Source
var ErrCannotUnfreezeRepo = errors.New("cannot unfreeze repo")
View Source
var ErrCommandUnknown = errors.New("unknown command")
View Source
var ErrConflictEphemeralWorkflowsId = errors.New("ephemeral workflows ID conflict")
View Source
var ErrConflictGitlabInit = errors.New("GitLab already initialized with conflicting namespace")
View Source
var ErrConflictInit = errors.New("init conflict")
View Source
var ErrConflictRepoInit = errors.New("repo already initialized at path")
View Source
var ErrConflictWorkflow = errors.New("workflow conflict")
View Source
var ErrCreatorEmailMissing = errors.New("missing creator email")
View Source
var ErrCreatorNameMissing = errors.New("missing creator name")
View Source
var ErrDuplicateGPGKeys = errors.New("duplicate GPG keys")
View Source
var ErrGitlabNamespaceMissingSlash = errors.New("Gitlab namespace missing slash")
View Source
var ErrInvalidSplitRootConfig = errors.New("invalid split root config")
View Source
var ErrMalformedEphemeralWorkflowsId = errors.New("malformed ephemeral workflows ID")
View Source
var ErrMalformedPath = errors.New("malformed path")
View Source
var ErrMalformedWorkflowId = errors.New("malformed workflow ID")
View Source
var ErrMismatchGlobalPath = errors.New("global path mismatch")
View Source
var ErrNamingRuleMismatch = errors.New("naming rule mismatch")
View Source
var ErrNoGPGKeys = errors.New("no GPG keys")
View Source
var ErrNoSplitRootConfig = errors.New("no split root config")
View Source
var ErrNotInitialized = errors.New("repo is not initialized")
View Source
var ErrParentRepoImmutable = errors.New("parent repo immutable")
View Source
var ErrPathChanged = errors.New("changed path")
View Source
var ErrPathDepthOutOfRange = errors.New("path depth out of range")
View Source
var ErrPathNotStrictlyBelow = errors.New("path not strictly below root")
View Source
var ErrPathUnchanged = errors.New("unchanged path")
View Source
var ErrReasonAlreadyApplied = errors.New("reason already applied")
View Source
var ErrReasonEmpty = errors.New("empty reason")
View Source
var ErrRepeatedPost = errors.New("repeated post")
View Source
var ErrRootWithoutInitPolicy = errors.New("root has no repo init policy")
View Source
var ErrRootWithoutRepoNaming = errors.New("root has no repo naming")
View Source
var ErrSplitRootConfigExists = errors.New("split root config already exists")
View Source
var ErrUninitialized = errors.New("uninitialized registry")
View Source
var ErrUnknownRepo = errors.New("unknown repo")
View Source
var ErrUnknownRoot = errors.New("unknown root")
View Source
var ErrWorkflowReuse = errors.New("workflow ID must not be reused")
View Source
var ErrWorkflowTerminated = errors.New("workflow has terminated")
View Source
var NoVC = events.NoVC
View Source
var RetryNoVC = events.RetryNoVC

Functions

func WhichSubdirTracking

func WhichSubdirTracking(
	pol *pb.FsoRepoInitPolicy, globalPath string,
) (pb.SubdirTracking, error)

Types

type Advancer

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

The `Advancer` maintains flags to indicate which sub-state has been touched. Each sub-state is cloned only once by each advancer in order to avoid unnecessary intermediate copies when processing a sequence of events. Loading from an event history is fast.

But adding repos one-by-one still takes O(n^2) time, because the repos map is duplicated during each insert. O(n^2) seems acceptable up to 10k repos. It may even be acceptable for a larger number, assuming that adding repos is rare and related operations are expensive, like creating the repo clones at various places.

If we wanted to optimize, we could switch to a map implementation that uses structural sharing, like <https://github.com/mediocregopher/seq>. Or we could use an ad hoc approach that stores new repos into a smaller map or list first and rebuilds the full map only every k inserts.

func (*Advancer) Advance

func (a *Advancer) Advance(s events.State, ev events.Event) events.State

type Behavior

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

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 (b *Behavior) Tell(
	s events.State, c events.Command,
) ([]events.Event, error)

type CmdAbortArchiveRepo

type CmdAbortArchiveRepo struct {
	RepoId     uuid.I
	WorkflowId uuid.I
	Code       int32
}

func (*CmdAbortArchiveRepo) AggregateCommand

func (*CmdAbortArchiveRepo) AggregateCommand()

type CmdAbortFreezeRepo

type CmdAbortFreezeRepo struct {
	RepoId     uuid.I
	WorkflowId uuid.I
	Code       int32
}

func (*CmdAbortFreezeRepo) AggregateCommand

func (*CmdAbortFreezeRepo) AggregateCommand()

type CmdAbortUnarchiveRepo

type CmdAbortUnarchiveRepo struct {
	RepoId     uuid.I
	WorkflowId uuid.I
	Code       int32
}

func (*CmdAbortUnarchiveRepo) AggregateCommand

func (*CmdAbortUnarchiveRepo) AggregateCommand()

type CmdAbortUnfreezeRepo

type CmdAbortUnfreezeRepo struct {
	RepoId     uuid.I
	WorkflowId uuid.I
	Code       int32
}

func (*CmdAbortUnfreezeRepo) AggregateCommand

func (*CmdAbortUnfreezeRepo) AggregateCommand()

type CmdBeginArchiveRepo

type CmdBeginArchiveRepo struct {
	RepoId     uuid.I
	WorkflowId uuid.I
}

func (*CmdBeginArchiveRepo) AggregateCommand

func (*CmdBeginArchiveRepo) AggregateCommand()

type CmdBeginFreezeRepo

type CmdBeginFreezeRepo struct {
	RepoId     uuid.I
	WorkflowId uuid.I
}

func (*CmdBeginFreezeRepo) AggregateCommand

func (*CmdBeginFreezeRepo) AggregateCommand()

type CmdBeginMoveRepo

type CmdBeginMoveRepo struct {
	RepoId                uuid.I
	WorkflowId            uuid.I
	NewGlobalPath         string
	IsUnchangedGlobalPath bool
}

func (*CmdBeginMoveRepo) AggregateCommand

func (*CmdBeginMoveRepo) AggregateCommand()

type CmdBeginUnarchiveRepo

type CmdBeginUnarchiveRepo struct {
	RepoId     uuid.I
	WorkflowId uuid.I
}

func (*CmdBeginUnarchiveRepo) AggregateCommand

func (*CmdBeginUnarchiveRepo) AggregateCommand()

type CmdBeginUnfreezeRepo

type CmdBeginUnfreezeRepo struct {
	RepoId     uuid.I
	WorkflowId uuid.I
}

func (*CmdBeginUnfreezeRepo) AggregateCommand

func (*CmdBeginUnfreezeRepo) AggregateCommand()

type CmdCommitArchiveRepo

type CmdCommitArchiveRepo struct {
	RepoId     uuid.I
	WorkflowId uuid.I
}

func (*CmdCommitArchiveRepo) AggregateCommand

func (*CmdCommitArchiveRepo) AggregateCommand()

type CmdCommitFreezeRepo

type CmdCommitFreezeRepo struct {
	RepoId     uuid.I
	WorkflowId uuid.I
}

func (*CmdCommitFreezeRepo) AggregateCommand

func (*CmdCommitFreezeRepo) AggregateCommand()

type CmdCommitMoveRepo

type CmdCommitMoveRepo struct {
	RepoId      uuid.I
	WorkflowId  uuid.I
	RepoEventId ulid.I
	GlobalPath  string
}

func (*CmdCommitMoveRepo) AggregateCommand

func (*CmdCommitMoveRepo) AggregateCommand()

type CmdCommitUnarchiveRepo

type CmdCommitUnarchiveRepo struct {
	RepoId     uuid.I
	WorkflowId uuid.I
}

func (*CmdCommitUnarchiveRepo) AggregateCommand

func (*CmdCommitUnarchiveRepo) AggregateCommand()

type CmdCommitUnfreezeRepo

type CmdCommitUnfreezeRepo struct {
	RepoId     uuid.I
	WorkflowId uuid.I
}

func (*CmdCommitUnfreezeRepo) AggregateCommand

func (*CmdCommitUnfreezeRepo) AggregateCommand()

type CmdConfirmRepo

type CmdConfirmRepo struct {
	RepoId      uuid.I
	RepoEventId ulid.I
}

func (*CmdConfirmRepo) AggregateCommand

func (*CmdConfirmRepo) AggregateCommand()

type CmdCreateSplitRootConfig

type CmdCreateSplitRootConfig struct {
	GlobalRoot string
	Config     *SplitRootConfig
}

func (*CmdCreateSplitRootConfig) AggregateCommand

func (*CmdCreateSplitRootConfig) AggregateCommand()

type CmdDeleteRootArchiveRecipients

type CmdDeleteRootArchiveRecipients struct {
	GlobalRoot string
}

func (*CmdDeleteRootArchiveRecipients) AggregateCommand

func (*CmdDeleteRootArchiveRecipients) AggregateCommand()

type CmdDeleteRootShadowBackupRecipients

type CmdDeleteRootShadowBackupRecipients struct {
	GlobalRoot string
}

func (*CmdDeleteRootShadowBackupRecipients) AggregateCommand

func (*CmdDeleteRootShadowBackupRecipients) AggregateCommand()

type CmdDeleteSplitRootConfig

type CmdDeleteSplitRootConfig struct {
	GlobalRoot string
}

func (*CmdDeleteSplitRootConfig) AggregateCommand

func (*CmdDeleteSplitRootConfig) AggregateCommand()

type CmdDisableGitlab

type CmdDisableGitlab struct {
	GlobalRoot string
}

func (*CmdDisableGitlab) AggregateCommand

func (*CmdDisableGitlab) AggregateCommand()

type CmdEnableDiscoveryPaths

type CmdEnableDiscoveryPaths struct {
	GlobalRoot string
	DepthPaths []DepthPath
}

func (*CmdEnableDiscoveryPaths) AggregateCommand

func (*CmdEnableDiscoveryPaths) AggregateCommand()

type CmdEnableEphemeralWorkflows

type CmdEnableEphemeralWorkflows struct {
	EphemeralWorkflowsId uuid.I
}

func (*CmdEnableEphemeralWorkflows) AggregateCommand

func (*CmdEnableEphemeralWorkflows) AggregateCommand()

type CmdEnableGitlab

type CmdEnableGitlab struct {
	GlobalRoot      string
	GitlabNamespace string
}

func (*CmdEnableGitlab) AggregateCommand

func (*CmdEnableGitlab) AggregateCommand()

type CmdEnableGitlabRepo

type CmdEnableGitlabRepo struct {
	RepoId          uuid.I
	GitlabNamespace string
}

func (*CmdEnableGitlabRepo) AggregateCommand

func (*CmdEnableGitlabRepo) AggregateCommand()

type CmdEnablePropagateRootAcls

type CmdEnablePropagateRootAcls struct{}

func (*CmdEnablePropagateRootAcls) AggregateCommand

func (*CmdEnablePropagateRootAcls) AggregateCommand()

type CmdInitRegistry

type CmdInitRegistry struct {
	Name string
}

func (*CmdInitRegistry) AggregateCommand

func (*CmdInitRegistry) AggregateCommand()

type CmdInitRepo

type CmdInitRepo struct {
	// `Context` is used when calling `IsInitRepoAllowed()`.  If
	// `IsInitRepoAllowed()` uses outgoing GRPC calls that require
	// authorization, `Context` must have the required metadata attached
	// with `NewOutgoingContext()`.
	Context      context.Context
	Id           uuid.I
	GlobalPath   string
	CreatorName  string
	CreatorEmail string
}

func (*CmdInitRepo) AggregateCommand

func (*CmdInitRepo) AggregateCommand()

type CmdInitRoot

type CmdInitRoot struct {
	GlobalRoot      string
	Host            string
	HostRoot        string
	GitlabNamespace string
}

func (*CmdInitRoot) AggregateCommand

func (*CmdInitRoot) AggregateCommand()

type CmdPatchRepoNaming

type CmdPatchRepoNaming struct {
	NamingPatch *pb.FsoRepoNaming
}

func (*CmdPatchRepoNaming) AggregateCommand

func (*CmdPatchRepoNaming) AggregateCommand()

type CmdPostShadowRepoMoveStarted

type CmdPostShadowRepoMoveStarted struct {
	RepoId      uuid.I
	RepoEventId ulid.I
	WorkflowId  uuid.I
}

func (*CmdPostShadowRepoMoveStarted) AggregateCommand

func (*CmdPostShadowRepoMoveStarted) AggregateCommand()

type CmdReinitRepo

type CmdReinitRepo struct {
	RepoId uuid.I
	Reason string
}

func (*CmdReinitRepo) AggregateCommand

func (*CmdReinitRepo) AggregateCommand()

type CmdRemoveRoot

type CmdRemoveRoot struct {
	GlobalRoot string
}

func (*CmdRemoveRoot) AggregateCommand

func (*CmdRemoveRoot) AggregateCommand()

type CmdSetPathFlags

type CmdSetPathFlags struct {
	Path  string
	Flags uint32
}

func (*CmdSetPathFlags) AggregateCommand

func (*CmdSetPathFlags) AggregateCommand()

type CmdSetRepoInitPolicy

type CmdSetRepoInitPolicy struct {
	Policy *pb.FsoRepoInitPolicy
}

func (*CmdSetRepoInitPolicy) AggregateCommand

func (*CmdSetRepoInitPolicy) AggregateCommand()

type CmdSetRepoNaming

type CmdSetRepoNaming struct {
	Naming *pb.FsoRepoNaming
}

func (*CmdSetRepoNaming) AggregateCommand

func (*CmdSetRepoNaming) AggregateCommand()

type CmdUnsetPathFlags

type CmdUnsetPathFlags struct {
	Path  string
	Flags uint32
}

func (*CmdUnsetPathFlags) AggregateCommand

func (*CmdUnsetPathFlags) AggregateCommand()

type CmdUpdateRootArchiveRecipients

type CmdUpdateRootArchiveRecipients struct {
	GlobalRoot string
	Keys       gpg.Fingerprints
}

func (*CmdUpdateRootArchiveRecipients) AggregateCommand

func (*CmdUpdateRootArchiveRecipients) AggregateCommand()

type CmdUpdateRootShadowBackupRecipients

type CmdUpdateRootShadowBackupRecipients struct {
	GlobalRoot string
	Keys       gpg.Fingerprints
}

func (*CmdUpdateRootShadowBackupRecipients) AggregateCommand

func (*CmdUpdateRootShadowBackupRecipients) AggregateCommand()

type CmdUpdateSplitRootConfig

type CmdUpdateSplitRootConfig struct {
	GlobalRoot string
	Config     *SplitRootConfig
}

func (*CmdUpdateSplitRootConfig) AggregateCommand

func (*CmdUpdateSplitRootConfig) AggregateCommand()

type DepthPath

type DepthPath struct {
	Depth int
	Path  string
}

type EnablePathRuleError

type EnablePathRuleError struct {
	Rule string
}

func (*EnablePathRuleError) Error

func (err *EnablePathRuleError) Error() string

type Event

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

func (*Event) Id

func (e *Event) Id() ulid.I

func (*Event) MarshalProto

func (e *Event) MarshalProto() ([]byte, error)

func (*Event) Parent

func (e *Event) Parent() ulid.I

func (*Event) PbRegistryEvent

func (e *Event) PbRegistryEvent() *pb.RegistryEvent

func (*Event) UnmarshalProto

func (e *Event) UnmarshalProto(data []byte) error

func (Event) WithId

func (e Event) WithId(id ulid.I) events.Event

Receiver by value.

func (Event) WithParent

func (e Event) WithParent(parent ulid.I) events.Event

Receiver by value.

type EventDetailsError

type EventDetailsError struct {
	Err error
}

func (*EventDetailsError) Error

func (err *EventDetailsError) Error() string

type Info

type Info struct {
	Name string
}

type InitRepoAllower

type InitRepoAllower interface {
	// `IsInitRepoAllowed()` returns `deny="", err=nil` if the operation is
	// allowed to proceed.  Otherwise, it returns a `deny` reason that
	// explains why the operation cannot proceed, or an error if the check
	// could not be performed due to a network error, for example.
	//
	// If the implementation uses outgoing GRPC calls that require
	// authorization, `ctx` must have the required metadata attached with
	// `NewOutgoingContext()`.
	IsInitRepoAllowed(
		ctx context.Context,
		repo, host, hostPath string,
		subdirTracking pb.SubdirTracking,
	) (deny string, err error)
}

type InitRepoDenyError

type InitRepoDenyError struct {
	Reason string
}

func (*InitRepoDenyError) Error

func (err *InitRepoDenyError) Error() string

type InternalError

type InternalError struct {
	What string
	Err  error
}

func (*InternalError) Error

func (err *InternalError) Error() string

type Preconditions

type Preconditions struct {
	InitRepo        InitRepoAllower
	WorkflowIdCheck WorkflowIdChecker
}

type Registry

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

func New

func New(journal *events.Journal, p Preconditions) *Registry

func (*Registry) AbortArchiveRepo

func (r *Registry) AbortArchiveRepo(
	id uuid.I, vid ulid.I, cmd *CmdAbortArchiveRepo,
) (ulid.I, error)

func (*Registry) AbortFreezeRepo

func (r *Registry) AbortFreezeRepo(
	id uuid.I, vid ulid.I, cmd *CmdAbortFreezeRepo,
) (ulid.I, error)

func (*Registry) AbortUnarchiveRepo

func (r *Registry) AbortUnarchiveRepo(
	id uuid.I, vid ulid.I, cmd *CmdAbortUnarchiveRepo,
) (ulid.I, error)

func (*Registry) AbortUnfreezeRepo

func (r *Registry) AbortUnfreezeRepo(
	id uuid.I, vid ulid.I, cmd *CmdAbortUnfreezeRepo,
) (ulid.I, error)

func (*Registry) BeginArchiveRepo

func (r *Registry) BeginArchiveRepo(
	id uuid.I, vid ulid.I, cmd *CmdBeginArchiveRepo,
) (ulid.I, error)

func (*Registry) BeginFreezeRepo

func (r *Registry) BeginFreezeRepo(
	id uuid.I, vid ulid.I, cmd *CmdBeginFreezeRepo,
) (ulid.I, error)

func (*Registry) BeginMoveRepo

func (r *Registry) BeginMoveRepo(
	id uuid.I, vid ulid.I, cmd *CmdBeginMoveRepo,
) (ulid.I, error)

func (*Registry) BeginUnarchiveRepo

func (r *Registry) BeginUnarchiveRepo(
	id uuid.I, vid ulid.I, cmd *CmdBeginUnarchiveRepo,
) (ulid.I, error)

func (*Registry) BeginUnfreezeRepo

func (r *Registry) BeginUnfreezeRepo(
	id uuid.I, vid ulid.I, cmd *CmdBeginUnfreezeRepo,
) (ulid.I, error)

func (*Registry) CommitArchiveRepo

func (r *Registry) CommitArchiveRepo(
	id uuid.I, vid ulid.I, cmd *CmdCommitArchiveRepo,
) (ulid.I, error)

func (*Registry) CommitFreezeRepo

func (r *Registry) CommitFreezeRepo(
	id uuid.I, vid ulid.I, cmd *CmdCommitFreezeRepo,
) (ulid.I, error)

func (*Registry) CommitMoveRepo

func (r *Registry) CommitMoveRepo(
	id uuid.I, vid ulid.I, cmd *CmdCommitMoveRepo,
) (ulid.I, error)

func (*Registry) CommitUnarchiveRepo

func (r *Registry) CommitUnarchiveRepo(
	id uuid.I, vid ulid.I, cmd *CmdCommitUnarchiveRepo,
) (ulid.I, error)

func (*Registry) CommitUnfreezeRepo

func (r *Registry) CommitUnfreezeRepo(
	id uuid.I, vid ulid.I, cmd *CmdCommitUnfreezeRepo,
) (ulid.I, error)

func (*Registry) ConfirmRepo

func (r *Registry) ConfirmRepo(
	id uuid.I, vid ulid.I, repoId uuid.I, repoEventId ulid.I,
) (ulid.I, error)

func (*Registry) CreateSplitRootConfig

func (r *Registry) CreateSplitRootConfig(
	id uuid.I, vid ulid.I, root string, cfg *SplitRootConfig,
) (*State, error)

func (*Registry) DeleteRootArchiveRecipients

func (r *Registry) DeleteRootArchiveRecipients(
	id uuid.I, vid ulid.I, globalRoot string,
) (ulid.I, error)

`DeleteRootArchiveRecipients()` disables archive encryption.

func (*Registry) DeleteRootShadowBackupRecipients

func (r *Registry) DeleteRootShadowBackupRecipients(
	id uuid.I, vid ulid.I, globalRoot string,
) (ulid.I, error)

`DeleteRootShadowBackupRecipients()` disables archive encryption.

func (*Registry) DeleteSplitRootConfig

func (r *Registry) DeleteSplitRootConfig(
	id uuid.I, vid ulid.I, root string,
) (ulid.I, error)

func (*Registry) DisableGitlab

func (r *Registry) DisableGitlab(
	id uuid.I, vid ulid.I, root string,
) (ulid.I, error)

func (*Registry) EnableDiscoveryPaths

func (r *Registry) EnableDiscoveryPaths(
	id uuid.I, vid ulid.I, globalRoot string, paths []DepthPath,
) (ulid.I, error)

func (*Registry) EnableEphemeralWorkflows

func (r *Registry) EnableEphemeralWorkflows(
	id uuid.I, vid ulid.I, ephemeralWorkflowsId uuid.I,
) (ulid.I, error)

func (*Registry) EnableGitlab

func (r *Registry) EnableGitlab(
	id uuid.I, vid ulid.I, cmd *CmdEnableGitlab,
) (ulid.I, error)

func (*Registry) EnableGitlabRepo

func (r *Registry) EnableGitlabRepo(
	id uuid.I, vid ulid.I, repoId uuid.I, gitlabNamespace string,
) (ulid.I, error)

func (*Registry) EnablePropagateRootAcls

func (r *Registry) EnablePropagateRootAcls(
	id uuid.I, vid ulid.I,
) (ulid.I, error)

func (*Registry) FindId

func (r *Registry) FindId(id uuid.I) (*State, error)

func (*Registry) Init

func (r *Registry) Init(
	id uuid.I, info *Info,
) (ulid.I, error)

func (*Registry) InitRepo

func (r *Registry) InitRepo(
	id uuid.I, vid ulid.I, cmd *CmdInitRepo,
) (newVid ulid.I, repoId uuid.I, err error)

func (*Registry) InitRoot

func (r *Registry) InitRoot(
	id uuid.I, vid ulid.I, cmd *CmdInitRoot,
) (ulid.I, error)

func (*Registry) PatchRepoNaming

func (r *Registry) PatchRepoNaming(
	id uuid.I, vid ulid.I, namingPatch *pb.FsoRepoNaming,
) (ulid.I, error)

func (*Registry) PostShadowRepoMoveStarted

func (r *Registry) PostShadowRepoMoveStarted(
	id uuid.I, vid ulid.I,
	repoId uuid.I, repoEventId ulid.I, workflowId uuid.I,
) (ulid.I, error)

`PostShadowRepoMoveStarted()` is called by Nogfsoregd in `replicated.go` to duplicate `EV_FSO_SHADOW_REPO_MOVE_STARTED` repo events to the registry, so that Nogfsostad learns about them by watching the registry.

func (*Registry) ReinitRepo

func (r *Registry) ReinitRepo(
	id uuid.I, vid ulid.I, cmd *CmdReinitRepo,
) (ulid.I, error)

func (*Registry) RemoveRoot

func (r *Registry) RemoveRoot(
	id uuid.I, vid ulid.I, root string,
) (ulid.I, error)

func (*Registry) SetPathFlags

func (r *Registry) SetPathFlags(
	id uuid.I, vid ulid.I, path string, flags uint32,
) (ulid.I, error)

func (*Registry) SetRepoInitPolicy

func (r *Registry) SetRepoInitPolicy(
	id uuid.I, vid ulid.I, policy *pb.FsoRepoInitPolicy,
) (ulid.I, error)

func (*Registry) SetRepoNaming

func (r *Registry) SetRepoNaming(
	id uuid.I, vid ulid.I, naming *pb.FsoRepoNaming,
) (ulid.I, error)

func (*Registry) UnsetPathFlags

func (r *Registry) UnsetPathFlags(
	id uuid.I, vid ulid.I, path string, flags uint32,
) (ulid.I, error)

func (*Registry) UpdateRootArchiveRecipients

func (r *Registry) UpdateRootArchiveRecipients(
	id uuid.I, vid ulid.I, globalRoot string, keys gpg.Fingerprints,
) (*State, error)

`UpdateRootArchiveRecipients()` sets the archive GPG keys, enabling encryption.

func (*Registry) UpdateRootShadowBackupRecipients

func (r *Registry) UpdateRootShadowBackupRecipients(
	id uuid.I, vid ulid.I, globalRoot string, keys gpg.Fingerprints,
) (*State, error)

`UpdateRootShadowBackupRecipients()` sets the archive GPG keys, enabling encryption.

func (*Registry) UpdateSplitRootConfig

func (r *Registry) UpdateSplitRootConfig(
	id uuid.I, vid ulid.I, root string, cfg *SplitRootConfig,
) (*State, error)

type RepoInfo

type RepoInfo struct {
	Id              uuid.I
	GlobalPath      string
	GitlabNamespace string
	Confirmed       bool
	ReinitReason    string

	StorageTier StorageTierCode
	// contains filtered or unexported fields
}

`Creator*` is stored in the event, but not in the aggregate state, because it is only of temporary interest.

type RootInfo

type RootInfo struct {
	GlobalRoot             string
	Host                   string
	HostRoot               string
	GitlabNamespace        string
	ArchiveRecipients      gpg.Fingerprints
	ShadowBackupRecipients gpg.Fingerprints
}

type SplitRootConfig

type SplitRootConfig struct {
	MaxDepth     int32
	MinDiskUsage int64
	MaxDiskUsage int64
}

type State

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

func (*State) AggregateState

func (*State) AggregateState()

func (*State) HasRoot

func (s *State) HasRoot(root string) bool

func (*State) Id

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

func (*State) MayArchiveRepo

func (st *State) MayArchiveRepo(repoId uuid.I) (ok bool, reason string)

`MayArchiveRepo()` is used in `BeginArchiveRepo()` to check preconditions before initializing an archive-repo workflow.

func (*State) MayFreezeRepo

func (st *State) MayFreezeRepo(repoId uuid.I) (ok bool, reason string)

`MayFreezeRepo()` is used in `BeginFreezeRepo()` to check preconditions before initializing a freeze-repo workflow.

func (*State) MayUnarchiveRepo

func (st *State) MayUnarchiveRepo(repoId uuid.I) (ok bool, reason string)

`MayUnarchiveRepo()` is used in `BeginUnarchiveRepo()` to check preconditions before initializing an archive-repo workflow.

func (*State) MayUnfreezeRepo

func (st *State) MayUnfreezeRepo(repoId uuid.I) (ok bool, reason string)

`MayUnfreezeRepo()` is used in `BeginUnfreezeRepo()` to check preconditions before initializing a freeze-repo workflow.

func (*State) Name

func (s *State) Name() string

func (*State) NumRepos

func (s *State) NumRepos() int

func (*State) NumRoots

func (s *State) NumRoots() int

func (*State) PathFlagsPrefix

func (s *State) PathFlagsPrefix(prefix string) map[string]uint32

func (*State) RepoAclPolicy

func (s *State) RepoAclPolicy(id uuid.I) (*pb.RepoAclPolicy, error)

func (*State) RepoById

func (s *State) RepoById(id uuid.I) (*RepoInfo, bool)

func (*State) RepoByPath

func (s *State) RepoByPath(path string) (*RepoInfo, bool)

func (*State) RepoRoot

func (s *State) RepoRoot(id uuid.I) (*RootInfo, error)

func (*State) Repos

func (s *State) Repos() []*RepoInfo

func (*State) ReposPrefix

func (s *State) ReposPrefix(prefix string) []*RepoInfo

`ReposPrefix(prefix)` returns repos whose global path is equal or below `prefix`. `prefix` must not have a trailing slash.

func (*State) Root

func (s *State) Root(root string) (*RootInfo, bool)

func (*State) Roots

func (s *State) Roots() []*RootInfo

func (*State) SetVid

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

func (*State) SplitRootConfig

func (s *State) SplitRootConfig(root string) (*SplitRootConfig, bool)

func (*State) Vid

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

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 WorkflowIdChecker

type WorkflowIdChecker interface {
	IsUnusedWorkflowId(uuid.I) (deny string, err error)
}

type WorkflowIdError

type WorkflowIdError struct {
	Reason string
}

func (*WorkflowIdError) Error

func (err *WorkflowIdError) Error() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL