v0.0.0-...-30c4c12 Latest Latest

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

Go to latest
Published: May 19, 2023 License: Apache-2.0 Imports: 12 Imported by: 0




This section is empty.


This section is empty.


This section is empty.


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.

Jump to

Keyboard shortcuts

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