storage

package
v0.0.0-...-aac4589 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2021 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(header testevent.Header) testevent.Emitter

NewTestEventEmitter creates a new Emitter object associated with a Header

func NewTestEventEmitterFetcher

func NewTestEventEmitterFetcher(header testevent.Header) testevent.EmitterFetcher

NewTestEventEmitterFetcher creates a new EmitterFetcher object associated with a Header

func NewTestEventEmitterFetcherWithAllowedEvents

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

NewTestEventEmitterFetcherWithAllowedEvents creates a new EmitterFetcher object associated with a Header

func NewTestEventEmitterWithAllowedEvents

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

NewTestEventEmitterWithAllowedEvents creates a new Emitter object associated with a Header

func NewTestEventFetcher

func NewTestEventFetcher() testevent.Fetcher

NewTestEventFetcher creates a new Fetcher object associated with a Header

func SetAsyncStorage

func SetAsyncStorage(storageEngine Storage) error

SetAsyncStorage sets the desired storage engine for read-only events. Switching to a new storage engine implies garbage collecting the old one, with possible loss of pending events if not flushed correctly

func SetStorage

func SetStorage(storageEngine Storage) error

SetStorage sets the desired storage engine for events. Switching to a new storage engine implies garbage collecting the old one, with possible loss of pending events if not flushed correctly

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 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 {
}

FrameworkEventEmitter implements Emitter interface from the frameworkevent package

func NewFrameworkEventEmitter

func NewFrameworkEventEmitter() 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() FrameworkEventEmitterFetcher

NewFrameworkEventEmitterFetcher creates a new EmitterFetcher object for framework events

type FrameworkEventFetcher

type FrameworkEventFetcher struct {
}

FrameworkEventFetcher implements the Fetcher interface from the frameworkevent package

func NewFrameworkEventFetcher

func NewFrameworkEventFetcher() 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 {
}

JobStorageManager implements JobStorage interface

func NewJobStorageManager

func NewJobStorageManager() 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 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

func GetStorage

func GetStorage() (Storage, error)

GetStorage returns the primary storage for events.

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 {
}

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