backupapp

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2026 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Overview

Package backupapp adapts docbank's logical schema and mixed blob store to Kit's application-neutral backup engine.

Index

Constants

View Source
const MetadataFormat = "docbank-metadata-jsonl-v1"

MetadataFormat is the stable Kit manifest identifier for Docbank's deterministic logical metadata stream.

View Source
const (
	// PlacementFormat identifies the portable, non-secret physical-placement
	// description captured alongside Docbank's logical metadata.
	PlacementFormat = "docbank-placement-v1"
)
View Source
const (
	RestoreStoreMapVersion = 1
)

Variables

This section is empty.

Functions

func Create

func Create(
	ctx context.Context,
	repo *backup.Repo,
	version string,
	metadata *store.Store,
	blobs BlobStreamer,
	opts backup.CreateOptions,
) (*backup.Manifest, error)

Create captures Docbank's logical JSONL metadata and catalog-authorized blob streams. The wrapper owns both adapters so ordinary callers cannot accidentally fall back to SQLite page capture or loose-path reads.

func InspectRestoredStorage added in v0.12.0

func InspectRestoredStorage(
	ctx context.Context,
	target, databasePath string,
	driver docsqlite.Driver,
) (stats blob.StorageStats, retErr error)

InspectRestoredStorage reads the physical inventory of a proved restore while its caller still owns target-tree coordination. It does not run maintenance or change blob authority.

func RecoverInterruptedPrimaryHandoff added in v0.12.0

func RecoverInterruptedPrimaryHandoff(
	ctx context.Context, target string, driver docsqlite.Driver,
) error

RecoverInterruptedPrimaryHandoff resolves a durable restore marker against the database publication boundary before any caller opens SQLite mutably. The caller must hold the vault's exclusive hierarchy lock.

func Restore

func Restore(
	ctx context.Context, repo *backup.Repo, version string, opts backup.RestoreOptions,
) (*backup.RestoreResult, error)

Restore restores a snapshot with docbank's packed-storage policy. It owns the application adapter and packed target as one operation so callers cannot accidentally authorize captured pack metadata while omitting catalog replacement from Kit's restore options.

func RestoreWithDriver

func RestoreWithDriver(
	ctx context.Context,
	repo *backup.Repo,
	version string,
	driver docsqlite.Driver,
	opts backup.RestoreOptions,
) (*backup.RestoreResult, error)

RestoreWithDriver restores through one SQLite adapter for metadata import, Kit proof queries, and packed-catalog publication.

func RestoreWithPlacement added in v0.12.0

func RestoreWithPlacement(
	ctx context.Context,
	repo *backup.Repo,
	version string,
	driver docsqlite.Driver,
	opts backup.RestoreOptions,
	placement RestorePlacementOptions,
) (*backup.RestoreResult, error)

RestoreWithPlacement restores through one SQLite adapter and optionally reconstructs explicitly mapped source placement while the caller retains target coordination.

func SQLiteOpener

func SQLiteOpener(driver docsqlite.Driver) backup.SQLiteOpener

SQLiteOpener adapts Docbank's selected driver to Kit's backup access modes.

Types

type App

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

App implements backup.App for docbank.

func New

func New(version string) *App

func (*App) CheckManifest

func (a *App) CheckManifest(manifest *backup.Manifest) []string

func (*App) ContentDirName

func (a *App) ContentDirName() string

func (*App) DBFileName

func (a *App) DBFileName() string

func (*App) ExcludedPaths

func (a *App) ExcludedPaths() []string

func (*App) FrozenView

func (a *App) FrozenView(session *backup.FrozenSession) backup.FrozenView

func (*App) PackFileExtension

func (a *App) PackFileExtension() string

func (*App) RestoredContentPaths

func (a *App) RestoredContentPaths(ctx context.Context, db *sql.DB) (map[string][]string, error)

func (*App) RestoredStats

func (a *App) RestoredStats(ctx context.Context, db *sql.DB) (jsontext.Value, error)

func (*App) Version

func (a *App) Version() string

type BlobStreamer

type BlobStreamer interface {
	OpenStreamContext(ctx context.Context, hash string) (packstore.VerifiedReadCloser, int64, error)
}

BlobStreamer is the verified mixed loose/packed read surface backup capture needs. Kit must consume the returned stream through verified EOF before its bytes can enter an archive.

type ContentSource

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

ContentSource adapts docbank's catalog-authorized mixed store to backup.

func NewContentSource

func NewContentSource(blobs BlobStreamer) *ContentSource

func (*ContentSource) Open

type MetadataSource

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

MetadataSource pins one Docbank transaction for JSONL, content membership, and fidelity statistics. OpenMetadata performs a counting pass and then streams a second deterministic pass without materializing the JSONL.

func NewMetadataSource

func NewMetadataSource(metadata *store.Store) *MetadataSource

func (*MetadataSource) Format

func (*MetadataSource) Format() string

func (*MetadataSource) OpenSnapshot

func (s *MetadataSource) OpenSnapshot(ctx context.Context) (backup.MetadataSnapshot, error)

type RestorePlacementOptions added in v0.12.0

type RestorePlacementOptions struct {
	Map                      *RestoreStoreMap
	Bindings                 map[string]config.StoreBindingConfig
	ProtectedFilesystemRoots []string
}

RestorePlacementOptions enables explicit placement reconstruction after Kit has independently restored every byte to the target's fresh local primary.

type RestoreStoreMap added in v0.12.0

type RestoreStoreMap struct {
	Version int                   `toml:"version"`
	Stores  []RestoreStoreMapping `toml:"stores"`
}

RestoreStoreMap maps portable source placement identities to daemon-loaded target bindings. Binding definitions and secrets remain outside the file.

func LoadRestoreStoreMap added in v0.12.0

func LoadRestoreStoreMap(path string) (RestoreStoreMap, error)

LoadRestoreStoreMap reads one owner-private, no-follow TOML mapping file. The file carries binding names only; endpoints and credentials stay in the daemon's config.toml.

type RestoreStoreMapping added in v0.12.0

type RestoreStoreMapping struct {
	SourceID               string `toml:"source_id"`
	Name                   string `toml:"name"`
	Binding                string `toml:"binding"`
	Takeover               bool   `toml:"takeover"`
	RemoteOnly             bool   `toml:"remote_only"`
	AllowAuditedRemoteOnly bool   `toml:"allow_audited_remote_only"`
}

type Stats

type Stats struct {
	Nodes           int64 `json:"nodes"`
	Files           int64 `json:"files"`
	Directories     int64 `json:"directories"`
	TrashedNodes    int64 `json:"trashed_nodes"`
	Blobs           int64 `json:"blobs"`
	BlobBytes       int64 `json:"blob_bytes"`
	ContentVersions int64 `json:"content_versions"`
	Ingests         int64 `json:"ingests"`
	Provenance      int64 `json:"provenance"`
	Tags            int64 `json:"tags"`
	NodeTags        int64 `json:"node_tags"`
	ExtractedText   int64 `json:"extracted_text"`
}

Stats is the representation-neutral fidelity payload recorded in each snapshot. Physical pack rows are deliberately excluded: restore may choose a different loose/packed representation while preserving the same archive.

func ParseStats

func ParseStats(raw jsontext.Value) (Stats, error)

Jump to

Keyboard shortcuts

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