@@ -27,18 +27,21 @@ public class CleanupPolicy {
2727 private final Optional <Boolean > deleteUnverified ;
2828 private final Optional <Boolean > errorIfTaggedOldVersions ;
2929 private final Optional <Boolean > cleanReferencedBranches ;
30+ private final Optional <Long > deleteRateLimit ;
3031
3132 private CleanupPolicy (
3233 Optional <Long > beforeTimestampMillis ,
3334 Optional <Long > beforeVersion ,
3435 Optional <Boolean > deleteUnverified ,
3536 Optional <Boolean > errorIfTaggedOldVersions ,
36- Optional <Boolean > cleanReferencedBranches ) {
37+ Optional <Boolean > cleanReferencedBranches ,
38+ Optional <Long > deleteRateLimit ) {
3739 this .beforeTimestampMillis = beforeTimestampMillis ;
3840 this .beforeVersion = beforeVersion ;
3941 this .deleteUnverified = deleteUnverified ;
4042 this .errorIfTaggedOldVersions = errorIfTaggedOldVersions ;
4143 this .cleanReferencedBranches = cleanReferencedBranches ;
44+ this .deleteRateLimit = deleteRateLimit ;
4245 }
4346
4447 public static Builder builder () {
@@ -65,13 +68,18 @@ public Optional<Boolean> getCleanReferencedBranches() {
6568 return cleanReferencedBranches ;
6669 }
6770
71+ public Optional <Long > getDeleteRateLimit () {
72+ return deleteRateLimit ;
73+ }
74+
6875 /** Builder for CleanupPolicy. */
6976 public static class Builder {
7077 private Optional <Long > beforeTimestampMillis = Optional .empty ();
7178 private Optional <Long > beforeVersion = Optional .empty ();
7279 private Optional <Boolean > deleteUnverified = Optional .empty ();
7380 private Optional <Boolean > errorIfTaggedOldVersions = Optional .empty ();
7481 private Optional <Boolean > cleanReferencedBranches = Optional .empty ();
82+ private Optional <Long > deleteRateLimit = Optional .empty ();
7583
7684 private Builder () {}
7785
@@ -105,13 +113,20 @@ public Builder withCleanReferencedBranches(boolean cleanReferencedBranches) {
105113 return this ;
106114 }
107115
116+ /** Set the maximum number of delete operations per second. */
117+ public Builder withDeleteRateLimit (long deleteRateLimit ) {
118+ this .deleteRateLimit = Optional .of (deleteRateLimit );
119+ return this ;
120+ }
121+
108122 public CleanupPolicy build () {
109123 return new CleanupPolicy (
110124 beforeTimestampMillis ,
111125 beforeVersion ,
112126 deleteUnverified ,
113127 errorIfTaggedOldVersions ,
114- cleanReferencedBranches );
128+ cleanReferencedBranches ,
129+ deleteRateLimit );
115130 }
116131 }
117132}
0 commit comments