chunkstore

package
v2.2.0-rc4 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2024 License: BSD-3-Clause Imports: 10 Imported by: 0

Documentation

Index

Constants

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

Variables

This section is empty.

Functions

func Delete added in v2.1.0

func Get added in v2.1.0

func Has added in v2.1.0

func Has(_ context.Context, r storage.Reader, addr swarm.Address) (bool, error)

func IterateChunkEntries

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

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.

func Put added in v2.1.0

func Replace added in v2.2.0

Types

type IterateResult

type IterateResult struct {
	Err  error
	Item *RetrievalIndexItem
}

type LocationResult

type LocationResult struct {
	Err      error
	Location sharky.Location
}

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.

Jump to

Keyboard shortcuts

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