Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: use in-memory storage by default #859

Merged
merged 2 commits into from
Dec 3, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 7 additions & 13 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,15 @@ use tracing_subscriber::prelude::*;
#[derive(Parser, Debug)]
#[clap(author, version, about, long_about = None)]
struct Args {
/// Where to store the database files
#[clap()]
storage_path: Option<String>,
/// The name of an RisingLight database.
/// A new database is created if the file does not previously exist.
#[clap(default_value = ":memory:")]
filename: String,

/// File to execute. Can be either a SQL `sql` file or sqllogictest `slt` file.
#[clap(short, long)]
file: Option<String>,

/// Whether to use in-memory engine
#[clap(long)]
memory: bool,

/// Control the output format
/// - `text`: plain text
/// - `human`: human readable format
Expand Down Expand Up @@ -326,15 +323,12 @@ async fn main() -> Result<()> {
minitrace::set_reporter(ConsoleReporter, Config::default());
}

let db = if args.memory {
info!("using memory engine");
let db = if args.filename == ":memory:" {
info!("Connected to a transient in-memory database.");
Database::new_in_memory()
} else {
info!("using Secondary engine");
let mut options = SecondaryStorageOptions::default_for_cli();
if let Some(path) = args.storage_path {
options.path = PathBuf::new().join(path);
}
options.path = PathBuf::new().join(args.filename);
Database::new_on_disk(options).await
};

Expand Down
Loading