Documentation ¶
Index ¶
- type TimedCacheBS
- func (t *TimedCacheBS) AllKeysChan(ctx context.Context) (<-chan cid.Cid, error)
- func (t *TimedCacheBS) DeleteBlock(k cid.Cid) error
- func (t *TimedCacheBS) Get(k cid.Cid) (blocks.Block, error)
- func (t *TimedCacheBS) GetSize(k cid.Cid) (int, error)
- func (t *TimedCacheBS) Has(k cid.Cid) (bool, error)
- func (t *TimedCacheBS) HashOnRead(_ bool)
- func (t *TimedCacheBS) Put(b blocks.Block) error
- func (t *TimedCacheBS) PutMany(bs []blocks.Block) error
- func (t *TimedCacheBS) Start(ctx context.Context) error
- func (t *TimedCacheBS) Stop(ctx context.Context) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type TimedCacheBS ¶
type TimedCacheBS struct {
// contains filtered or unexported fields
}
TimedCacheBS is a blockstore that keeps blocks for at least the specified caching interval before discarding them. Garbage collection must be started and stopped by calling Start/Stop.
Under the covers, it's implemented with an active and an inactive blockstore that are rotated every cache time interval. This means all blocks will be stored at most 2x the cache interval.
func NewTimedCacheBS ¶
func NewTimedCacheBS(cacheTime time.Duration) *TimedCacheBS
func (*TimedCacheBS) AllKeysChan ¶
func (t *TimedCacheBS) AllKeysChan(ctx context.Context) (<-chan cid.Cid, error)
func (*TimedCacheBS) DeleteBlock ¶
func (t *TimedCacheBS) DeleteBlock(k cid.Cid) error
func (*TimedCacheBS) GetSize ¶
func (t *TimedCacheBS) GetSize(k cid.Cid) (int, error)
func (*TimedCacheBS) Has ¶
func (t *TimedCacheBS) Has(k cid.Cid) (bool, error)
func (*TimedCacheBS) HashOnRead ¶
func (t *TimedCacheBS) HashOnRead(_ bool)
Click to show internal directories.
Click to hide internal directories.