Documentation ¶
Index ¶
- Variables
- type Cache
- type DoubleCache
- type FileCache
- type NoopCache
- type NoopFile
- func (n NoopFile) AxisHalf(ctx context.Context, axisType rsmt2d.Axis, axisIdx int) ([]share.Share, error)
- func (n NoopFile) Close() error
- func (n NoopFile) Data(ctx context.Context, namespace share.Namespace, rowIdx int) (share.NamespacedRow, error)
- func (n NoopFile) DataHash() share.DataHash
- func (n NoopFile) EDS(ctx context.Context) (*rsmt2d.ExtendedDataSquare, error)
- func (n NoopFile) Height() uint64
- func (n NoopFile) Reader() (io.Reader, error)
- func (n NoopFile) Share(ctx context.Context, x, y int) (*share.ShareWithProof, error)
- func (n NoopFile) Size() int
- type OpenFileFn
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrCacheMiss = errors.New("accessor not found in blockstore cache")
)
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache interface { // Get returns the EDS file for the given key. Get(key) (file.EdsFile, error) // GetOrLoad attempts to get an item from the Cache and, if not found, invokes // the provided loader function to load it into the Cache. GetOrLoad(context.Context, key, OpenFileFn) (file.EdsFile, error) // Remove removes an item from Cache. Remove(key) error // EnableMetrics enables metrics in Cache EnableMetrics() error }
Cache is an interface that defines the basic Cache operations.
type DoubleCache ¶
type DoubleCache struct {
// contains filtered or unexported fields
}
DoubleCache represents a Cache that looks into multiple caches one by one.
func NewDoubleCache ¶
func NewDoubleCache(first, second Cache) *DoubleCache
NewDoubleCache creates a new DoubleCache with the provided caches.
func (*DoubleCache) EnableMetrics ¶
func (mc *DoubleCache) EnableMetrics() error
func (*DoubleCache) First ¶
func (mc *DoubleCache) First() Cache
func (*DoubleCache) Get ¶
func (mc *DoubleCache) Get(key key) (file.EdsFile, error)
Get looks for an item in all the caches one by one and returns the Cache found item.
func (*DoubleCache) Remove ¶
func (mc *DoubleCache) Remove(key key) error
Remove removes an item from all underlying caches
func (*DoubleCache) Second ¶
func (mc *DoubleCache) Second() Cache
type FileCache ¶
type FileCache struct {
// contains filtered or unexported fields
}
FileCache implements the Cache interface using an LRU cache backend.
func (*FileCache) EnableMetrics ¶
EnableMetrics enables metrics for the cache.
func (*FileCache) Get ¶
Get retrieves the accessor for a given key from the Cache. If the Accessor is not in the Cache, it returns an ErrCacheMiss.
type NoopCache ¶
type NoopCache struct{}
NoopCache implements noop version of Cache interface
func (NoopCache) EnableMetrics ¶
Click to show internal directories.
Click to hide internal directories.