Documentation ¶
Index ¶
- Constants
- func Delete(ctx context.Context, s storage.IndexStore, sh storage.Sharky, ...) error
- func Get(ctx context.Context, r storage.Reader, s storage.Sharky, addr swarm.Address) (swarm.Chunk, error)
- func Has(_ context.Context, r storage.Reader, addr swarm.Address) (bool, error)
- func Iterate(ctx context.Context, s storage.IndexStore, sh storage.Sharky, ...) error
- func IterateChunkEntries(st storage.Reader, fn func(swarm.Address, uint32) (bool, error)) error
- func IterateItems(st storage.Store, callBackFunc func(*RetrievalIndexItem) error) error
- func IterateLocations(ctx context.Context, st storage.Reader) <-chan LocationResult
- func Put(ctx context.Context, s storage.IndexStore, sh storage.Sharky, ch swarm.Chunk) error
- func Replace(ctx context.Context, s storage.IndexStore, sh storage.Sharky, ch swarm.Chunk) error
- type IterateResult
- type LocationResult
- type RetrievalIndexItem
- type Sharky
Constants ¶
View Source
const RetrievalIndexItemSize = swarm.HashSize + 8 + sharky.LocationSize + 4
Variables ¶
This section is empty.
Functions ¶
func Iterate ¶
func Iterate(ctx context.Context, s storage.IndexStore, sh storage.Sharky, fn storage.IterateChunkFn) error
func IterateChunkEntries ¶
func IterateItems ¶ added in v2.1.0
func IterateItems(st storage.Store, callBackFunc func(*RetrievalIndexItem) error) error
Iterate iterates over entire retrieval index with a call back.
func IterateLocations ¶
func IterateLocations( ctx context.Context, st storage.Reader, ) <-chan LocationResult
IterateLocations iterates over entire retrieval index and plucks only sharky location.
Types ¶
type IterateResult ¶
type IterateResult struct { Err error Item *RetrievalIndexItem }
type LocationResult ¶
type RetrievalIndexItem ¶
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 ¶
func (r *RetrievalIndexItem) Clone() storage.Item
func (*RetrievalIndexItem) ID ¶
func (r *RetrievalIndexItem) ID() string
func (*RetrievalIndexItem) Marshal ¶
func (r *RetrievalIndexItem) Marshal() ([]byte, error)
Stored in bytes as: |--Address(32)--|--Timestamp(8)--|--Location(7)--|--RefCnt(4)--|
func (RetrievalIndexItem) Namespace ¶
func (RetrievalIndexItem) Namespace() string
func (RetrievalIndexItem) String ¶
func (r RetrievalIndexItem) String() string
func (*RetrievalIndexItem) Unmarshal ¶
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.
Click to show internal directories.
Click to hide internal directories.