moveshadowwf

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

Documentation

Overview

Package `moveshadowwf` implements the move-shadow workflow, which changes the location of a shadow repo.

Workflow Events

The workflow is initiated on a repo with `RepoEvent_EV_FSO_SHADOW_REPO_MOVE_STARTED`, currently by an admin using `nogfsoctl begin-move-shadow`.

Nogfsoregd replicate initializes the workflow aggregate with `WorkflowEvent_EV_FSO_SHADOW_REPO_MOVE_STARTED`. It then posts a notification on the registry `RegistryEvent_EV_FSO_SHADOW_REPO_MOVE_STARTED`, so that Nogfsostad can observe the start of the move-shadow workflow.

Nogfsostad disables the repo and posts `WorkflowEvent_EV_FSO_SHADOW_REPO_MOVE_STA_DISABLED` to confirm that it is disabled.

The workflow completes the move with `WorkflowEvent_EV_FSO_SHADOW_REPO_MOVED`, currently by an admin using `nogfsoctl commit-move-shadow`.

Nogfsoregd replicate commits the move to `RepoEvent_EV_FSO_SHADOW_REPO_MOVED` and terminates the workflow with `WorkflowEvent_EV_FSO_SHADOW_REPO_MOVE_COMMITTED`.

Index

Constants

This section is empty.

Variables

View Source
var ErrConflict = errors.New("workflow conflict")
View Source
var ErrConflictInit = errors.New("workflow init conflict")
View Source
var ErrInvalidCommand = errors.New("invalid workflow command")
View Source
var ErrInvalidEventType = errors.New("invalid event type")
View Source
var ErrMoved = errors.New("workflow move completed")
View Source
var ErrNotMoved = errors.New("workflow did not complete move")
View Source
var ErrStaActive = errors.New("nogfsostad has yet not disabled the repo")
View Source
var ErrTerminated = errors.New("workflow terminated")
View Source
var ErrUninitialized = errors.New("workflow uninitialized")
View Source
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.

func (*Advancer) Advance

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

type Behavior

type Behavior struct{}

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

type CmdCommit

type CmdCommit struct{}

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
}

func (*CmdInit) AggregateCommand

func (*CmdInit) AggregateCommand()

type CmdPostStadDisabled

type CmdPostStadDisabled struct{}

func (*CmdPostStadDisabled) AggregateCommand

func (*CmdPostStadDisabled) AggregateCommand()

type Event

type Event struct{ wfevents.Event }

func (*Event) UnmarshalProto

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

type State

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

func (*State) AggregateState

func (*State) AggregateState()

func (*State) Id

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

func (*State) IsTerminated

func (st *State) IsTerminated() bool

func (*State) RepoId

func (st *State) RepoId() uuid.I

func (*State) SetVid

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

func (*State) Vid

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

type Workflows

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

func New

func New(journal *events.Journal) *Workflows

func (*Workflows) Commit

func (r *Workflows) Commit(id uuid.I, vid ulid.I) (ulid.I, error)

`Commit()` completes the move.

func (*Workflows) Exit

func (r *Workflows) Exit(id uuid.I, vid ulid.I) (ulid.I, error)

`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) FindId

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

func (*Workflows) Init

func (r *Workflows) Init(
	id uuid.I, repoId uuid.I, repoEventId ulid.I,
) (ulid.I, error)

`Init()` initializes a workflow.

It is called by Nogfsoregd replicate when it sees a `RepoEvent_EV_FSO_SHADOW_REPO_MOVE_STARTED`.

func (*Workflows) PostStadDisabled

func (r *Workflows) PostStadDisabled(id uuid.I, vid ulid.I) (ulid.I, error)

`PostStadDisabled()` adds an event that indicates that Nogfsostad has disabled the repo.

Jump to

Keyboard shortcuts

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