Skip to content

Commit e01ebdf

Browse files
committed
feat: adding detect_exit_signals option
1 parent 215e3ac commit e01ebdf

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

src/dustdata.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,11 @@ use storage::lsm;
77
/// A LSM configuration
88
/// # Arguments
99
/// * `flush_threshold` - The number of bytes to flush before flushing to disk
10+
/// * `detect_exit_signals` - Whether or not to detect exit signals (SIGTERM, SIGHUP, etc.)
1011
#[derive(Clone)]
1112
pub struct LsmConfig {
1213
pub flush_threshold: Size,
14+
pub detect_exit_signals: bool,
1315
}
1416

1517
/// A DustData configuration
@@ -154,7 +156,9 @@ impl DustData {
154156
sstable_path: path.to_str().unwrap().to_string(),
155157
});
156158

157-
lsm.handle_ctrlc();
159+
if configuration.lsm_config.detect_exit_signals {
160+
lsm.handle_ctrlc();
161+
}
158162

159163
Self {
160164
lsm,

src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ mod dustdata_tests {
2727
verbose: true,
2828
path: "./test_data/dustdata".to_string(),
2929
lsm_config: LsmConfig {
30+
detect_exit_signals: false,
3031
flush_threshold: Size::Megabytes(128),
3132
},
3233
}

0 commit comments

Comments
 (0)