restoreplan

package
v0.2.7 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package restoreplan (#157) decides, per pack, HOW a restore fetches its chunks: dense packs (many needed chunks) download whole and amortize; sparse packs (cross-machine-dedup scatter: a couple of chunks out of thousands) fetch per-chunk via ranged reads. The restore holds its full entry list before fetching, so the plan is exact, not heuristic-per-miss.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Wire

func Wire(ctx context.Context, cs *store.ChunkStore, sess PackSource, plan *Plan, lruWindow int)

Wire installs the fetch policy on a ChunkStore backed by a pack source: sparse packs fetch single frames via ranged reads; dense packs decline to the whole-pack path, which downloads with LRU eviction (window) and refreshes recency on every local hit.

Types

type PackSource

type PackSource interface {
	FetchChunkFrame(ctx context.Context, packNum uint32, offset int64) ([]byte, error)
	TouchPack(n uint32)
	DownloadPack(ctx context.Context, packNum uint32) error
	EvictLRUPacks(window int)
}

PackSource is the pack-fetch surface Wire drives — exactly the four methods, no more. Defining it HERE (rather than importing the concrete *cloudsync.S3Session) is what keeps restoreplan inside the engine set (#542): the cloud layer satisfies this from the outside, the engine never names it. cloudsync.S3Session implements it as-is.

type Plan

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

Plan classifies packs for one restore.

func Build

func Build(entries []manifest.Entry, packOf func([32]byte) (uint32, bool), packMax int64) *Plan

Build classifies packs from an in-memory entry slice; BuildFrom is the streaming form and the one a restore should call (#506).

func BuildFrom

func BuildFrom(ea manifest.EntryAccessor, packOf func([32]byte) (uint32, bool), packMax int64) *Plan

BuildFrom is Build over an EntryAccessor (#506): the same per-pack counting, reading entries in batches so a 1.26M-entry chain never has to exist as one slice. Build delegates here through a slice accessor.

func (*Plan) Dense

func (p *Plan) Dense(pack uint32) bool

Dense reports whether the pack should be downloaded whole.

Jump to

Keyboard shortcuts

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