block_store

package
v0.53.0 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrBlockStoreIDEmpty is returned if the block store id was empty.
	ErrBlockStoreIDEmpty = errors.New("block store id cannot be empty")
	// ErrBlockStoreNotFound is returned if the block store was not found.
	ErrBlockStoreNotFound = errors.New("block store not found")
	// ErrReadOnly is returned if the block store is not writable.
	ErrReadOnly = errors.New("block store is read-only")
)

Functions

This section is empty.

Types

type AccessBlockStoreFunc

type AccessBlockStoreFunc = func(ctx context.Context, released func()) (Store, func(), error)

AccessBlockStoreFunc is a function to access a BlockStoreHandle. Optionally pass a released function that may be called when the handle was released. Returns a release function.

func NewAccessBlockStoreViaBusFunc

func NewAccessBlockStoreViaBusFunc(b bus.Bus, blockStoreID string, returnIfIdle bool) AccessBlockStoreFunc

NewAccessBlockStoreViaBusFunc builds a new func which accesses the BlockStore on the given bus using the LookupBlocKStore directive.

If returnIfIdle is set: ErrBlockStoreNotFound is returned if not found.

type Constructor

type Constructor func(
	ctx context.Context,
	le *logrus.Entry,
) (Store, error)

Constructor constructs a block store with common parameters.

type LookupBlockStore

type LookupBlockStore interface {
	// Directive indicates LookupBlockStore is a directive.
	directive.Directive

	// LookupBlockStoreId is the block store id to lookup.
	// If empty, returns all block stores on the bus.
	LookupBlockStoreId() string
}

LookupBlockStore is a directive to lookup a block store.

func NewLookupBlockStore

func NewLookupBlockStore(blockStoreId string) LookupBlockStore

NewLookupBlockStore constructs a new LookupBlockStore directive.

type LookupBlockStoreValue

type LookupBlockStoreValue = Store

LookupBlockStoreValue is the result type for LookupBlockStore. Multiple results may be pushed to the directive.

func ExLookupBlockStores

func ExLookupBlockStores(
	ctx context.Context,
	b bus.Bus,
	blockStoreId string,
	waitOne bool,
) ([]LookupBlockStoreValue, directive.Instance, directive.Reference, error)

ExLookupBlockStores executes the LookupBlockStore directive. If waitOne is set, waits for at least one value before returning.

func ExLookupFirstBlockStore

func ExLookupFirstBlockStore(
	ctx context.Context,
	b bus.Bus,
	blockStoreId string,
	returnIfIdle bool,
	valDisposeCb func(),
) (LookupBlockStoreValue, directive.Instance, directive.Reference, error)

ExLookupFirstBlockStore waits for the first block store to be returned. if returnIfIdle is set and the directive becomes idle, returns nil, nil, nil,

type Store

type Store interface {
	// GetID returns the ID of the block store.
	GetID() string

	// StoreOps are the block store operations.
	block.StoreOps
}

Store is a block store with an ID and read/write functions.

func NewStore

func NewStore(id string, ops block.StoreOps) Store

NewStore constructs a store with an id and opts.

Jump to

Keyboard shortcuts

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