storage

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2022 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplyJobQueryField

func ApplyJobQueryField(fieldPtr interface{}, queryField JobQueryField) error

func NewTestEventEmitter

func NewTestEventEmitter(vault EngineVault, header testevent.Header) testevent.Emitter

NewTestEventEmitter creates a new Emitter object associated with a Header

func NewTestEventEmitterFetcher

func NewTestEventEmitterFetcher(vault EngineVault, header testevent.Header) testevent.EmitterFetcher

NewTestEventEmitterFetcher creates a new EmitterFetcher object associated with a Header

func NewTestEventEmitterFetcherWithAllowedEvents

func NewTestEventEmitterFetcherWithAllowedEvents(vault EngineVault, header testevent.Header, allowedEvents *map[event.Name]bool) testevent.EmitterFetcher

NewTestEventEmitterFetcherWithAllowedEvents creates a new EmitterFetcher object associated with a Header

func NewTestEventEmitterWithAllowedEvents

func NewTestEventEmitterWithAllowedEvents(vault EngineVault, header testevent.Header, allowedEvents *map[event.Name]bool) testevent.Emitter

NewTestEventEmitterWithAllowedEvents creates a new Emitter object associated with a Header

func NewTestEventFetcher

func NewTestEventFetcher(vault EngineVault) testevent.Fetcher

NewTestEventFetcher creates a new Fetcher object associated with a Header

func WithConsistencyModel

func WithConsistencyModel(ctx xcontext.Context, model ConsistencyModel) xcontext.Context

Types

type ConsistencyModel

type ConsistencyModel int

ConsistencyModel hints at whether queries should go to the primary database or any available replica (in which case, the guarantee is eventual consistency)

const (
	ConsistentReadAfterWrite ConsistencyModel = iota
	ConsistentEventually
)

type EngineType

type EngineType uint32
const (
	UnknownEngine EngineType = iota
	SyncEngine
	AsyncEngine
)

type EngineVault

type EngineVault interface {
	// GetEngine - fetch the engine of selected type from the emitterVault
	GetEngine(EngineType) (Storage, error)
}

type EngineVaultMap

type EngineVaultMap map[EngineType]Storage

type ErrJobQueryFieldHasZeroValue

type ErrJobQueryFieldHasZeroValue struct {
	QueryField JobQueryField
}

ErrQueryFieldHasZeroValue is returned when a QueryFields failed validation due to a QueryField with a zero value (this is unexpected and forbidden).

func (ErrJobQueryFieldHasZeroValue) Error

type ErrJobQueryFieldIsAlreadySet

type ErrJobQueryFieldIsAlreadySet struct {
	FieldValue interface{}
	QueryField JobQueryField
}

func (ErrJobQueryFieldIsAlreadySet) Error

type EventStorage

type EventStorage interface {
	// Test events storage interface
	StoreTestEvent(ctx xcontext.Context, event testevent.Event) error
	GetTestEvents(ctx xcontext.Context, eventQuery *testevent.Query) ([]testevent.Event, error)

	// Framework events storage interface
	StoreFrameworkEvent(ctx xcontext.Context, event frameworkevent.Event) error
	GetFrameworkEvent(ctx xcontext.Context, eventQuery *frameworkevent.Query) ([]frameworkevent.Event, error)
}

type FrameworkEventEmitter

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

FrameworkEventEmitter implements Emitter interface from the frameworkevent package

func NewFrameworkEventEmitter

func NewFrameworkEventEmitter(vault EngineVault) FrameworkEventEmitter

NewFrameworkEventEmitter creates a new Emitter object for framework events

func (FrameworkEventEmitter) Emit

Emit emits an event using the selected storage engine

type FrameworkEventEmitterFetcher

type FrameworkEventEmitterFetcher struct {
	FrameworkEventEmitter
	FrameworkEventFetcher
}

FrameworkEventEmitterFetcher implements Emitter and Fetcher interface from the frameworkevent package

func NewFrameworkEventEmitterFetcher

func NewFrameworkEventEmitterFetcher(vault EngineVault) FrameworkEventEmitterFetcher

NewFrameworkEventEmitterFetcher creates a new EmitterFetcher object for framework events

type FrameworkEventFetcher

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

FrameworkEventFetcher implements the Fetcher interface from the frameworkevent package

func NewFrameworkEventFetcher

func NewFrameworkEventFetcher(vault EngineVault) FrameworkEventFetcher

NewFrameworkEventFetcher creates a new Fetcher object for framework events

func (FrameworkEventFetcher) Fetch

Fetch retrieves events based on QueryFields that are used to build a Query object for FrameworkEvents

type JobQuery

type JobQuery struct {
	States   []job.State
	Tags     []string
	ServerID string
}

func BuildJobQuery

func BuildJobQuery(queryFields ...JobQueryField) (*JobQuery, error)

type JobQueryField

type JobQueryField interface {
	// contains filtered or unexported methods
}

func QueryJobServerID

func QueryJobServerID(serverID string) JobQueryField

func QueryJobStates

func QueryJobStates(states ...job.State) JobQueryField

func QueryJobTags

func QueryJobTags(tags ...string) JobQueryField

type JobQueryFields

type JobQueryFields []JobQueryField

func (JobQueryFields) BuildQuery

func (queryFields JobQueryFields) BuildQuery() (*JobQuery, error)

type JobStorage

type JobStorage interface {
	// Job request interface
	StoreJobRequest(ctx xcontext.Context, request *job.Request) (types.JobID, error)
	GetJobRequest(ctx xcontext.Context, jobID types.JobID) (*job.Request, error)

	// Job report interface
	StoreReport(ctx xcontext.Context, report *job.Report) error
	GetJobReport(ctx xcontext.Context, jobID types.JobID) (*job.JobReport, error)

	// Job enumeration interface
	ListJobs(ctx xcontext.Context, query *JobQuery) ([]types.JobID, error)
}

JobStorage defines the interface that implements persistence for job related information

type JobStorageManager

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

JobStorageManager implements JobStorage interface

func NewJobStorageManager

func NewJobStorageManager(vault EngineVault) JobStorageManager

NewJobStorageManager creates a new JobStorageManager object

func (JobStorageManager) GetJobReport

func (jsm JobStorageManager) GetJobReport(ctx xcontext.Context, jobID types.JobID) (*job.JobReport, error)

GetJobReport fetches a job report from the storage layer

func (JobStorageManager) GetJobRequest

func (jsm JobStorageManager) GetJobRequest(ctx xcontext.Context, jobID types.JobID) (*job.Request, error)

GetJobRequest fetches a job request from the storage layer

func (JobStorageManager) ListJobs

func (jsm JobStorageManager) ListJobs(ctx xcontext.Context, query *JobQuery) ([]types.JobID, error)

ListJobs returns list of job IDs matching the query

func (JobStorageManager) StoreJobRequest

func (jsm JobStorageManager) StoreJobRequest(ctx xcontext.Context, request *job.Request) (types.JobID, error)

StoreJobRequest submits a job request to the storage layer

func (JobStorageManager) StoreReport

func (jsm JobStorageManager) StoreReport(ctx xcontext.Context, report *job.Report) error

StoreReport submits a job run or final report to the storage layer

type ResettableStorage

type ResettableStorage interface {
	Storage
	Reset() error
}

ResettableStorage is implemented by storage engines that support reset operation

type SimpleEngineVault

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

func NewSimpleEngineVault

func NewSimpleEngineVault() *SimpleEngineVault

NewSimpleEngineVault - returns a new instance of SimpleEngineVault

func (*SimpleEngineVault) GetEngine

func (v *SimpleEngineVault) GetEngine(engineType EngineType) (Storage, error)

GetEngine - get storage engine from the vault. Defaults to SyncEngine.

func (*SimpleEngineVault) StoreEngine

func (v *SimpleEngineVault) StoreEngine(storageEngine Storage, engineType EngineType) error

StoreEngine - store supplied engine in the emitterVault. As SyncEngine by default Switching to a new storage engine implies garbage collecting the old one, with possible loss of pending events if not flushed correctly

type Storage

type Storage interface {
	JobStorage
	EventStorage

	// Close flushes and releases resources associated with the storage engine.
	Close() error

	// Version returns the version of the storage being used
	Version() (uint64, error)
}

Storage defines the interface that storage engines must implement

type TestEventEmitter

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

TestEventEmitter implements Emitter interface from the testevent package

func (TestEventEmitter) Emit

Emit emits an event using the selected storage layer

type TestEventEmitterFetcher

type TestEventEmitterFetcher struct {
	TestEventEmitter
	TestEventFetcher
}

TestEventEmitterFetcher implements Emitter and Fetcher interface of the testevent package

type TestEventFetcher

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

TestEventFetcher implements the Fetcher interface from the testevent package

func (TestEventFetcher) Fetch

func (ev TestEventFetcher) Fetch(ctx xcontext.Context, queryFields ...testevent.QueryField) ([]testevent.Event, error)

Fetch retrieves events based on QueryFields that are used to build a Query object for TestEvents

type TransactionalStorage

type TransactionalStorage interface {
	Storage
	BeginTx() (TransactionalStorage, error)
	Commit() error
	Rollback() error
}

TransactionalStorage is implemented by storage backends that support transactions. Only default isolation level is supported.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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