Documentation ¶
Index ¶
- Constants
- func IterateChunkEntries(st storage.Store, fn func(swarm.Address, bool) (bool, error)) error
- func IterateLocations(ctx context.Context, st storage.Store, locationResultC chan<- LocationResult)
- type ChunkStoreWrapper
- func (c *ChunkStoreWrapper) Close() error
- func (c *ChunkStoreWrapper) Delete(ctx context.Context, addr swarm.Address) error
- func (c *ChunkStoreWrapper) Get(ctx context.Context, addr swarm.Address) (swarm.Chunk, error)
- func (c *ChunkStoreWrapper) Has(_ context.Context, addr swarm.Address) (bool, error)
- func (c *ChunkStoreWrapper) Iterate(ctx context.Context, fn storage.IterateChunkFn) error
- func (c *ChunkStoreWrapper) Put(ctx context.Context, ch swarm.Chunk) error
- type LocationResult
- type RetrievalIndexItem
- type Sharky
- type TxChunkStoreWrapper
Constants ¶
const RetrievalIndexItemSize = swarm.HashSize + 8 + sharky.LocationSize + 1
Variables ¶
This section is empty.
Functions ¶
func IterateChunkEntries ¶
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 (*ChunkStoreWrapper) Close ¶
func (c *ChunkStoreWrapper) Close() error
func (*ChunkStoreWrapper) Iterate ¶
func (c *ChunkStoreWrapper) Iterate(ctx context.Context, fn storage.IterateChunkFn) error
type LocationResult ¶
type RetrievalIndexItem ¶ added in v1.17.2
type RetrievalIndexItem struct { Address swarm.Address Timestamp uint64 Location sharky.Location RefCnt uint8 }
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(1)--|
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 (cs *TxChunkStoreWrapper) NewTx(state *storage.TxState) storage.TxChunkStore
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