timedbs

package
v1.2.3-rc1 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2020 License: Apache-2.0, MIT Imports: 10 Imported by: 0

Documentation

Index

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) Get

func (t *TimedCacheBS) Get(k cid.Cid) (blocks.Block, 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)

func (*TimedCacheBS) Put

func (t *TimedCacheBS) Put(b blocks.Block) error

func (*TimedCacheBS) PutMany

func (t *TimedCacheBS) PutMany(bs []blocks.Block) error

func (*TimedCacheBS) Start

func (t *TimedCacheBS) Start(ctx context.Context) error

func (*TimedCacheBS) Stop

func (t *TimedCacheBS) Stop(ctx context.Context) error

Jump to

Keyboard shortcuts

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