store

package
v0.20.0-arabica Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2024 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFound = errors.New("eds not found in store")

Functions

This section is empty.

Types

type CachedStore

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

CachedStore is a store with an additional cache layer. New cache layer is created on top of the original store cache. Parent store cache will be able to read from the new cache layer, but will not be able to write to it. Making parent store cache and CachedStore cache independent for writes.

func (*CachedStore) GetByHeight

func (cs *CachedStore) GetByHeight(ctx context.Context, height uint64) (eds.AccessorStreamer, error)

GetByHeight returns accessor for given height and puts it into cache.

func (*CachedStore) HasByHeight

func (cs *CachedStore) HasByHeight(ctx context.Context, height uint64) (bool, error)

HasByHeight checks if accessor for the height is present.

type Getter

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

func NewGetter

func NewGetter(store *Store) *Getter

func (*Getter) GetEDS

func (*Getter) GetNamespaceData

func (g *Getter) GetNamespaceData(
	ctx context.Context,
	h *header.ExtendedHeader,
	ns libshare.Namespace,
) (shwap.NamespaceData, error)

func (*Getter) GetShare

func (g *Getter) GetShare(ctx context.Context, h *header.ExtendedHeader, row, col int) (libshare.Share, error)

type Parameters

type Parameters struct {
	// RecentBlocksCacheSize is the size of the cache for recent blocks.
	RecentBlocksCacheSize int
}

func DefaultParameters

func DefaultParameters() *Parameters

DefaultParameters returns the default configuration values for the EDS store parameters.

func (*Parameters) Validate

func (p *Parameters) Validate() error

type Store

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

Store is a storage for EDS files. It persists EDS files on disk in form of Q1Q4 files or ODS files. It provides methods to put, get and remove EDS files. It has two caches: recent eds cache and availability cache. Recent eds cache is used to cache recent blocks. Availability cache is used to cache blocks that are accessed by sample requests. Store is thread-safe.

func NewStore

func NewStore(params *Parameters, basePath string) (*Store, error)

NewStore creates a new EDS Store under the given basepath and datastore.

func (*Store) GetByHash

func (s *Store) GetByHash(ctx context.Context, datahash share.DataHash) (eds.AccessorStreamer, error)

func (*Store) GetByHeight

func (s *Store) GetByHeight(ctx context.Context, height uint64) (eds.AccessorStreamer, error)

func (*Store) HasByHash

func (s *Store) HasByHash(ctx context.Context, datahash share.DataHash) (bool, error)

func (*Store) HasByHeight

func (s *Store) HasByHeight(ctx context.Context, height uint64) (bool, error)

func (*Store) PutODS

func (s *Store) PutODS(
	ctx context.Context,
	roots *share.AxisRoots,
	height uint64,
	square *rsmt2d.ExtendedDataSquare,
) error

func (*Store) PutODSQ4

func (s *Store) PutODSQ4(
	ctx context.Context,
	roots *share.AxisRoots,
	height uint64,
	square *rsmt2d.ExtendedDataSquare,
) error

func (*Store) RemoveODSQ4

func (s *Store) RemoveODSQ4(ctx context.Context, height uint64, datahash share.DataHash) error

func (*Store) RemoveQ4

func (s *Store) RemoveQ4(ctx context.Context, height uint64, datahash share.DataHash) error

func (*Store) Stop

func (s *Store) Stop(context.Context) error

func (*Store) WithCache

func (s *Store) WithCache(name string, size int) (*CachedStore, error)

WithCache wraps store with extra layer of cache. Created caching layer will have read access to original store cache and will duplicate it's content. It updates parent store cache, to allow it to read from additionally created cache layer.

func (*Store) WithMetrics

func (s *Store) WithMetrics() error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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