chunk

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: May 27, 2021 License: AGPL-3.0 Imports: 21 Imported by: 13

Documentation

Index

Constants

View Source
const SlowRequest = time.Second * time.Duration(10)

Variables

This section is empty.

Functions

func NewPageReader

func NewPageReader(p *Page) *pageReader

Types

type CacheManager

type CacheManager interface {
	// contains filtered or unexported methods
}

type ChunkStore

type ChunkStore interface {
	NewReader(chunkid uint64, length int) Reader
	NewWriter(chunkid uint64) Writer
	Remove(chunkid uint64, length int) error
	FillCache(chunkid uint64, length uint32) error
}

func NewCachedStore

func NewCachedStore(storage object.ObjectStorage, config Config) ChunkStore

NewCachedStore create a cached store.

func NewDiskStore added in v0.9.0

func NewDiskStore(dir string) ChunkStore

type Config

type Config struct {
	CacheDir       string
	CacheMode      os.FileMode
	CacheSize      int64
	FreeSpace      float32
	AutoCreate     bool
	Compress       string
	MaxUpload      int
	Writeback      bool
	Partitions     int
	BlockSize      int
	UploadLimit    int
	GetTimeout     time.Duration
	PutTimeout     time.Duration
	CacheFullBlock bool
	BufferSize     int
	Readahead      int
	Prefetch       int
}

Config contains options for cachedStore

type Controller

type Controller struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func (*Controller) Execute

func (con *Controller) Execute(key string, fn func() (*Page, error)) (*Page, error)

type Page

type Page struct {
	Data []byte
	// contains filtered or unexported fields
}

Page is a page with refcount

func NewOffPage

func NewOffPage(size int) *Page

func NewPage

func NewPage(data []byte) *Page

NewPage create a new page.

func (*Page) Acquire

func (p *Page) Acquire()

Acquire increase the refcount

func (*Page) Release

func (p *Page) Release()

Release decrease the refcount

func (*Page) Slice

func (p *Page) Slice(off, len int) *Page

type ReadCloser

type ReadCloser interface {
	io.Reader
	io.ReaderAt
	io.Closer
}

type Reader

type Reader interface {
	ReadAt(ctx context.Context, p *Page, off int) (int, error)
}

type Writer

type Writer interface {
	io.WriterAt
	ID() uint64
	SetID(chunkid uint64)
	FlushTo(offset int) error
	Finish(length int) error
	Abort()
}

Jump to

Keyboard shortcuts

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