bigslice: Index | Files

package slicecache

import ""


Package Files

slicecache.go sliceio.go

type Cacheable Uses

type Cacheable interface {
    Cache() ShardCache

Cacheable indicates a slice's data should be cached.

type FileShardCache Uses

type FileShardCache struct {
    // contains filtered or unexported fields

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

func NewFileShardCache Uses

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 Uses

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 Uses

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

func (*FileShardCache) RequireAllCached Uses

func (c *FileShardCache) RequireAllCached()

func (*FileShardCache) WritethroughReader Uses

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 Uses

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.

Package slicecache imports 9 packages (graph) and is imported by 2 packages. Updated 2020-05-29. Refresh now. Tools for package owners.