diff options
author | Slack Coder <slackcoder@server.ky> | 2025-04-21 16:45:39 -0500 |
---|---|---|
committer | Slack Coder <slackcoder@server.ky> | 2025-04-22 15:27:36 -0500 |
commit | d75e17a48934e4896963fb0fee78dbd53f4e780b (patch) | |
tree | 27a4fd16640846df846d36d2fc5b898189b68620 /internal/service/config.go | |
parent | e7dd47e8b683a51851883bf2918086963676d7cd (diff) | |
download | mirror-d75e17a48934e4896963fb0fee78dbd53f4e780b.tar.xz |
Implement staging and verificationv0.0.3
Ensure data integrity by supporting data staging and verification.
Diffstat (limited to 'internal/service/config.go')
-rw-r--r-- | internal/service/config.go | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/internal/service/config.go b/internal/service/config.go index 0f34997..2a8da6e 100644 --- a/internal/service/config.go +++ b/internal/service/config.go @@ -10,10 +10,21 @@ import ( "github.com/BurntSushi/toml" ) +type StagingMethod string + +const ( + StagingMethodNone = "none" + StagingMethodTemporary = "temporary" + StagingMethodPersistent = "persistent" +) + // Global parameters type GlobalConfig struct { - MaxInterval *Duration `toml:"max-interval"` - MinInterval *Duration `toml:"min-interval"` + MaxInterval *Duration `toml:"max-interval"` + MinInterval *Duration `toml:"min-interval"` + StagingMethod string `toml:"staging-method,omitempty"` + StagingPath string `toml:"staging-path,omitempty"` + Verify string `toml:"verify,omitempty"` } type Config struct { @@ -27,8 +38,11 @@ func (c *Config) String() string { var DefaultConfig = Config{ GlobalConfig: GlobalConfig{ - MaxInterval: DurationRef(24 * time.Hour), - MinInterval: DurationRef(time.Hour), + MaxInterval: DurationRef(24 * time.Hour), + MinInterval: DurationRef(time.Hour), + StagingMethod: StagingMethodNone, + StagingPath: "/tmp/mirror", + Verify: "", }, } @@ -113,5 +127,11 @@ func (c *Config) Append(src *Config) { if src.MinInterval != nil { c.MinInterval = src.MinInterval } + if src.StagingMethod != "" { + c.StagingMethod = src.StagingMethod + } + if src.StagingPath != "" { + c.StagingPath = src.StagingPath + } c.Mirrors = append(c.Mirrors, src.Mirrors...) } |