Skip to content

Commit f1490da

Browse files
authored
refactor: rename with_buffer_threshold to with_buffer_pool_size (#729)
Signed-off-by: MrCroxx <[email protected]>
1 parent fd68f1b commit f1490da

File tree

3 files changed

+46
-8
lines changed

3 files changed

+46
-8
lines changed

examples/hybrid_full.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ async fn main() -> Result<()> {
4848
.with_recover_concurrency(8)
4949
.with_flushers(2)
5050
.with_reclaimers(2)
51-
.with_buffer_threshold(256 * 1024 * 1024)
51+
.with_buffer_pool_size(256 * 1024 * 1024)
5252
.with_clean_region_threshold(4)
5353
.with_eviction_pickers(vec![Box::<FifoPicker>::default()])
5454
.with_admission_picker(Arc::new(RateLimitPicker::new(100 * 1024 * 1024)))

foyer-storage/src/store.rs

+22-6
Original file line numberDiff line numberDiff line change
@@ -357,8 +357,7 @@ where
357357
recover_concurrency: usize,
358358
flushers: usize,
359359
reclaimers: usize,
360-
// FIXME(MrCroxx): rename the field and builder fn.
361-
buffer_threshold: usize,
360+
buffer_pool_size: usize,
362361
clean_region_threshold: Option<usize>,
363362
eviction_pickers: Vec<Box<dyn EvictionPicker>>,
364363
admission_picker: Arc<dyn AdmissionPicker<Key = K>>,
@@ -387,7 +386,7 @@ where
387386
recover_concurrency: 8,
388387
flushers: 1,
389388
reclaimers: 1,
390-
buffer_threshold: 16 * 1024 * 1024, // 16 MiB
389+
buffer_pool_size: 16 * 1024 * 1024, // 16 MiB
391390
clean_region_threshold: None,
392391
eviction_pickers: vec![Box::new(InvalidRatioPicker::new(0.8)), Box::<FifoPicker>::default()],
393392
admission_picker: Arc::<AdmitAllPicker<K>>::default(),
@@ -469,15 +468,32 @@ where
469468
self
470469
}
471470

471+
// FIXME(MrCroxx): remove it after 0.12
472472
/// Set the total flush buffer threshold.
473473
///
474474
/// Each flusher shares a volume at `threshold / flushers`.
475475
///
476476
/// If the buffer of the flush queue exceeds the threshold, the further entries will be ignored.
477477
///
478478
/// Default: 16 MiB.
479+
#[deprecated(
480+
since = "0.11.4",
481+
note = "The function will be renamed to \"with_buffer_pool_size()\", use it instead."
482+
)]
479483
pub fn with_buffer_threshold(mut self, threshold: usize) -> Self {
480-
self.buffer_threshold = threshold;
484+
self.buffer_pool_size = threshold;
485+
self
486+
}
487+
488+
/// Set the total flush buffer pool size.
489+
///
490+
/// Each flusher shares a volume at `threshold / flushers`.
491+
///
492+
/// If the buffer of the flush queue exceeds the threshold, the further entries will be ignored.
493+
///
494+
/// Default: 16 MiB.
495+
pub fn with_buffer_pool_size(mut self, buffer_pool_size: usize) -> Self {
496+
self.buffer_pool_size = buffer_pool_size;
481497
self
482498
}
483499

@@ -659,7 +675,7 @@ where
659675
eviction_pickers: self.eviction_pickers,
660676
reinsertion_picker: self.reinsertion_picker,
661677
tombstone_log_config: self.tombstone_log_config,
662-
buffer_threshold: self.buffer_threshold,
678+
buffer_threshold: self.buffer_pool_size,
663679
statistics: statistics.clone(),
664680
write_runtime_handle,
665681
read_runtime_handle,
@@ -702,7 +718,7 @@ where
702718
eviction_pickers: self.eviction_pickers,
703719
reinsertion_picker: self.reinsertion_picker,
704720
tombstone_log_config: self.tombstone_log_config,
705-
buffer_threshold: self.buffer_threshold,
721+
buffer_threshold: self.buffer_pool_size,
706722
statistics: statistics.clone(),
707723
write_runtime_handle,
708724
read_runtime_handle,

foyer/src/hybrid/builder.rs

+23-1
Original file line numberDiff line numberDiff line change
@@ -299,15 +299,37 @@ where
299299
}
300300
}
301301

302+
// FIXME(MrCroxx): remove it after 0.12
302303
/// Set the total flush buffer threshold.
303304
///
304305
/// Each flusher shares a volume at `threshold / flushers`.
305306
///
306307
/// If the buffer of the flush queue exceeds the threshold, the further entries will be ignored.
307308
///
308309
/// Default: 16 MiB.
310+
#[deprecated(
311+
since = "0.11.4",
312+
note = "The function will be renamed to \"with_buffer_pool_size()\", use it instead."
313+
)]
309314
pub fn with_buffer_threshold(self, threshold: usize) -> Self {
310-
let builder = self.builder.with_buffer_threshold(threshold);
315+
let builder = self.builder.with_buffer_pool_size(threshold);
316+
Self {
317+
name: self.name,
318+
tracing_config: self.tracing_config,
319+
memory: self.memory,
320+
builder,
321+
}
322+
}
323+
324+
/// Set the total flush buffer pool size.
325+
///
326+
/// Each flusher shares a volume at `threshold / flushers`.
327+
///
328+
/// If the buffer of the flush queue exceeds the threshold, the further entries will be ignored.
329+
///
330+
/// Default: 16 MiB.
331+
pub fn with_buffer_pool_size(self, buffer_pool_size: usize) -> Self {
332+
let builder = self.builder.with_buffer_pool_size(buffer_pool_size);
311333
Self {
312334
name: self.name,
313335
tracing_config: self.tracing_config,

0 commit comments

Comments
 (0)