cache

package
v3.3.113 Latest Latest
Warning

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

Go to latest
Published: May 21, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EntryMetadata added in v3.3.109

type EntryMetadata struct {
	Path     string    `json:"path"`
	Size     int64     `json:"size"`
	ModTime  time.Time `json:"mtime"`
	Complete bool      `json:"complete"`
}

EntryMetadata identifies a completed cache entry for a specific remote file version.

func NewEntryMetadata added in v3.3.109

func NewEntryMetadata(path string, size int64, modTime time.Time) EntryMetadata

func (EntryMetadata) Matches added in v3.3.109

func (m EntryMetadata) Matches(other EntryMetadata) bool

type ReadyGate

type ReadyGate struct {
	Cancel context.CancelFunc
	// contains filtered or unexported fields
}

ReadyGate manages blocking cache consumers until the requested data is available.

func NewReadyGate

func NewReadyGate() *ReadyGate

func (*ReadyGate) Add

func (gate *ReadyGate) Add()

func (*ReadyGate) Available

func (gate *ReadyGate) Available() int64

func (*ReadyGate) Cleanup added in v3.3.109

func (gate *ReadyGate) Cleanup()

Cleanup runs the gate cleanup callback once after Done reports the gate is drained.

func (*ReadyGate) Done

func (gate *ReadyGate) Done() bool

Done releases one waiter and reports whether the gate is finished with no remaining waiters. Callers that receive true must call Cleanup; releaseGateWaiter is the canonical pairing.

func (*ReadyGate) Drained added in v3.3.109

func (gate *ReadyGate) Drained() bool

func (*ReadyGate) Finish

func (gate *ReadyGate) Finish(err error, total int64)

func (*ReadyGate) SetAvailable

func (gate *ReadyGate) SetAvailable(x int64)

func (*ReadyGate) SetCancel

func (gate *ReadyGate) SetCancel(cancel context.CancelFunc)

func (*ReadyGate) SetCleanup added in v3.3.109

func (gate *ReadyGate) SetCleanup(cleanup func())

func (*ReadyGate) SetTotal added in v3.3.109

func (gate *ReadyGate) SetTotal(total int64)

func (*ReadyGate) WaitFor

func (gate *ReadyGate) WaitFor(end int64) error

type Stats

type Stats struct {
	CapacityBytes          int64
	CapacityBytesRemaining int64
	MaxFileCount           int64
	FileCountRemaining     int64
	FileCount              atomic.Int64
	ReadBytes              atomic.Int64
	ReadCount              atomic.Int64
	SizeBytes              atomic.Int64
	WriteBytes             atomic.Int64
	WriteCount             atomic.Int64
	LoadDuration           time.Duration
	LruCount               int
	PinnedCount            int
	PinnedPaths            map[string]int
	LruKeys                []string
}

Stats maintains statistics about cache usage. In non-debug builds, this type exists but has no methods for retrieving statistics.

func (*Stats) ResetCounters

func (st *Stats) ResetCounters()

ResetCounters sets "counter" type stats to zero.

Directories

Path Synopsis
Package disk implements a disk-based cache for file data.
Package disk implements a disk-based cache for file data.

Jump to

Keyboard shortcuts

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