filewritecache

package
v0.0.0-...-7ab6552 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var MaxPatchContentLen = 8 * 1024 * 1024
View Source
var MaxPatches = 32

Below may overwritten from tests

View Source
var PatchSentinel = Patch{Offset: math.MaxInt64}

Functions

This section is empty.

Types

type FileWriteCache

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

func New

func New() *FileWriteCache

func (*FileWriteCache) ContentLen

func (wc *FileWriteCache) ContentLen() int64

func (*FileWriteCache) NeedsSync

func (wc *FileWriteCache) NeedsSync() bool

func (*FileWriteCache) PWrite

func (wc *FileWriteCache) PWrite(p []byte, offset int64) error

func (*FileWriteCache) ReadAtThrough

func (wc *FileWriteCache) ReadAtThrough(p []byte, offset int64, r ReadAter) (int, error)

func (*FileWriteCache) Right

func (wc *FileWriteCache) Right() int64

func (*FileWriteCache) Sync

func (wc *FileWriteCache) Sync(bh blobstore.PWriter) error

func (*FileWriteCache) Truncate

func (wc *FileWriteCache) Truncate(size int64)

type Patch

type Patch struct {
	Offset int64
	P      []byte
}

func NewPatch

func NewPatch(offset int64, p []byte) Patch

func (Patch) IsSentinel

func (p Patch) IsSentinel() bool

func (Patch) Left

func (p Patch) Left() int64

func (Patch) Right

func (p Patch) Right() int64

func (Patch) String

func (p Patch) String() string

type Patches

type Patches []Patch

func NewPatches

func NewPatches() Patches

func (Patches) FindLRIndex

func (ps Patches) FindLRIndex(newp Patch) (int, int)

func (Patches) Merge

func (ps Patches) Merge(newp Patch) Patches

func (Patches) Replace

func (ps Patches) Replace(lefti, righti int, newps Patches) Patches

func (Patches) Reset

func (ps Patches) Reset() Patches

func (Patches) Truncate

func (ps Patches) Truncate(size int64) Patches

type ReadAter

type ReadAter interface {
	ReadAt(p []byte, offset int64) (int, error)
}

Jump to

Keyboard shortcuts

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