Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrUnsafePaths = errors.New("bundle is not safe to import")
ErrUnsafePaths is the error of a bundle that has paths that would take what is done with them outside of the directory they are for.
Functions ¶
func CheckPaths ¶ added in v0.9.0
CheckPaths checks the paths in a bundle as strictly as a restore could: as if what is on disk was kept, which is the case of a restore on the same machine. It is for saying whether a bundle is fine to import, without importing it.
Types ¶
type Bundle ¶
type Bundle struct {
Manifest exporter.Manifest
BundleDir string // temp dir where bundle was extracted
BundleDB *sql.DB
}
Bundle is the extracted, validated contents of an import bundle. It holds the temp directory and opened bundle DB until Close is called.
func OpenAndValidate ¶
func OpenAndValidate(ctx context.Context, bundlePath string, scratchDir string, schema *database.Schema) (*Bundle, error)
OpenAndValidate extracts the bundle, verifies integrity, and returns a validated Bundle ready for import. Caller must call Close() when done.
The bundle is extracted to a directory of its own in scratchDir, which has to be there and to have room for all of the bundle (the blobs are in it, and that is most of it), and its database is brought to the schema schema. Neither is found by this function: nothing is made anywhere that it was not told.
type DisabledTarget ¶ added in v0.9.0
type DisabledTarget struct {
Game string
Name string
RootPath string
// Custom is whether it is a target that the user made: nothing on this
// machine is going to confirm it.
Custom bool
}
DisabledTarget is a target that was imported disabled.
type Options ¶
type Options struct {
SkipInventory bool
Force bool
DryRun bool
SameMachine bool
Game string // "store_id:store_game_id", only set when extracting a game from a full bundle
CacheDBPath string
// Schema is the schema that the database that is restored is brought to,
// and compared with the one that the bundle has. It is not found by the
// restore.
Schema *database.Schema
}
type Result ¶
type Result struct {
// counts of what was imported
Archives int
Backups int
Overrides int
ModPages int
Profiles int
InventoryScanned int
InventoryFailed int
// DisabledTargets are the targets that were imported disabled (see
// targets.go), which the user is to be told about.
DisabledTargets []DisabledTarget
}