chunk_cache

package
v0.0.0-...-0b345dd Latest Latest
Warning

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

Go to latest
Published: May 6, 2022 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 {
	ReadChunkAt(data []byte, fileId string, offset uint64) (n int, err error)
	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) ReadChunkAt

func (c *TieredChunkCache) ReadChunkAt(data []byte, fileId string, offset uint64) (n int, err error)

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
y or Y : Canonical URL