invariant

package
v0.15.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 8, 2020 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package invariant is a generated GoMock package.

Index

Constants

View Source
const (
	// CheckResultTypeFailed indicates a failure occurred while attempting to run check
	CheckResultTypeFailed CheckResultType = "failed"
	// CheckResultTypeCorrupted indicates check successfully ran and detected a corruption
	CheckResultTypeCorrupted CheckResultType = "corrupted"
	// CheckResultTypeHealthy indicates check successfully ran and detected no corruption
	CheckResultTypeHealthy CheckResultType = "healthy"

	// FixResultTypeSkipped indicates that fix skipped execution
	FixResultTypeSkipped FixResultType = "skipped"
	// FixResultTypeFixed indicates that fix successfully fixed an execution
	FixResultTypeFixed FixResultType = "fixed"
	// FixResultTypeFailed indicates that fix attempted to fix an execution but failed to do so
	FixResultTypeFailed FixResultType = "failed"

	// HistoryExists asserts that history must exist if concrete execution exists
	HistoryExists Name = "history_exists"
	// OpenCurrentExecution asserts that an open concrete execution must have a valid current execution
	OpenCurrentExecution Name = "open_current_execution"
	// ConcreteExecutionExists asserts that an open current execution must have a valid concrete execution
	ConcreteExecutionExists Name = "concrete_execution_exists"

	// CollectionMutableState is the collection of invariants relating to mutable state
	CollectionMutableState Collection = 0
	// CollectionHistory is the collection  of invariants relating to history
	CollectionHistory Collection = 1
)

Variables

This section is empty.

Functions

func ExecutionOpen

func ExecutionOpen(execution interface{}) bool

ExecutionOpen returns true if execution state is open false if workflow is closed

func ExecutionStillExists

func ExecutionStillExists(
	exec *entity.Execution,
	pr persistence.Retryer,
) (bool, error)

ExecutionStillExists returns true if execution still exists in persistence, false otherwise. Returns error on failure to confirm.

func ExecutionStillOpen

func ExecutionStillOpen(
	exec *entity.Execution,
	pr persistence.Retryer,
) (bool, error)

ExecutionStillOpen returns true if execution in persistence exists and is open, false otherwise. Returns error on failure to confirm.

func Open

func Open(state int) bool

Open returns true if workflow state is open false if workflow is closed

Types

type CheckResult

type CheckResult struct {
	CheckResultType CheckResultType
	InvariantName   Name
	Info            string
	InfoDetails     string
}

CheckResult is the result of running Check.

type CheckResultType

type CheckResultType string

CheckResultType is the result type of running an invariant check

type Collection

type Collection int

Collection is a type which indicates a collection of invariants

type FixResult

type FixResult struct {
	FixResultType FixResultType
	InvariantType Name
	CheckResult   CheckResult
	Info          string
	InfoDetails   string
}

FixResult is the result of running Fix.

func DeleteExecution

func DeleteExecution(
	exec interface{},
	pr persistence.Retryer,
) *FixResult

DeleteExecution deletes concrete execution and current execution conditionally on matching runID.

type FixResultType

type FixResultType string

FixResultType is the result type of running an invariant fix

type Invariant

type Invariant interface {
	Check(interface{}) CheckResult
	Fix(interface{}) FixResult
	Name() Name
}

Invariant represents an invariant of a single execution. It can be used to check that the execution satisfies the invariant. It can also be used to fix the invariant for an execution.

func NewConcreteExecutionExists

func NewConcreteExecutionExists(
	pr persistence.Retryer,
) Invariant

NewConcreteExecutionExists returns a new invariant for checking concrete execution

func NewHistoryExists

func NewHistoryExists(
	pr persistence.Retryer,
) Invariant

NewHistoryExists returns a new history exists invariant

func NewOpenCurrentExecution

func NewOpenCurrentExecution(
	pr persistence.Retryer,
) Invariant

NewOpenCurrentExecution returns a new invariant for checking open current execution

type Manager

type Manager interface {
	RunChecks(interface{}) ManagerCheckResult
	RunFixes(interface{}) ManagerFixResult
}

Manager represents a manager of several invariants. It can be used to run a group of invariant checks or fixes.

func NewInvariantManager

func NewInvariantManager(
	invariants []Invariant,
) Manager

NewInvariantManager handles running a collection of invariants according to the invariant collection provided.

type ManagerCheckResult

type ManagerCheckResult struct {
	CheckResultType          CheckResultType
	DeterminingInvariantType *Name
	CheckResults             []CheckResult
}

ManagerCheckResult is the result of running a list of checks

type ManagerFixResult

type ManagerFixResult struct {
	FixResultType            FixResultType
	DeterminingInvariantType *Name
	FixResults               []FixResult
}

ManagerFixResult is the result of running a list of fixes

type MockInvariant

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

MockInvariant is a mock of Invariant interface

func NewMockInvariant

func NewMockInvariant(ctrl *gomock.Controller) *MockInvariant

NewMockInvariant creates a new mock instance

func (*MockInvariant) Check

func (m *MockInvariant) Check(arg0 interface{}) CheckResult

Check mocks base method

func (*MockInvariant) EXPECT

EXPECT returns an object that allows the caller to indicate expected use

func (*MockInvariant) Fix

func (m *MockInvariant) Fix(arg0 interface{}) FixResult

Fix mocks base method

func (*MockInvariant) Name

func (m *MockInvariant) Name() Name

InvariantType mocks base method

type MockInvariantMockRecorder

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

MockInvariantMockRecorder is the mock recorder for MockInvariant

func (*MockInvariantMockRecorder) Check

func (mr *MockInvariantMockRecorder) Check(arg0 interface{}) *gomock.Call

Check indicates an expected call of Check

func (*MockInvariantMockRecorder) Fix

func (mr *MockInvariantMockRecorder) Fix(arg0 interface{}) *gomock.Call

Fix indicates an expected call of Fix

func (*MockInvariantMockRecorder) InvariantType

func (mr *MockInvariantMockRecorder) InvariantType() *gomock.Call

InvariantType indicates an expected call of InvariantType

type MockManager

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

MockManager is a mock of Manager interface

func NewMockManager

func NewMockManager(ctrl *gomock.Controller) *MockManager

NewMockManager creates a new mock instance

func (*MockManager) EXPECT

func (m *MockManager) EXPECT() *MockManagerMockRecorder

EXPECT returns an object that allows the caller to indicate expected use

func (*MockManager) RunChecks

func (m *MockManager) RunChecks(arg0 interface{}) ManagerCheckResult

RunChecks mocks base method

func (*MockManager) RunFixes

func (m *MockManager) RunFixes(arg0 interface{}) ManagerFixResult

RunFixes mocks base method

type MockManagerMockRecorder

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

MockManagerMockRecorder is the mock recorder for MockManager

func (*MockManagerMockRecorder) RunChecks

func (mr *MockManagerMockRecorder) RunChecks(arg0 interface{}) *gomock.Call

RunChecks indicates an expected call of RunChecks

func (*MockManagerMockRecorder) RunFixes

func (mr *MockManagerMockRecorder) RunFixes(arg0 interface{}) *gomock.Call

RunFixes indicates an expected call of RunFixes

type Name

type Name string

Name is the type of an invariant

func NamePtr

func NamePtr(t Name) *Name

NamePtr returns a pointer to Name

Jump to

Keyboard shortcuts

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