mirror of
https://github.com/aljazceru/turso.git
synced 2026-02-23 17:05:36 +01:00
adjust remaining calculation to use the profile
This commit is contained in:
@@ -9,29 +9,48 @@ pub struct QueryProfile {
|
||||
#[garde(dive)]
|
||||
pub gen_opts: Opts,
|
||||
#[garde(skip)]
|
||||
pub create_table: bool,
|
||||
/// Effectively the weight of how many select operations we want
|
||||
pub read_weight: u32,
|
||||
#[garde(skip)]
|
||||
pub create_index: bool,
|
||||
pub write_weight: u32,
|
||||
// All weights below are only going to be sampled when we determine we are doing a write operation,
|
||||
// meaning we first sample between `read_weight` and `write_weight`, and if we a write_weight we will then sample the weights below
|
||||
#[garde(skip)]
|
||||
pub insert: bool,
|
||||
pub create_table_weight: u32,
|
||||
#[garde(skip)]
|
||||
pub update: bool,
|
||||
pub create_index_weight: u32,
|
||||
#[garde(skip)]
|
||||
pub delete: bool,
|
||||
pub insert_weight: u32,
|
||||
#[garde(skip)]
|
||||
pub drop_table: bool,
|
||||
pub update_weight: u32,
|
||||
#[garde(skip)]
|
||||
pub delete_weight: u32,
|
||||
#[garde(skip)]
|
||||
pub drop_table_weight: u32,
|
||||
}
|
||||
|
||||
impl Default for QueryProfile {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
gen_opts: Opts::default(),
|
||||
create_table: true,
|
||||
create_index: true,
|
||||
insert: true,
|
||||
update: true,
|
||||
delete: true,
|
||||
drop_table: true,
|
||||
read_weight: 60,
|
||||
write_weight: 50,
|
||||
create_table_weight: 15,
|
||||
create_index_weight: 5,
|
||||
insert_weight: 30,
|
||||
update_weight: 20,
|
||||
delete_weight: 20,
|
||||
drop_table_weight: 2,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, strum::VariantArray)]
|
||||
pub enum QueryTypes {
|
||||
CreateTable,
|
||||
CreateIndex,
|
||||
Insert,
|
||||
Update,
|
||||
Delete,
|
||||
DropTable,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user