chunkstore

package
v1.17.5-rc1 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const RetrievalIndexItemSize = swarm.HashSize + 8 + sharky.LocationSize + 4

Variables

This section is empty.

Functions

func Iterate added in v1.17.5

func Iterate(st storage.Store, callBackFunc func(*RetrievalIndexItem) error) error

Iterate iterates over entire retrieval index with a call back.

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 IterateResult added in v1.17.5

type IterateResult struct {
	Err  error
	Item *RetrievalIndexItem
}

type LocationResult

type LocationResult struct {
	Err      error
	Location sharky.Location
}

type RetrievalIndexItem added in v1.17.2

type RetrievalIndexItem struct {
	Address   swarm.Address
	Timestamp uint64
	Location  sharky.Location
	RefCnt    uint32
}

RetrievalIndexItem is the index which gives us the sharky location from the swarm.Address. The RefCnt stores the reference of each time a Put operation is issued on this Address.

func (*RetrievalIndexItem) Clone added in v1.17.2

func (r *RetrievalIndexItem) Clone() storage.Item

func (*RetrievalIndexItem) ID added in v1.17.2

func (r *RetrievalIndexItem) ID() string

func (*RetrievalIndexItem) Marshal added in v1.17.2

func (r *RetrievalIndexItem) Marshal() ([]byte, error)

Stored in bytes as: |--Address(32)--|--Timestamp(8)--|--Location(7)--|--RefCnt(4)--|

func (RetrievalIndexItem) Namespace added in v1.17.2

func (RetrievalIndexItem) Namespace() string

func (RetrievalIndexItem) String added in v1.17.2

func (r RetrievalIndexItem) String() string

func (*RetrievalIndexItem) Unmarshal added in v1.17.2

func (r *RetrievalIndexItem) Unmarshal(buf []byte) error

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