chunk_cache

package
Version: v0.0.0-...-2e9372d Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2021 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrorOutOfBounds = errors.New("attempt to read out of bounds")

Functions

This section is empty.

Types

type ChunkCache

type ChunkCache interface {
	GetChunk(fileId string, minSize uint64) (data []byte)
	GetChunkSlice(fileId string, offset, length uint64) []byte
	SetChunk(fileId string, data []byte)
}

type ChunkCacheInMemory

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

a global cache for recently accessed file chunks

func NewChunkCacheInMemory

func NewChunkCacheInMemory(maxEntries int64) *ChunkCacheInMemory

func (*ChunkCacheInMemory) GetChunk

func (c *ChunkCacheInMemory) GetChunk(fileId string) []byte

func (*ChunkCacheInMemory) SetChunk

func (c *ChunkCacheInMemory) SetChunk(fileId string, data []byte)

type ChunkCacheVolume

type ChunkCacheVolume struct {
	DataBackend backend.BackendStorageFile
	// contains filtered or unexported fields
}

func LoadOrCreateChunkCacheVolume

func LoadOrCreateChunkCacheVolume(fileName string, preallocate int64) (*ChunkCacheVolume, error)

func (*ChunkCacheVolume) GetNeedle

func (v *ChunkCacheVolume) GetNeedle(key types.NeedleId) ([]byte, error)

func (*ChunkCacheVolume) Reset

func (v *ChunkCacheVolume) Reset() (*ChunkCacheVolume, error)

func (*ChunkCacheVolume) Shutdown

func (v *ChunkCacheVolume) Shutdown()

func (*ChunkCacheVolume) WriteNeedle

func (v *ChunkCacheVolume) WriteNeedle(key types.NeedleId, data []byte) error

type OnDiskCacheLayer

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

func NewOnDiskCacheLayer

func NewOnDiskCacheLayer(dir, namePrefix string, diskSize int64, segmentCount int) *OnDiskCacheLayer

type TieredChunkCache

type TieredChunkCache struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

a global cache for recently accessed file chunks

func NewTieredChunkCache

func NewTieredChunkCache(maxEntries int64, dir string, diskSizeInUnit int64, unitSize int64) *TieredChunkCache

func (*TieredChunkCache) GetChunk

func (c *TieredChunkCache) GetChunk(fileId string, minSize uint64) (data []byte)

func (*TieredChunkCache) GetChunkSlice

func (c *TieredChunkCache) GetChunkSlice(fileId string, offset, length uint64) []byte

func (*TieredChunkCache) SetChunk

func (c *TieredChunkCache) SetChunk(fileId string, data []byte)

func (*TieredChunkCache) Shutdown

func (c *TieredChunkCache) Shutdown()

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL