Documentation ¶
Index ¶
- Variables
- type CachedStore
- type Getter
- func (g *Getter) GetEDS(ctx context.Context, h *header.ExtendedHeader) (*rsmt2d.ExtendedDataSquare, error)
- func (g *Getter) GetNamespaceData(ctx context.Context, h *header.ExtendedHeader, ns libshare.Namespace) (shwap.NamespaceData, error)
- func (g *Getter) GetSamples(ctx context.Context, hdr *header.ExtendedHeader, indices []shwap.SampleCoords) ([]shwap.Sample, error)
- type Parameters
- type Store
- func (s *Store) GetByHash(ctx context.Context, datahash share.DataHash) (eds.AccessorStreamer, error)
- func (s *Store) GetByHeight(ctx context.Context, height uint64) (eds.AccessorStreamer, error)
- func (s *Store) HasByHash(ctx context.Context, datahash share.DataHash) (bool, error)
- func (s *Store) HasByHeight(ctx context.Context, height uint64) (bool, error)
- func (s *Store) PutODS(ctx context.Context, roots *share.AxisRoots, height uint64, ...) error
- func (s *Store) PutODSQ4(ctx context.Context, roots *share.AxisRoots, height uint64, ...) error
- func (s *Store) RemoveODSQ4(ctx context.Context, height uint64, datahash share.DataHash) error
- func (s *Store) RemoveQ4(ctx context.Context, height uint64, datahash share.DataHash) error
- func (s *Store) Stop(context.Context) error
- func (s *Store) WithCache(name string, size int) (*CachedStore, error)
- func (s *Store) WithMetrics() error
Constants ¶
This section is empty.
Variables ¶
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 ¶
HasByHeight checks if accessor for the height is present.
type Getter ¶
type Getter struct {
// contains filtered or unexported fields
}
func (*Getter) GetEDS ¶
func (g *Getter) GetEDS(ctx context.Context, h *header.ExtendedHeader) (*rsmt2d.ExtendedDataSquare, error)
func (*Getter) GetNamespaceData ¶
func (g *Getter) GetNamespaceData( ctx context.Context, h *header.ExtendedHeader, ns libshare.Namespace, ) (shwap.NamespaceData, error)
func (*Getter) GetSamples ¶ added in v0.20.4
func (g *Getter) GetSamples(ctx context.Context, hdr *header.ExtendedHeader, indices []shwap.SampleCoords, ) ([]shwap.Sample, 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) GetByHeight ¶
func (*Store) HasByHeight ¶
func (*Store) RemoveODSQ4 ¶
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.