@@ -430,6 +430,8 @@ pub struct BackgroundTaskConfig {
430
430
RegionSnapshotReplacementFinishConfig ,
431
431
/// configuration for TUF artifact replication task
432
432
pub tuf_artifact_replication : TufArtifactReplicationConfig ,
433
+ /// configuration for TUF repo pruner task
434
+ pub tuf_repo_pruner : TufRepoPrunerConfig ,
433
435
/// configuration for read-only region replacement start task
434
436
pub read_only_region_replacement_start :
435
437
ReadOnlyRegionReplacementStartConfig ,
@@ -765,6 +767,26 @@ pub struct TufArtifactReplicationConfig {
765
767
pub min_sled_replication : usize ,
766
768
}
767
769
770
+ #[ serde_as]
771
+ #[ derive( Clone , Debug , Deserialize , Eq , PartialEq , Serialize ) ]
772
+ pub struct TufRepoPrunerConfig {
773
+ /// period (in seconds) for periodic activations of this background task
774
+ #[ serde_as( as = "DurationSeconds<u64>" ) ]
775
+ pub period_secs : Duration ,
776
+
777
+ /// number of extra recent target releases to keep
778
+ ///
779
+ /// The system always keeps two: the current release and the previous one.
780
+ /// This number is in addition to that.
781
+ pub nkeep_extra_target_releases : u8 ,
782
+
783
+ /// number of extra recently uploaded repos to keep
784
+ ///
785
+ /// The system always keeps one, assuming that the operator may be about to
786
+ /// update to it. This number is in addition to that.
787
+ pub nkeep_extra_newly_uploaded : u8 ,
788
+ }
789
+
768
790
#[ serde_as]
769
791
#[ derive( Clone , Debug , Deserialize , Eq , PartialEq , Serialize ) ]
770
792
pub struct ReadOnlyRegionReplacementStartConfig {
@@ -1119,6 +1141,9 @@ mod test {
1119
1141
region_snapshot_replacement_finish.period_secs = 30
1120
1142
tuf_artifact_replication.period_secs = 300
1121
1143
tuf_artifact_replication.min_sled_replication = 3
1144
+ tuf_repo_pruner.period_secs = 299
1145
+ tuf_repo_pruner.nkeep_extra_target_releases = 51
1146
+ tuf_repo_pruner.nkeep_extra_newly_uploaded = 52
1122
1147
read_only_region_replacement_start.period_secs = 30
1123
1148
alert_dispatcher.period_secs = 42
1124
1149
webhook_deliverator.period_secs = 43
@@ -1342,6 +1367,11 @@ mod test {
1342
1367
period_secs: Duration :: from_secs( 300 ) ,
1343
1368
min_sled_replication: 3 ,
1344
1369
} ,
1370
+ tuf_repo_pruner: TufRepoPrunerConfig {
1371
+ period_secs: Duration :: from_secs( 299 ) ,
1372
+ nkeep_extra_target_releases: 51 ,
1373
+ nkeep_extra_newly_uploaded: 52 ,
1374
+ } ,
1345
1375
read_only_region_replacement_start:
1346
1376
ReadOnlyRegionReplacementStartConfig {
1347
1377
period_secs: Duration :: from_secs( 30 ) ,
@@ -1449,6 +1479,9 @@ mod test {
1449
1479
region_snapshot_replacement_finish.period_secs = 30
1450
1480
tuf_artifact_replication.period_secs = 300
1451
1481
tuf_artifact_replication.min_sled_replication = 3
1482
+ tuf_repo_pruner.period_secs = 299
1483
+ tuf_repo_pruner.nkeep_extra_target_releases = 51
1484
+ tuf_repo_pruner.nkeep_extra_newly_uploaded = 52
1452
1485
read_only_region_replacement_start.period_secs = 30
1453
1486
alert_dispatcher.period_secs = 42
1454
1487
webhook_deliverator.period_secs = 43
0 commit comments