boltdb

package
v1.3.1-rc2 Latest Latest
Warning

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

Go to latest
Published: May 23, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultSliceRetrievalCapacity = 10

	BucketExecutionsName = "execution"
	BucketHistoryName    = "execution-history"
	BucketJobIndexName   = "execution-index"
	BucketLiveIndexName  = "execution-live-index"
)
View Source
const (
	DefaultDatabasePermissions = 0600
)

Variables

This section is empty.

Functions

func GetDatabase

func GetDatabase(path string) (*bolt.DB, error)

Types

type StateCounter

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

func NewStateCounter

func NewStateCounter() *StateCounter

func (*StateCounter) DecrementState

func (s *StateCounter) DecrementState(key store.LocalExecutionStateType, amount uint64)

func (*StateCounter) Get

func (*StateCounter) Include

func (s *StateCounter) Include(other *StateCounter)

func (*StateCounter) IncrementState

func (s *StateCounter) IncrementState(key store.LocalExecutionStateType, amount uint64)

type Store

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

func NewStore

func NewStore(ctx context.Context, dbPath string) (*Store, error)

NewStore creates a new store backed by a boltdb database at the file location provided by the caller. During initialisation the primary buckets are created, but they are not stored in the struct as they are tied to the transaction where they are referenced and it would mean later transactions will fail unless they obtain their own reference to the bucket.

func (*Store) Close

func (s *Store) Close(ctx context.Context) error

Close ensures the database is closed cleanly

func (*Store) CreateExecution

func (s *Store) CreateExecution(ctx context.Context, localExecutionState store.LocalExecutionState) error

CreateExecution creates a new execution in the database and also sets up the relevant index entry for the new execution.

func (*Store) DeleteExecution

func (s *Store) DeleteExecution(ctx context.Context, executionID string) error

DeleteExecution delete the execution, removes its history and removes it from the job index (along with the job indexes bucket)

func (*Store) GetExecution

func (s *Store) GetExecution(ctx context.Context, executionID string) (store.LocalExecutionState, error)

GetExecution returns the stored LocalExecutionState structure for the provided execution ID.

func (*Store) GetExecutionCount

func (s *Store) GetExecutionCount(ctx context.Context, state store.LocalExecutionStateType) (uint64, error)

func (*Store) GetExecutionHistory

func (s *Store) GetExecutionHistory(ctx context.Context, executionID string) ([]store.LocalStateHistory, error)

GetExecutionHistory retrieves the execution history for a single execution specified by the executionID parameter.

func (*Store) GetExecutions

func (s *Store) GetExecutions(ctx context.Context, jobID string) ([]store.LocalExecutionState, error)

GetExecutions retrieves akk if the executions from the job-index bucket for the provided Job ID.

func (*Store) GetLiveExecutions

func (s *Store) GetLiveExecutions(ctx context.Context) ([]store.LocalExecutionState, error)

func (*Store) UpdateExecutionState

func (s *Store) UpdateExecutionState(ctx context.Context, request store.UpdateExecutionStateRequest) error

UpdateExecutionState updates the current state of the execution

Jump to

Keyboard shortcuts

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