15
15
use serde:: { Deserialize , Serialize } ;
16
16
17
17
use crate :: serde_utils:: {
18
+ convert_data_size_with_shellexpand, convert_duration_with_shellexpand,
18
19
convert_numeric_with_shellexpand, convert_optional_string_with_shellexpand,
19
20
convert_string_with_shellexpand, convert_vec_string_with_shellexpand,
20
21
} ;
@@ -203,7 +204,7 @@ pub struct ShardStore {
203
204
#[ serde( deny_unknown_fields) ]
204
205
pub struct SizePartitioningStore {
205
206
/// Size to partition the data on.
206
- #[ serde( deserialize_with = "convert_numeric_with_shellexpand " ) ]
207
+ #[ serde( deserialize_with = "convert_data_size_with_shellexpand " ) ]
207
208
pub size : u64 ,
208
209
209
210
/// Store to send data when object is < (less than) size.
@@ -243,7 +244,7 @@ pub struct FilesystemStore {
243
244
/// Buffer size to use when reading files. Generally this should be left
244
245
/// to the default value except for testing.
245
246
/// Default: 32k.
246
- #[ serde( default , deserialize_with = "convert_numeric_with_shellexpand " ) ]
247
+ #[ serde( default , deserialize_with = "convert_data_size_with_shellexpand " ) ]
247
248
pub read_buffer_size : u32 ,
248
249
249
250
/// Policy used to evict items out of the store. Failure to set this
@@ -255,7 +256,7 @@ pub struct FilesystemStore {
255
256
/// value is used to determine an entry's actual size on disk consumed
256
257
/// For a 4KB block size filesystem, a 1B file actually consumes 4KB
257
258
/// Default: 4096
258
- #[ serde( default , deserialize_with = "convert_numeric_with_shellexpand " ) ]
259
+ #[ serde( default , deserialize_with = "convert_data_size_with_shellexpand " ) ]
259
260
pub block_size : u64 ,
260
261
}
261
262
@@ -297,7 +298,7 @@ pub struct DedupStore {
297
298
/// deciding where to partition the data.
298
299
///
299
300
/// Default: 65536 (64k)
300
- #[ serde( default , deserialize_with = "convert_numeric_with_shellexpand " ) ]
301
+ #[ serde( default , deserialize_with = "convert_data_size_with_shellexpand " ) ]
301
302
pub min_size : u32 ,
302
303
303
304
/// A best-effort attempt will be made to keep the average size
@@ -311,13 +312,13 @@ pub struct DedupStore {
311
312
/// details.
312
313
///
313
314
/// Default: 262144 (256k)
314
- #[ serde( default , deserialize_with = "convert_numeric_with_shellexpand " ) ]
315
+ #[ serde( default , deserialize_with = "convert_data_size_with_shellexpand " ) ]
315
316
pub normal_size : u32 ,
316
317
317
318
/// Maximum size a chunk is allowed to be.
318
319
///
319
320
/// Default: 524288 (512k)
320
- #[ serde( default , deserialize_with = "convert_numeric_with_shellexpand " ) ]
321
+ #[ serde( default , deserialize_with = "convert_data_size_with_shellexpand " ) ]
321
322
pub max_size : u32 ,
322
323
323
324
/// Due to implementation detail, we want to prefer to download
@@ -396,7 +397,7 @@ pub struct Lz4Config {
396
397
/// compression ratios.
397
398
///
398
399
/// Default: 65536 (64k).
399
- #[ serde( default , deserialize_with = "convert_numeric_with_shellexpand " ) ]
400
+ #[ serde( default , deserialize_with = "convert_data_size_with_shellexpand " ) ]
400
401
pub block_size : u32 ,
401
402
402
403
/// Maximum size allowed to attempt to deserialize data into.
@@ -407,7 +408,7 @@ pub struct Lz4Config {
407
408
/// allow you to specify the maximum that we'll attempt deserialize.
408
409
///
409
410
/// Default: value in `block_size`.
410
- #[ serde( default , deserialize_with = "convert_numeric_with_shellexpand " ) ]
411
+ #[ serde( default , deserialize_with = "convert_data_size_with_shellexpand " ) ]
411
412
pub max_decode_block_size : u32 ,
412
413
}
413
414
@@ -447,19 +448,19 @@ pub struct CompressionStore {
447
448
pub struct EvictionPolicy {
448
449
/// Maximum number of bytes before eviction takes place.
449
450
/// Default: 0. Zero means never evict based on size.
450
- #[ serde( default , deserialize_with = "convert_numeric_with_shellexpand " ) ]
451
+ #[ serde( default , deserialize_with = "convert_data_size_with_shellexpand " ) ]
451
452
pub max_bytes : usize ,
452
453
453
454
/// When eviction starts based on hitting max_bytes, continue until
454
455
/// max_bytes - evict_bytes is met to create a low watermark. This stops
455
456
/// operations from thrashing when the store is close to the limit.
456
457
/// Default: 0
457
- #[ serde( default , deserialize_with = "convert_numeric_with_shellexpand " ) ]
458
+ #[ serde( default , deserialize_with = "convert_data_size_with_shellexpand " ) ]
458
459
pub evict_bytes : usize ,
459
460
460
461
/// Maximum number of seconds for an entry to live before an eviction.
461
462
/// Default: 0. Zero means never evict based on time.
462
- #[ serde( default , deserialize_with = "convert_numeric_with_shellexpand " ) ]
463
+ #[ serde( default , deserialize_with = "convert_duration_with_shellexpand " ) ]
463
464
pub max_seconds : u32 ,
464
465
465
466
/// Maximum size of the store before an eviction takes place.
0 commit comments