Documentation
¶
Index ¶
- Variables
- type AccessBlockStoreFunc
- type Constructor
- type LookupBlockStore
- type LookupBlockStoreValue
- func ExLookupBlockStores(ctx context.Context, b bus.Bus, blockStoreId string, waitOne bool) ([]LookupBlockStoreValue, directive.Instance, directive.Reference, error)
- func ExLookupFirstBlockStore(ctx context.Context, b bus.Bus, blockStoreId string, returnIfIdle bool, ...) (LookupBlockStoreValue, directive.Instance, directive.Reference, error)
- type Store
- type StoreReadThrough
- func (s *StoreReadThrough) BeginReadOperation(ctx context.Context) (block.StoreOps, func(), error)
- func (s *StoreReadThrough) GetBlock(ctx context.Context, ref *block.BlockRef) ([]byte, bool, error)
- func (s *StoreReadThrough) GetBlockExists(ctx context.Context, ref *block.BlockRef) (bool, error)
- func (s *StoreReadThrough) GetBlockExistsBatch(ctx context.Context, refs []*block.BlockRef) ([]bool, error)
- func (s *StoreReadThrough) GetHashType() hash.HashType
- func (s *StoreReadThrough) GetSupportedFeatures() block.StoreFeature
- func (*StoreReadThrough) PutBlock(context.Context, []byte, *block.PutOpts) (*block.BlockRef, bool, error)
- func (*StoreReadThrough) PutBlockBatch(context.Context, []*block.PutBatchEntry) error
- func (*StoreReadThrough) RmBlock(context.Context, *block.BlockRef) error
- func (s *StoreReadThrough) StatBlock(ctx context.Context, ref *block.BlockRef) (*block.BlockStat, error)
- func (*StoreReadThrough) Sync(context.Context) (bool, error)
- type StoreSource
Constants ¶
This section is empty.
Variables ¶
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 ¶
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 ¶
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.
type StoreReadThrough ¶ added in v0.57.0
type StoreReadThrough struct {
// contains filtered or unexported fields
}
StoreReadThrough reads from a primary source, then an optional lower source. When writeback is enabled, lower hits are synchronously written to primary.
StoreReadThrough is separate from block.StoreOverlay because StoreOverlay readback is asynchronous.
func NewStoreReadThrough ¶ added in v0.57.0
func NewStoreReadThrough(primary, lower StoreSource, writeback bool) *StoreReadThrough
NewStoreReadThrough constructs a synchronous read-through store.
func (*StoreReadThrough) BeginReadOperation ¶ added in v0.57.0
BeginReadOperation opens read scopes on the currently available sources.
func (*StoreReadThrough) GetBlock ¶ added in v0.57.0
GetBlock reads the primary source, then the current lower source. When writeback is enabled, a lower hit is synchronously inserted into primary.
func (*StoreReadThrough) GetBlockExists ¶ added in v0.57.0
GetBlockExists follows the same source order as GetBlock.
func (*StoreReadThrough) GetBlockExistsBatch ¶ added in v0.57.0
func (s *StoreReadThrough) GetBlockExistsBatch(ctx context.Context, refs []*block.BlockRef) ([]bool, error)
GetBlockExistsBatch follows the same source order as GetBlock.
func (*StoreReadThrough) GetHashType ¶ added in v0.57.0
func (s *StoreReadThrough) GetHashType() hash.HashType
GetHashType returns the first available source hash type.
func (*StoreReadThrough) GetSupportedFeatures ¶ added in v0.57.0
func (s *StoreReadThrough) GetSupportedFeatures() block.StoreFeature
GetSupportedFeatures returns the primary source's feature set.
func (*StoreReadThrough) PutBlock ¶ added in v0.57.0
func (*StoreReadThrough) PutBlock(context.Context, []byte, *block.PutOpts) (*block.BlockRef, bool, error)
PutBlock is unsupported because this store is read-only.
func (*StoreReadThrough) PutBlockBatch ¶ added in v0.57.0
func (*StoreReadThrough) PutBlockBatch(context.Context, []*block.PutBatchEntry) error
PutBlockBatch is unsupported because this store is read-only.
func (*StoreReadThrough) RmBlock ¶ added in v0.57.0
RmBlock is unsupported because this store is read-only.
type StoreSource ¶ added in v0.57.0
StoreSource resolves the current store for a read pipeline.
A nil result means that the source is unavailable and the pipeline moves to its next source.