Documentation
¶
Overview ¶
Package backupapp adapts docbank's logical schema and mixed blob store to Kit's application-neutral backup engine.
Index ¶
- Constants
- func Create(ctx context.Context, repo *backup.Repo, version string, metadata *store.Store, ...) (*backup.Manifest, error)
- func InspectRestoredStorage(ctx context.Context, target, databasePath string, driver docsqlite.Driver) (stats blob.StorageStats, retErr error)
- func RecoverInterruptedPrimaryHandoff(ctx context.Context, target string, driver docsqlite.Driver) error
- func Restore(ctx context.Context, repo *backup.Repo, version string, ...) (*backup.RestoreResult, error)
- func RestoreWithDriver(ctx context.Context, repo *backup.Repo, version string, ...) (*backup.RestoreResult, error)
- func RestoreWithPlacement(ctx context.Context, repo *backup.Repo, version string, ...) (*backup.RestoreResult, error)
- func SQLiteOpener(driver docsqlite.Driver) backup.SQLiteOpener
- type App
- func (a *App) CheckManifest(manifest *backup.Manifest) []string
- func (a *App) ContentDirName() string
- func (a *App) DBFileName() string
- func (a *App) ExcludedPaths() []string
- func (a *App) FrozenView(session *backup.FrozenSession) backup.FrozenView
- func (a *App) PackFileExtension() string
- func (a *App) RestoredContentPaths(ctx context.Context, db *sql.DB) (map[string][]string, error)
- func (a *App) RestoredStats(ctx context.Context, db *sql.DB) (jsontext.Value, error)
- func (a *App) Version() string
- type BlobStreamer
- type ContentSource
- type MetadataSource
- type RestorePlacementOptions
- type RestoreStoreMap
- type RestoreStoreMapping
- type Stats
Constants ¶
const MetadataFormat = "docbank-metadata-jsonl-v1"
MetadataFormat is the stable Kit manifest identifier for Docbank's deterministic logical metadata stream.
const ( // PlacementFormat identifies the portable, non-secret physical-placement // description captured alongside Docbank's logical metadata. PlacementFormat = "docbank-placement-v1" )
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 (*App) ContentDirName ¶
func (*App) DBFileName ¶
func (*App) ExcludedPaths ¶
func (*App) FrozenView ¶
func (a *App) FrozenView(session *backup.FrozenSession) backup.FrozenView
func (*App) PackFileExtension ¶
func (*App) RestoredContentPaths ¶
func (*App) RestoredStats ¶
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 ¶
func (s *ContentSource) Open(ctx context.Context, ref backup.ContentRef) (io.ReadCloser, error)
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 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.