Documentation
¶
Overview ¶
Package downloaderconfig owns the on-disk + in-DB representation of the gitmap downloader configuration.
Slice 1 of the downloader feature only persists the config — actual download / install logic ships in later slices. Keeping the data layer isolated here means Slice 2 (aria2c installer + engine) and Slice 3 (download / download-unzip commands) can both depend on a stable Load() without re-implementing JSON parsing.
Storage model: a single JSON document under Setting[DownloaderConfig]. We deliberately do NOT introduce a new SettingTypes table — the existing Setting(Key TEXT PK, Value TEXT) shape from constants_settings.go is reused, and the type discriminator lives in code as constants.SettingType.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Marshal ¶
Marshal serializes a Document with deterministic 2-space indent, matching the project's JSONIndent convention so files written back round-trip cleanly with the seed.
Types ¶
type DatabaseVersion ¶
type DatabaseVersion struct {
LastKnownVersion string `json:"LastKnownVersion"`
}
DatabaseVersion records the last gitmap version that touched the DB. Stored as a string so we can keep the literal "auto" sentinel in the shipped seed file and resolve it at apply-time to constants.Version.
type Document ¶
type Document struct {
DownloaderConfig DownloaderConfig `json:"DownloaderConfig"`
DatabaseVersion DatabaseVersion `json:"DatabaseVersion"`
}
Document is the top-level Seedable-Config envelope. Field names are PascalCase to match the spec and the JSON file shipped under gitmap/data/downloader-config.json.
func Defaults ¶
func Defaults() Document
Defaults returns a Document populated from the hard-coded constants. Used as the last-resort fallback when both the DB and the seed file are unavailable (e.g. first-run race before Migrate completes).
type DownloaderConfig ¶
type DownloaderConfig struct {
PreferredDownloader string `json:"PreferredDownloader"`
FallbackDownloader string `json:"FallbackDownloader"`
ParallelDownloads int `json:"ParallelDownloads"`
SplitConnections int `json:"SplitConnections"`
DefaultSplitSize string `json:"DefaultSplitSize"`
LargeFileSplitSize string `json:"LargeFileSplitSize"`
LargeFileThreshold string `json:"LargeFileThreshold"`
TinyFileThreshold string `json:"TinyFileThreshold"`
TinyFileSplitSize string `json:"TinyFileSplitSize"`
TinyFileSplits int `json:"TinyFileSplits"`
AllowFallback bool `json:"AllowFallback"`
OverwriteUserConfig bool `json:"OverwriteUserConfig"`
}
DownloaderConfig is the per-downloader runtime config consumed by Slice 2 (aria2c installer + engine).