@@ -134,4 +134,85 @@ public int hashCode() {
134134 minTimeToKeepEnvOpen ,
135135 snapshotRetryFetchInterval );
136136 }
137+
138+ public static Builder builder () {
139+ return new Builder ();
140+ }
141+
142+ public Builder copy () {
143+ return new Builder (this );
144+ }
145+
146+ public static class Builder {
147+
148+ private CacheConfig stateDocCache ;
149+ private List <String > nodeList ;
150+ private String path ;
151+ private StroomDuration minTimeToKeepSnapshots ;
152+ private StroomDuration minTimeToKeepEnvOpen ;
153+ private StroomDuration snapshotRetryFetchInterval ;
154+
155+ public Builder () {
156+ // Set defaults
157+ this .stateDocCache = CacheConfig
158+ .builder ()
159+ .maximumSize (1000L )
160+ .expireAfterWrite (StroomDuration .ofMinutes (10 ))
161+ .build ();
162+ this .nodeList = Collections .emptyList ();
163+ this .path = "${stroom.home}/planb" ;
164+ this .minTimeToKeepSnapshots = StroomDuration .ofMinutes (10 );
165+ this .minTimeToKeepEnvOpen = StroomDuration .ofMinutes (1 );
166+ this .snapshotRetryFetchInterval = StroomDuration .ofMinutes (1 );
167+ }
168+
169+ public Builder (final PlanBConfig config ) {
170+ this .stateDocCache = config .stateDocCache ;
171+ this .nodeList = config .nodeList ;
172+ this .path = config .path ;
173+ this .minTimeToKeepSnapshots = config .minTimeToKeepSnapshots ;
174+ this .minTimeToKeepEnvOpen = config .minTimeToKeepEnvOpen ;
175+ this .snapshotRetryFetchInterval = config .snapshotRetryFetchInterval ;
176+ }
177+
178+ public Builder stateDocCache (final CacheConfig stateDocCache ) {
179+ this .stateDocCache = stateDocCache ;
180+ return this ;
181+ }
182+
183+ public Builder nodeList (final List <String > nodeList ) {
184+ this .nodeList = nodeList ;
185+ return this ;
186+ }
187+
188+ public Builder path (final String path ) {
189+ this .path = path ;
190+ return this ;
191+ }
192+
193+ public Builder minTimeToKeepSnapshots (final StroomDuration minTimeToKeepSnapshots ) {
194+ this .minTimeToKeepSnapshots = minTimeToKeepSnapshots ;
195+ return this ;
196+ }
197+
198+ public Builder minTimeToKeepEnvOpen (final StroomDuration minTimeToKeepEnvOpen ) {
199+ this .minTimeToKeepEnvOpen = minTimeToKeepEnvOpen ;
200+ return this ;
201+ }
202+
203+ public Builder snapshotRetryFetchInterval (final StroomDuration snapshotRetryFetchInterval ) {
204+ this .snapshotRetryFetchInterval = snapshotRetryFetchInterval ;
205+ return this ;
206+ }
207+
208+ public PlanBConfig build () {
209+ return new PlanBConfig (
210+ stateDocCache ,
211+ nodeList ,
212+ path ,
213+ minTimeToKeepSnapshots ,
214+ minTimeToKeepEnvOpen ,
215+ snapshotRetryFetchInterval );
216+ }
217+ }
137218}
0 commit comments