chunkstore

package
v0.0.0-...-eb12069 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2023 License: BSD-3-Clause Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IterateChunkEntries

func IterateChunkEntries(st storage.Store, fn func(swarm.Address, bool) (bool, error)) error

func IterateLocations

func IterateLocations(
	ctx context.Context,
	st storage.Store,
	locationResultC chan<- LocationResult,
)

IterateLocations iterates over entire retrieval index and plucks only sharky location.

Types

type ChunkStoreWrapper

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

func New

func New(store storage.Store, sharky Sharky) *ChunkStoreWrapper

func (*ChunkStoreWrapper) Close

func (c *ChunkStoreWrapper) Close() error

func (*ChunkStoreWrapper) Delete

func (c *ChunkStoreWrapper) Delete(ctx context.Context, addr swarm.Address) error

func (*ChunkStoreWrapper) Get

func (*ChunkStoreWrapper) Has

func (*ChunkStoreWrapper) Iterate

func (*ChunkStoreWrapper) Put

type LocationResult

type LocationResult struct {
	Err      error
	Location sharky.Location
}

type Sharky

type Sharky interface {
	Read(context.Context, sharky.Location, []byte) error
	Write(context.Context, []byte) (sharky.Location, error)
	Release(context.Context, sharky.Location) error
}

Sharky provides an abstraction for the sharky.Store operations used in the chunkstore. This allows us to be more flexible in passing in the sharky instance to chunkstore. For eg, check the TxChunkStore implementation in this pkg.

type TxChunkStoreWrapper

type TxChunkStoreWrapper struct {
	*storage.TxChunkStoreBase
	// contains filtered or unexported fields
}

func NewTxChunkStore

func NewTxChunkStore(txStore storage.TxStore, csSharky Sharky) *TxChunkStoreWrapper

func (*TxChunkStoreWrapper) Commit

func (cs *TxChunkStoreWrapper) Commit() error

func (*TxChunkStoreWrapper) NewTx

func (*TxChunkStoreWrapper) Recover

func (cs *TxChunkStoreWrapper) Recover() error

Recover attempts to recover from a previous crash by reverting all uncommitted transactions.

func (*TxChunkStoreWrapper) Rollback

func (cs *TxChunkStoreWrapper) Rollback() error

Jump to

Keyboard shortcuts

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