store

package
v1.1.4-rc1 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package store is a generated GoMock package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ValidateNewExecution

func ValidateNewExecution(localExecutionState LocalExecutionState) error

Types

type ErrExecutionAlreadyExists

type ErrExecutionAlreadyExists struct {
	ExecutionID string
}

ErrExecutionAlreadyExists is returned when an execution already exists

func NewErrExecutionAlreadyExists

func NewErrExecutionAlreadyExists(id string) ErrExecutionAlreadyExists

func (ErrExecutionAlreadyExists) Error

type ErrExecutionAlreadyTerminal

type ErrExecutionAlreadyTerminal struct {
	ExecutionID string
	Actual      LocalExecutionStateType
	NewState    LocalExecutionStateType
}

ErrExecutionAlreadyTerminal is returned when an execution is already in terminal state and cannot be updated.

func (ErrExecutionAlreadyTerminal) Error

type ErrExecutionHistoryNotFound

type ErrExecutionHistoryNotFound struct {
	ExecutionID string
}

ErrExecutionHistoryNotFound is returned when the execution is not found

func NewErrExecutionHistoryNotFound

func NewErrExecutionHistoryNotFound(id string) ErrExecutionHistoryNotFound

func (ErrExecutionHistoryNotFound) Error

type ErrExecutionNotFound

type ErrExecutionNotFound struct {
	ExecutionID string
}

ErrExecutionNotFound is returned when the execution is not found

func NewErrExecutionNotFound

func NewErrExecutionNotFound(id string) ErrExecutionNotFound

func (ErrExecutionNotFound) Error

func (e ErrExecutionNotFound) Error() string

type ErrExecutionsNotFoundForJob added in v0.3.24

type ErrExecutionsNotFoundForJob struct {
	JobID string
}

ErrExecutionsNotFoundForJob is returned when the execution is not found for a given job

func NewErrExecutionsNotFoundForJob added in v0.3.24

func NewErrExecutionsNotFoundForJob(id string) ErrExecutionsNotFoundForJob

func (ErrExecutionsNotFoundForJob) Error added in v0.3.24

type ErrInvalidExecutionState

type ErrInvalidExecutionState struct {
	ExecutionID string
	Actual      LocalExecutionStateType
	Expected    []LocalExecutionStateType
}

ErrInvalidExecutionState is returned when an execution is in an invalid state.

func NewErrInvalidExecutionState

func NewErrInvalidExecutionState(id string, actual LocalExecutionStateType, expected ...LocalExecutionStateType) ErrInvalidExecutionState

func (ErrInvalidExecutionState) Error

func (e ErrInvalidExecutionState) Error() string

type ErrInvalidExecutionVersion

type ErrInvalidExecutionVersion struct {
	ExecutionID string
	Actual      int
	Expected    int
}

ErrInvalidExecutionVersion is returned when an execution has an invalid version.

func NewErrInvalidExecutionVersion

func NewErrInvalidExecutionVersion(id string, actual int, expected int) ErrInvalidExecutionVersion

func (ErrInvalidExecutionVersion) Error

type ErrJobNotFound added in v1.0.4

type ErrJobNotFound struct {
	JobID string
}

ErrJobNotFound is returned when the a job isn't found when trying to get its executions

func NewErrJobNotFound added in v1.0.4

func NewErrJobNotFound(id string) ErrJobNotFound

func (ErrJobNotFound) Error added in v1.0.4

func (e ErrJobNotFound) Error() string

type ErrNilExecution

type ErrNilExecution struct{}

ErrNilExecution is returned when the execution is nil

func NewErrNilExecution

func NewErrNilExecution() ErrNilExecution

func (ErrNilExecution) Error

func (e ErrNilExecution) Error() string

type ExecutionStore

type ExecutionStore interface {
	// GetExecution returns the execution for a given id
	GetExecution(ctx context.Context, id string) (LocalExecutionState, error)
	// GetExecutions returns all the executions for a given job
	GetExecutions(ctx context.Context, jobID string) ([]LocalExecutionState, error)
	// GetLiveExecutions gets an array of the executions currently in the
	// active state (ExecutionStateBidAccepted)
	GetLiveExecutions(ctx context.Context) ([]LocalExecutionState, error)
	// GetExecutionHistory returns the history of an execution
	GetExecutionHistory(ctx context.Context, id string) ([]LocalStateHistory, error)
	// CreateExecution creates a new execution for a given job
	CreateExecution(ctx context.Context, execution LocalExecutionState) error
	// UpdateExecutionState updates the execution state
	UpdateExecutionState(ctx context.Context, request UpdateExecutionStateRequest) error
	// DeleteExecution deletes an execution
	DeleteExecution(ctx context.Context, id string) error
	// GetExecutionCount returns a count of all executions that are in the specified
	// state
	GetExecutionCount(ctx context.Context, state LocalExecutionStateType) (uint64, error)
	// Close provides the opportunity for the underlying store to cleanup
	// any resources as the compute node is shutting down
	Close(ctx context.Context) error
}

ExecutionStore A metadata store of job executions handled by the current compute node

type ExecutionSummary

type ExecutionSummary struct {
	ExecutionID        string
	JobID              string
	State              string
	AllocatedResources models.AllocatedResources
}

Summary of an execution that is used in logging and debugging.

type LocalExecutionState added in v1.0.4

type LocalExecutionState struct {
	Execution       *models.Execution
	RequesterNodeID string
	State           LocalExecutionStateType
	Version         int
	CreateTime      time.Time
	UpdateTime      time.Time
	LatestComment   string
}

func GetActiveExecution

func GetActiveExecution(ctx context.Context, s ExecutionStore, jobID string) (LocalExecutionState, error)

GetActiveExecution returns the active execution for a given job. In case of a bug where we have more than a single active execution, the latest one is returned

func NewLocalExecutionState added in v1.0.4

func NewLocalExecutionState(execution *models.Execution, requesterNodeID string) *LocalExecutionState

func (*LocalExecutionState) Normalize added in v1.0.4

func (e *LocalExecutionState) Normalize()

Normalize normalizes the execution state

func (*LocalExecutionState) String added in v1.0.4

func (e *LocalExecutionState) String() string

string returns a string representation of the execution

func (*LocalExecutionState) ToSummary added in v1.0.4

func (e *LocalExecutionState) ToSummary() ExecutionSummary

ToSummary returns a summary of the execution

type LocalExecutionStateType added in v1.0.4

type LocalExecutionStateType int
const (
	ExecutionStateUndefined LocalExecutionStateType = iota
	ExecutionStateCreated
	ExecutionStateBidAccepted
	ExecutionStateRunning
	ExecutionStatePublishing
	ExecutionStateCompleted
	ExecutionStateFailed
	ExecutionStateCancelled
)

func ExecutionStateTypes added in v1.0.4

func ExecutionStateTypes() []LocalExecutionStateType

func (LocalExecutionStateType) IsActive added in v1.0.4

func (s LocalExecutionStateType) IsActive() bool

IsActive returns true if the execution is active

func (LocalExecutionStateType) IsExecuting added in v1.0.4

func (s LocalExecutionStateType) IsExecuting() bool

IsExecuting returns true if the execution is running in the backend

func (LocalExecutionStateType) IsTerminal added in v1.0.4

func (s LocalExecutionStateType) IsTerminal() bool

IsTerminal returns true if the execution is terminal

func (LocalExecutionStateType) IsUndefined added in v1.0.4

func (s LocalExecutionStateType) IsUndefined() bool

IsUndefined returns true if the execution state is undefined

func (LocalExecutionStateType) String added in v1.0.4

func (i LocalExecutionStateType) String() string

type LocalStateHistory added in v1.0.4

type LocalStateHistory struct {
	ExecutionID   string
	PreviousState LocalExecutionStateType
	NewState      LocalExecutionStateType
	NewVersion    int
	Comment       string
	Time          time.Time
}

type MockExecutionStore added in v1.0.4

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

MockExecutionStore is a mock of ExecutionStore interface.

func NewMockExecutionStore added in v1.0.4

func NewMockExecutionStore(ctrl *gomock.Controller) *MockExecutionStore

NewMockExecutionStore creates a new mock instance.

func (*MockExecutionStore) Close added in v1.0.4

func (m *MockExecutionStore) Close(ctx context.Context) error

Close mocks base method.

func (*MockExecutionStore) CreateExecution added in v1.0.4

func (m *MockExecutionStore) CreateExecution(ctx context.Context, execution LocalExecutionState) error

CreateExecution mocks base method.

func (*MockExecutionStore) DeleteExecution added in v1.0.4

func (m *MockExecutionStore) DeleteExecution(ctx context.Context, id string) error

DeleteExecution mocks base method.

func (*MockExecutionStore) EXPECT added in v1.0.4

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

func (*MockExecutionStore) GetExecution added in v1.0.4

func (m *MockExecutionStore) GetExecution(ctx context.Context, id string) (LocalExecutionState, error)

GetExecution mocks base method.

func (*MockExecutionStore) GetExecutionCount added in v1.0.4

func (m *MockExecutionStore) GetExecutionCount(ctx context.Context, state LocalExecutionStateType) (uint64, error)

GetExecutionCount mocks base method.

func (*MockExecutionStore) GetExecutionHistory added in v1.0.4

func (m *MockExecutionStore) GetExecutionHistory(ctx context.Context, id string) ([]LocalStateHistory, error)

GetExecutionHistory mocks base method.

func (*MockExecutionStore) GetExecutions added in v1.0.4

func (m *MockExecutionStore) GetExecutions(ctx context.Context, jobID string) ([]LocalExecutionState, error)

GetExecutions mocks base method.

func (*MockExecutionStore) GetLiveExecutions added in v1.0.4

func (m *MockExecutionStore) GetLiveExecutions(ctx context.Context) ([]LocalExecutionState, error)

GetLiveExecutions mocks base method.

func (*MockExecutionStore) UpdateExecutionState added in v1.0.4

func (m *MockExecutionStore) UpdateExecutionState(ctx context.Context, request UpdateExecutionStateRequest) error

UpdateExecutionState mocks base method.

type MockExecutionStoreMockRecorder added in v1.0.4

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

MockExecutionStoreMockRecorder is the mock recorder for MockExecutionStore.

func (*MockExecutionStoreMockRecorder) Close added in v1.0.4

func (mr *MockExecutionStoreMockRecorder) Close(ctx interface{}) *gomock.Call

Close indicates an expected call of Close.

func (*MockExecutionStoreMockRecorder) CreateExecution added in v1.0.4

func (mr *MockExecutionStoreMockRecorder) CreateExecution(ctx, execution interface{}) *gomock.Call

CreateExecution indicates an expected call of CreateExecution.

func (*MockExecutionStoreMockRecorder) DeleteExecution added in v1.0.4

func (mr *MockExecutionStoreMockRecorder) DeleteExecution(ctx, id interface{}) *gomock.Call

DeleteExecution indicates an expected call of DeleteExecution.

func (*MockExecutionStoreMockRecorder) GetExecution added in v1.0.4

func (mr *MockExecutionStoreMockRecorder) GetExecution(ctx, id interface{}) *gomock.Call

GetExecution indicates an expected call of GetExecution.

func (*MockExecutionStoreMockRecorder) GetExecutionCount added in v1.0.4

func (mr *MockExecutionStoreMockRecorder) GetExecutionCount(ctx, state interface{}) *gomock.Call

GetExecutionCount indicates an expected call of GetExecutionCount.

func (*MockExecutionStoreMockRecorder) GetExecutionHistory added in v1.0.4

func (mr *MockExecutionStoreMockRecorder) GetExecutionHistory(ctx, id interface{}) *gomock.Call

GetExecutionHistory indicates an expected call of GetExecutionHistory.

func (*MockExecutionStoreMockRecorder) GetExecutions added in v1.0.4

func (mr *MockExecutionStoreMockRecorder) GetExecutions(ctx, jobID interface{}) *gomock.Call

GetExecutions indicates an expected call of GetExecutions.

func (*MockExecutionStoreMockRecorder) GetLiveExecutions added in v1.0.4

func (mr *MockExecutionStoreMockRecorder) GetLiveExecutions(ctx interface{}) *gomock.Call

GetLiveExecutions indicates an expected call of GetLiveExecutions.

func (*MockExecutionStoreMockRecorder) UpdateExecutionState added in v1.0.4

func (mr *MockExecutionStoreMockRecorder) UpdateExecutionState(ctx, request interface{}) *gomock.Call

UpdateExecutionState indicates an expected call of UpdateExecutionState.

type UpdateExecutionStateRequest

type UpdateExecutionStateRequest struct {
	ExecutionID     string
	NewState        LocalExecutionStateType
	ExpectedStates  []LocalExecutionStateType
	ExpectedVersion int
	Comment         string
}

func (UpdateExecutionStateRequest) Validate added in v1.1.0

func (condition UpdateExecutionStateRequest) Validate(localExecutionState LocalExecutionState) error

Validate checks if the condition matches the given execution

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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