Skip to content

Commit

Permalink
Merge 'Simulator cleanups' from Pekka Enberg
Browse files Browse the repository at this point in the history
Reviewed-by: Pere Diaz Bou <[email protected]>

Closes #410
  • Loading branch information
penberg committed Nov 20, 2024
2 parents c4d4136 + f8667bb commit a23aa16
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
4 changes: 2 additions & 2 deletions core/storage/btree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ use log::debug;

use crate::storage::pager::{Page, Pager};
use crate::storage::sqlite3_ondisk::{
read_btree_cell, read_record, read_varint, write_varint, BTreeCell, DatabaseHeader,
PageContent, PageType, TableInteriorCell, TableLeafCell,
read_btree_cell, read_varint, write_varint, BTreeCell, DatabaseHeader, PageContent, PageType,
TableInteriorCell, TableLeafCell,
};
use crate::types::{Cursor, CursorResult, OwnedRecord, OwnedValue, SeekKey, SeekOp};
use crate::Result;
Expand Down
12 changes: 4 additions & 8 deletions simulator/main.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
use limbo_core::{
Connection, Database, File, LimboError, OpenFlags, PlatformIO, Result, Row, RowResult, IO,
};
use limbo_core::{Connection, Database, File, OpenFlags, PlatformIO, Result, RowResult, IO};
use log;
use rand::prelude::*;
use rand_chacha::ChaCha8Rng;
Expand All @@ -9,7 +7,7 @@ use std::rc::Rc;
use std::sync::Arc;
use tempfile::TempDir;

use anarchist_readable_name_generator_lib::{readable_name, readable_name_custom};
use anarchist_readable_name_generator_lib::readable_name_custom;

struct SimulatorEnv {
opts: SimulatorOpts,
Expand All @@ -31,7 +29,6 @@ struct SimulatorOpts {
ticks: usize,
max_connections: usize,
max_tables: usize,
seed: u64,
// this next options are the distribution of workload where read_percent + write_percent +
// delete_percent == 100%
read_percent: usize,
Expand Down Expand Up @@ -96,7 +93,6 @@ fn main() {
max_connections: 1, // TODO: for now let's use one connection as we didn't implement
// correct transactions procesing
max_tables: rng.gen_range(0..128),
seed,
read_percent,
write_percent,
delete_percent,
Expand Down Expand Up @@ -345,8 +341,8 @@ fn get_all_rows(
limbo_core::Value::Null => Value::Null,
limbo_core::Value::Integer(i) => Value::Integer(*i),
limbo_core::Value::Float(f) => Value::Float(*f),
limbo_core::Value::Text(t) => Value::Text(t.clone().to_owned()),
limbo_core::Value::Blob(b) => Value::Blob(b.clone().to_owned()),
limbo_core::Value::Text(t) => Value::Text(t.to_string()),
limbo_core::Value::Blob(b) => Value::Blob(b.to_vec()),
};
r.push(v);
}
Expand Down

0 comments on commit a23aa16

Please sign in to comment.