Artifact 10114e573785c35c2b4b8f0257da46ada637d03934aee161940caade6d22dd20:
- File
sim/config.go
— part of check-in
[38efed7a12]
at
2026-08-12 20:50:57
on branch main
— chore(deps): migrate to go-libfossil v0.9.0 (#195)
* chore(deps): migrate to go-libfossil v0.9.0 (renamed module path)
- import path danmestas/libfossil → danmestas/go-libfossil everywhere - CloneOpts.ProjectCode removed upstream; assert via CloneResult instead - Timeline now takes TimelineOpts (cursor pagination, newest-first) - testutil.HasFossil removed; check FossilBinary() != ""
* ci: retrigger checks
---------
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> (user: [email protected], size: 1612) [annotate] [blame] [check-ins using]
package sim import ( "flag" "time" libfossil "github.com/danmestas/go-libfossil" ) // Level controls fault injection severity. type Level int const ( LevelNormal Level = iota // No faults LevelAdversarial // 5-15% fault rate LevelHostile // 20-30% fault rate ) func (l Level) String() string { switch l { case LevelNormal: return "normal" case LevelAdversarial: return "adversarial" case LevelHostile: return "hostile" } return "unknown" } func ParseLevel(s string) Level { switch s { case "adversarial": return LevelAdversarial case "hostile": return LevelHostile default: return LevelNormal } } // SimConfig configures a simulation run. type SimConfig struct { Seed int64 NumLeaves int BlobsPerLeaf int MaxBlobSize int FaultDuration time.Duration QuiesceTimeout time.Duration Severity Level KeepOnFailure bool Observer libfossil.SyncObserver } func (c *SimConfig) applyDefaults() { if c.NumLeaves == 0 { c.NumLeaves = 2 } if c.BlobsPerLeaf == 0 { c.BlobsPerLeaf = 5 } if c.MaxBlobSize == 0 { c.MaxBlobSize = 4096 } if c.FaultDuration == 0 { c.FaultDuration = 20 * time.Second } if c.QuiesceTimeout == 0 { c.QuiesceTimeout = 60 * time.Second } } // Test flags — registered once. var ( flagSeed = flag.Int64("sim.seed", 1, "simulation PRNG seed") flagSeeds = flag.String("sim.seeds", "", "seed range e.g. 1-16") flagSeverity = flag.String("sim.severity", "normal", "normal|adversarial|hostile") flagLeaves = flag.Int("sim.leaves", 2, "number of leaf agents") )