Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cacheable

type Cacheable interface {
	Cache() ShardCache
}

Cacheable indicates a slice's data should be cached.

type FileShardCache

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

FileShardCache is a ShardCache backed by files. A nil *FileShardCache has no cached data.

func NewFileShardCache

func NewFileShardCache(ctx context.Context, prefix string, numShards int) *FileShardCache

NewShardCache constructs a ShardCache. It does O(numShards) parallelized file operations to look up what's present in the cache.

func (*FileShardCache) CacheReader

func (c *FileShardCache) CacheReader(shard int) sliceio.Reader

CacheReader returns a reader that reads from the cache. If the shard is not cached, returns a reader that will always return an error.

func (*FileShardCache) IsCached

func (c *FileShardCache) IsCached(shard int) bool

func (*FileShardCache) RequireAllCached

func (c *FileShardCache) RequireAllCached()

func (*FileShardCache) WritethroughReader

func (c *FileShardCache) WritethroughReader(shard int, reader sliceio.Reader) sliceio.Reader

WritethroughReader returns a reader that populates the cache. reader should read computed data.

type ShardCache

type ShardCache interface {
	IsCached(shard int) bool
	WritethroughReader(shard int, reader sliceio.Reader) sliceio.Reader
	CacheReader(shard int) sliceio.Reader
}

ShardCache accesses cached data for a slice's shards.

var Empty ShardCache = empty{}

Empty is an empty cache.