mirror of
https://github.com/aljazceru/turso.git
synced 2025-12-17 08:34:19 +01:00
Use the updated bindings for encryption throughput tests
This commit is contained in:
@@ -4,13 +4,7 @@ use rand::{Rng, RngCore, SeedableRng};
|
|||||||
use std::sync::atomic::{AtomicU64, Ordering};
|
use std::sync::atomic::{AtomicU64, Ordering};
|
||||||
use std::sync::{Arc, Barrier};
|
use std::sync::{Arc, Barrier};
|
||||||
use std::time::{Duration, Instant};
|
use std::time::{Duration, Instant};
|
||||||
use turso::{Builder, Database, Result};
|
use turso::{Builder, Database, EncryptionOpts, Result};
|
||||||
|
|
||||||
#[derive(Debug, Clone)]
|
|
||||||
struct EncryptionOpts {
|
|
||||||
cipher: String,
|
|
||||||
hexkey: String,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Parser)]
|
#[derive(Parser)]
|
||||||
#[command(name = "encryption-throughput")]
|
#[command(name = "encryption-throughput")]
|
||||||
@@ -315,6 +309,14 @@ async fn setup_database(
|
|||||||
encryption_opts: &Option<EncryptionOpts>,
|
encryption_opts: &Option<EncryptionOpts>,
|
||||||
) -> Result<Database> {
|
) -> Result<Database> {
|
||||||
let builder = Builder::new_local(db_path);
|
let builder = Builder::new_local(db_path);
|
||||||
|
let builder = if let Some(opts) = encryption_opts {
|
||||||
|
builder
|
||||||
|
.experimental_encryption(true)
|
||||||
|
.with_encryption(opts.clone())
|
||||||
|
} else {
|
||||||
|
builder
|
||||||
|
};
|
||||||
|
|
||||||
let db = builder.build().await?;
|
let db = builder.build().await?;
|
||||||
let conn = db.connect()?;
|
let conn = db.connect()?;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user