Implement Default on IndexerOpts again

This commit is contained in:
Kerollmops 2022-03-22 16:38:52 +01:00
parent acdb10a307
commit b3a11e04af
No known key found for this signature in database
GPG Key ID: 92ADA4E935E71FA4
1 changed files with 12 additions and 1 deletions

View File

@ -69,7 +69,7 @@ impl TryFrom<&IndexerOpts> for IndexerConfig {
Ok(Self {
log_every_n: Some(other.log_every_n),
max_nb_chunks: other.max_nb_chunks,
max_memory: (*other.max_memory).map(|b| b.get_bytes() as usize),
max_memory: other.max_memory.map(|b| b.get_bytes() as usize),
thread_pool: Some(thread_pool),
max_positions_per_attributes: None,
..Default::default()
@ -77,6 +77,17 @@ impl TryFrom<&IndexerOpts> for IndexerConfig {
}
}
impl Default for IndexerOpts {
fn default() -> Self {
Self {
log_every_n: 100_000,
max_nb_chunks: None,
max_memory: MaxMemory::default(),
indexing_jobs: None,
}
}
}
/// A type used to detect the max memory available and use 2/3 of it.
#[derive(Debug, Clone, Copy)]
pub struct MaxMemory(Option<Byte>);