Help us shape the future of Go! Take the 2026 Go Developer Survey

exporter

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2026 License: GPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const DatabaseFilename = "modctl.db"
View Source
const ExportFormatVersion = 1

Variables

This section is empty.

Functions

func ExportCacheFileInfo added in v0.7.0

func ExportCacheFileInfo(ctx context.Context, src, dst *dbc.Queries, domain string, modID int64) error

func ExportCacheFileUpdates added in v0.7.0

func ExportCacheFileUpdates(ctx context.Context, src, dst *dbc.Queries, domain string, modID int64) error

func ExportCacheModInfo added in v0.7.0

func ExportCacheModInfo(ctx context.Context, src, dst *dbc.Queries, domain string, modID int64) error

func Slugify

func Slugify(s string) string

slugify converts a game display name to a safe filename slug.

e.g. "Cyberpunk 2077" -> "cyberpunk2077"

"The Elder Scrolls V: Skyrim" -> "the-elder-scrolls-v-skyrim"

Types

type ExportKind

type ExportKind string
const (
	ExportKindFull ExportKind = "full"
	ExportKindGame ExportKind = "game"
)

type Manifest

type Manifest struct {
	ExportFormatVersion int            `json:"export_format_version"`
	ExportKind          ExportKind     `json:"export_kind"`
	ExportedAt          time.Time      `json:"exported_at"`
	ModctlVersion       string         `json:"modctl_version"`
	SchemaVersion       int64          `json:"schema_version"`
	DBSha256            string         `json:"db_sha256"`
	NexusCacheSha256    string         `json:"nexus_cache_sha256"`
	Counts              ManifestCounts `json:"counts"`
	Game                *ManifestGame  `json:"game,omitempty"`
}

type ManifestCounts

type ManifestCounts struct {
	Archives  int `json:"archives"`
	Backups   int `json:"backups"`
	Overrides int `json:"overrides"`
}

type ManifestGame

type ManifestGame struct {
	StoreID     string `json:"store_id"`
	StoreGameID string `json:"store_game_id"`
	DisplayName string `json:"display_name"`
}

type Options

type Options struct {
	// ModctlVersion is injected from rootCmd.Version
	ModctlVersion string
	// SkipInventory omits archive_inventory_entries from game-scoped exports
	SkipInventory bool
	// OutputPath is the destination file
	OutputPath string
	// NoVerify skips rehashing blobs before export
	NoVerify bool
	// CacheDBPath is the full path to the nexus_cache.db
	CacheDBPath string
	// ScratchDir is the directory that the snapshots of the databases are
	// made in, before they are written to the bundle (and removed). It has
	// to be there, and to have room for a copy of the databases. It is not
	// found by the exporter: nothing is made anywhere that it was not told.
	ScratchDir string
	// Schema is the schema of the databases that are in the bundle: the
	// version that the bundle says the database is at is its, and so is what
	// the database of a game is made with. It is not found by the exporter.
	Schema *database.Schema
	// Progress, if set, is told how verifying blobs is going. The exporter
	// itself prints nothing.
	Progress func(Progress)
}

type Progress added in v0.8.0

type Progress struct {
	Kind  ProgressKind
	Done  int
	Total int
}

Progress is an update on how an export is going.

type ProgressKind added in v0.8.0

type ProgressKind int

ProgressKind says what a Progress update is about.

const (
	// VerifyStarted: blob verification is about to begin; Total is the
	// number of blobs.
	VerifyStarted ProgressKind = iota
	// VerifyBlob: the Done'th blob (counting from 1) is being verified.
	VerifyBlob
	// VerifyFinished: every blob was verified.
	VerifyFinished
	// VerifyFailed: verification stopped without finishing, because of an
	// error or because the context was cancelled.
	VerifyFailed
)

type Result added in v0.8.0

type Result struct {
	// SkippedBlobs are the hashes of blobs that were in the database but
	// missing from disk, and so were left out of the export.
	SkippedBlobs []string
}

Result is what an export reports besides the file it wrote.

func Full

func Full(
	ctx context.Context,
	db *sql.DB,
	q *dbq.Queries,
	bs blobstore.Store,
	opts Options,
) (Result, error)

Full performs a full export of the entire modctl state.

func Game

func Game(
	ctx context.Context,
	db *sql.DB,
	q *dbq.Queries,
	bs blobstore.Store,
	gi dbq.GameInstall,
	opts Options,
) (Result, error)

Game performs a game-scoped export containing only data relevant to a single game install.

Jump to

Keyboard shortcuts

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