use crate::core::versions::MinOxenVersion;
pub const OXEN_VERSION: &str = env!("CARGO_PKG_VERSION");
pub const OXEN_HIDDEN_DIR: &str = ".oxen";
pub const OXEN: &str = "oxen";
pub const CONFIG_DIR: &str = ".config";
pub const OXEN_IGNORE_FILE: &str = ".oxenignore";
pub const ROOT_PATH: &str = "/";
pub const REPO_CONFIG_FILENAME: &str = "config.toml";
pub const HEAD_FILE: &str = "HEAD";
pub const REFS_DIR: &str = "refs";
pub const HISTORY_DIR: &str = "history";
pub const COMMITS_DIR: &str = "commits";
pub const CACHE_DIR: &str = "cache";
pub const COMMIT_COUNT_DIR: &str = "cache/commit_count";
pub const SCHEMAS_DIR: &str = "schemas";
pub const SCHEMAS_TREE_PREFIX: &str = ".oxen";
pub const BRANCH_LOCKS_DIR: &str = "locks";
pub const ROWS_DIR: &str = "rows";
pub const FILES_DIR: &str = "files";
pub const DATA_FRAMES_DIR: &str = "data_frames";
pub const DATA_FRAME_STATUS_DIR: &str = "data_frame_status";
pub const DIRS_DIR: &str = "dirs";
pub const DIR_HASHES_DIR: &str = "dir_hashes";
pub const TREE_DIR: &str = "tree";
pub const NODES_DIR: &str = "nodes";
pub const COMPARES_DIR: &str = "compares";
pub const LEFT_COMPARE_COMMIT: &str = "LEFT";
pub const RIGHT_COMPARE_COMMIT: &str = "RIGHT";
pub const STATS_DIR: &str = "stats";
pub const STAGED_DIR: &str = "staged";
pub const TABLE_NAME: &str = "df";
pub const OXEN_COLS: [&str; 4] = [OXEN_ID_COL, DIFF_STATUS_COL, OXEN_ROW_ID_COL, DIFF_HASH_COL];
pub const EXCLUDE_OXEN_COLS: [&str; 7] = [
OXEN_ID_COL,
DIFF_STATUS_COL,
OXEN_ROW_ID_COL,
DIFF_HASH_COL,
EVAL_STATUS_COL,
EVAL_ERROR_COL,
EVAL_DURATION_COL,
];
pub const OXEN_ROW_ID_COL: &str = "_oxen_row_id";
pub const OXEN_ID_COL: &str = "_oxen_id";
pub const DUCKDB_CACHE_DIR: &str = "duckdb";
pub const DUCKDB_DF_TABLE_NAME: &str = "df";
pub const MAX_QUERYABLE_ROWS: usize = 5_000_000;
pub const SYNC_STATUS_DIR: &str = "sync_status";
pub const SHALLOW_FLAG: &str = "SHALLOW";
pub const INDICES_DIR: &str = "indices";
pub const FIELDS_DIR: &str = "fields";
pub const VERSIONS_DIR: &str = "versions";
pub const CHUNKS_DIR: &str = "chunks";
pub const OBJECT_FILES_DIR: &str = "files";
pub const VERSION_FILE_NAME: &str = "data";
pub const VERSION_CHUNK_FILE_NAME: &str = "chunk";
pub const VERSION_CHUNKS_DIR: &str = "chunks";
pub const MERGE_DIR: &str = "merge";
pub const MODS_DIR: &str = "mods";
pub const WORKSPACES_DIR: &str = "workspaces";
pub const WORKSPACE_CONFIG: &str = "WORKSPACE_CONFIG";
pub const WORKSPACE_NAME_INDEX_DIR: &str = "workspace_name_index";
pub const MERGE_HEAD_FILE: &str = "MERGE_HEAD";
pub const ORIG_HEAD_FILE: &str = "ORIG_HEAD";
pub const MERGE_IN_PROGRESS_FILE: &str = "MERGE_IN_PROGRESS";
pub const IS_SYNCED: &str = "IS_SYNCED";
pub const DEFAULT_BRANCH_NAME: &str = "main";
pub const DEFAULT_REMOTE_NAME: &str = "origin";
pub const DEFAULT_HOST: &str = "hub.oxen.ai";
pub const DEFAULT_SCHEME: &str = "https";
pub const DEFAULT_NAMESPACE: &str = "ox";
pub const INITIAL_COMMIT_MSG: &str = "Initialized Repo 🐂";
pub const ROW_NUM_COL_NAME: &str = "_row_num";
pub const ROW_HASH_COL_NAME: &str = "_row_hash";
pub const FILE_ROW_NUM_COL_NAME: &str = "_file_row_num";
pub const TARGETS_HASH_COL: &str = "_targets_hash";
pub const KEYS_HASH_COL: &str = "_keys_hash";
pub const DIFF_STATUS_COL: &str = "_oxen_diff_status";
pub const DIFF_HASH_COL: &str = "_oxen_diff_hash";
pub const EVAL_STATUS_COL: &str = "_oxen_eval_status";
pub const EVAL_ERROR_COL: &str = "_oxen_eval_error";
pub const EVAL_DURATION_COL: &str = "_oxen_eval_duration";
pub const AVG_CHUNK_SIZE: u64 = 1024 * 1024 * 10;
pub const MAX_CONCURRENT_UPLOADS: usize = 30;
pub const MAX_ZIP_DOWNLOAD_SIZE: u64 = 1024 * 1024 * 1024; #[cfg(test)]
pub const NUM_HTTP_RETRIES: u64 = 1;
#[cfg(not(test))]
pub const NUM_HTTP_RETRIES: u64 = 5;
pub const DEFAULT_NUM_WORKERS: usize = 8;
pub const DEFAULT_TIMEOUT_SECS: u64 = 600;
pub const DEFAULT_VNODE_SIZE: u64 = 10_000;
pub const DEFAULT_PAGE_SIZE: usize = 100;
pub const DEFAULT_PAGE_NUM: usize = 1;
pub const MIN_OXEN_VERSION: MinOxenVersion = MinOxenVersion::LATEST;
pub const LAST_MIGRATION_FILE: &str = "last_migration.txt";
pub const MAX_DISPLAY_DIRS: usize = 10;
pub const OXEN_STACK_SIZE: usize = 16_777_216;
pub fn max_retries() -> usize {
if let Ok(max_retries) = std::env::var("OXEN_NUM_RETRIES") {
if let Ok(max_retries) = max_retries.parse::<usize>() {
max_retries
} else {
NUM_HTTP_RETRIES.try_into().unwrap()
}
} else {
NUM_HTTP_RETRIES.try_into().unwrap()
}
}
pub fn timeout() -> u64 {
if let Ok(timeout) = std::env::var("OXEN_TIMEOUT_SECS") {
if let Ok(timeout) = timeout.parse::<u64>() {
timeout
} else {
DEFAULT_TIMEOUT_SECS
}
} else {
DEFAULT_TIMEOUT_SECS
}
}
pub fn chunk_size() -> u64 {
if let Ok(chunk_size) = std::env::var("OXEN_AVG_CHUNK_SIZE") {
if let Ok(chunk_size) = chunk_size.parse::<u64>() {
chunk_size
} else {
AVG_CHUNK_SIZE
}
} else {
AVG_CHUNK_SIZE
}
}