@@ -51,17 +51,17 @@ public Config getRawStorageConfig() {
5151 // Excluded from auto-binding: optional partial overrides that ConfigBeanFactory cannot handle.
5252 @ Getter (lombok .AccessLevel .NONE )
5353 @ Setter (lombok .AccessLevel .NONE )
54- private PropertyConfig defaultDbOption ;
54+ private DbOptionOverride defaultDbOption ;
5555 @ Getter (lombok .AccessLevel .NONE )
5656 @ Setter (lombok .AccessLevel .NONE )
57- private PropertyConfig defaultMDbOption ;
57+ private DbOptionOverride defaultMDbOption ;
5858 @ Getter (lombok .AccessLevel .NONE )
5959 @ Setter (lombok .AccessLevel .NONE )
60- private PropertyConfig defaultLDbOption ;
60+ private DbOptionOverride defaultLDbOption ;
6161
62- public PropertyConfig getDefaultDbOption () { return defaultDbOption ; }
63- public PropertyConfig getDefaultMDbOption () { return defaultMDbOption ; }
64- public PropertyConfig getDefaultLDbOption () { return defaultLDbOption ; }
62+ public DbOptionOverride getDefaultDbOption () { return defaultDbOption ; }
63+ public DbOptionOverride getDefaultMDbOption () { return defaultMDbOption ; }
64+ public DbOptionOverride getDefaultLDbOption () { return defaultLDbOption ; }
6565
6666 @ Getter
6767 @ Setter
@@ -174,7 +174,7 @@ public static class PropertyConfig {
174174 private int compressionType = 1 ;
175175 private int blockSize = 4096 ;
176176 private int writeBufferSize = 10485760 ;
177- private int cacheSize = 10485760 ;
177+ private long cacheSize = 10485760 ;
178178 private int maxOpenFiles = 100 ;
179179 }
180180
@@ -193,47 +193,62 @@ public static StorageConfig fromConfig(Config config) {
193193 return sc ;
194194 }
195195
196+ // Partial LevelDB option override for default/defaultM/defaultL.
197+ // Uses boxed types so null means "not set by user, keep existing value".
198+ @ Getter
199+ @ Setter
200+ public static class DbOptionOverride {
201+ private Boolean createIfMissing ;
202+ private Boolean paranoidChecks ;
203+ private Boolean verifyChecksums ;
204+ private Integer compressionType ;
205+ private Integer blockSize ;
206+ private Integer writeBufferSize ;
207+ private Long cacheSize ;
208+ private Integer maxOpenFiles ;
209+ }
210+
196211 // Read optional LevelDB option override (default/defaultM/defaultL).
197212 // Not bean-bound: users may only set a subset of keys (e.g. just maxOpenFiles),
198213 // ConfigBeanFactory requires all fields present so partial overrides would fail.
199- private static PropertyConfig readDbOption (Config section , String key ) {
214+ private static DbOptionOverride readDbOption (Config section , String key ) {
200215 if (!section .hasPath (key )) {
201216 return null ;
202217 }
203218 ConfigObject conf = section .getObject (key );
204- PropertyConfig pc = new PropertyConfig ();
219+ DbOptionOverride o = new DbOptionOverride ();
205220 if (conf .containsKey ("createIfMissing" )) {
206- pc .setCreateIfMissing (
221+ o .setCreateIfMissing (
207222 Boolean .parseBoolean (conf .get ("createIfMissing" ).unwrapped ().toString ()));
208223 }
209224 if (conf .containsKey ("paranoidChecks" )) {
210- pc .setParanoidChecks (
225+ o .setParanoidChecks (
211226 Boolean .parseBoolean (conf .get ("paranoidChecks" ).unwrapped ().toString ()));
212227 }
213228 if (conf .containsKey ("verifyChecksums" )) {
214- pc .setVerifyChecksums (
229+ o .setVerifyChecksums (
215230 Boolean .parseBoolean (conf .get ("verifyChecksums" ).unwrapped ().toString ()));
216231 }
217232 if (conf .containsKey ("compressionType" )) {
218- pc .setCompressionType (
233+ o .setCompressionType (
219234 Integer .parseInt (conf .get ("compressionType" ).unwrapped ().toString ()));
220235 }
221236 if (conf .containsKey ("blockSize" )) {
222- pc .setBlockSize (
237+ o .setBlockSize (
223238 Integer .parseInt (conf .get ("blockSize" ).unwrapped ().toString ()));
224239 }
225240 if (conf .containsKey ("writeBufferSize" )) {
226- pc .setWriteBufferSize (
241+ o .setWriteBufferSize (
227242 Integer .parseInt (conf .get ("writeBufferSize" ).unwrapped ().toString ()));
228243 }
229244 if (conf .containsKey ("cacheSize" )) {
230- pc .setCacheSize (
231- Integer . parseInt (conf .get ("cacheSize" ).unwrapped ().toString ()));
245+ o .setCacheSize (
246+ Long . parseLong (conf .get ("cacheSize" ).unwrapped ().toString ()));
232247 }
233248 if (conf .containsKey ("maxOpenFiles" )) {
234- pc .setMaxOpenFiles (
249+ o .setMaxOpenFiles (
235250 Integer .parseInt (conf .get ("maxOpenFiles" ).unwrapped ().toString ()));
236251 }
237- return pc ;
252+ return o ;
238253 }
239254}
0 commit comments