Skip to content

Commit

Permalink
Save progress with manual code
Browse files Browse the repository at this point in the history
  • Loading branch information
carlosthe19916 committed Jan 9, 2024
1 parent f9ab762 commit fafa472
Show file tree
Hide file tree
Showing 15 changed files with 155 additions and 942 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions openubl/index/src/client/mod.rs

This file was deleted.

189 changes: 0 additions & 189 deletions openubl/index/src/client/search.rs

This file was deleted.

73 changes: 0 additions & 73 deletions openubl/index/src/client/write.rs

This file was deleted.

48 changes: 15 additions & 33 deletions openubl/index/src/config.rs
Original file line number Diff line number Diff line change
@@ -1,49 +1,31 @@
use std::fmt::Display;
#[derive(clap::Subcommand, Debug)]
pub enum SearchEngine {
Local(LocalEngine),
}

#[derive(clap::Args, Debug)]
pub struct SearchEngine {
/// Synchronization interval for index persistence.
pub struct LocalEngine {
#[arg(
id = "search-engine-mode",
long,
env = "SEARCH_ENGINE_MODE",
default_value_t = IndexMode::File
id = "search-engine-local-dir",
long,
env = "SEARCH_ENGINE_LOCAL_DIR",
default_value = "index"
)]
pub mode: IndexMode,
pub index_dir: String,

#[arg(
id = "search-engine-sync-interval",
id = "search-engine-local-sync-interval",
long,
env = "SEARCH_ENGINE_SYNC_INTERVAL",
env = "SEARCH_ENGINE_LOCAL_SYNC_INTERVAL",
default_value = "30S"
)]
pub sync_interval: humantime::Duration,

#[arg(
id = "search-engine-writer-memory",
id = "search-engine-local-writer-memory",
long,
env = "SEARCH_ENGINE_WRITER_MEMORY",
env = "SEARCH_ENGINE_LOCAL_WRITER_MEMORY",
default_value = "default_value_t = ByteSize::mb(256)"
)]
pub index_writer_memory_bytes: bytesize::ByteSize,
}

#[derive(Clone, Debug, clap::ValueEnum)]
pub enum IndexMode {
File,
S3,
}

impl Display for IndexMode {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
Self::File => write!(f, "file"),
Self::S3 => write!(f, "s3"),
}
}
}

impl Default for IndexMode {
fn default() -> Self {
Self::File
}
}
Loading

0 comments on commit fafa472

Please sign in to comment.