Skip to content

Commit

Permalink
feat(mock): multithreaded mocking start implement
Browse files Browse the repository at this point in the history
  • Loading branch information
wilhelmagren committed Feb 5, 2024
1 parent 50ad3fb commit a71faf4
Showing 1 changed file with 19 additions and 4 deletions.
23 changes: 19 additions & 4 deletions src/mock.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* MIT License
*
* Copyright (c) 2023 Firelink Data
* Copyright (c) 2024 Firelink Data
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand All @@ -21,8 +21,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
* File created: 2023-11-28
* Last updated: 2023-12-22
* File created: 2024-02-05
* Last updated: 2024-02-05
*/

use crate::schema::{self, FixedSchema};
Expand All @@ -34,12 +34,27 @@ use std::fs::OpenOptions;
use std::io::Write;
use std::path::PathBuf;
use std::sync::Arc;
use std::thread;
use std::{thread, usize};
use std::time::SystemTime;

pub(crate) static DEFAULT_MOCKED_FILENAME_LEN: usize = 16;
pub(crate) static DEFAULT_ROW_BUFFER_LEN: usize = 1024 * 1024;

pub struct Mocker {
schema: schema::FixedSchema,

Check warning on line 44 in src/mock.rs

View workflow job for this annotation

GitHub Actions / Cargo check (ubuntu-latest, stable)

fields `schema` and `target_file` are never read

Check warning on line 44 in src/mock.rs

View workflow job for this annotation

GitHub Actions / Cargo check (ubuntu-latest, nightly)

fields `schema` and `target_file` are never read

Check warning on line 44 in src/mock.rs

View workflow job for this annotation

GitHub Actions / Cargo check (windows-latest, nightly)

fields `schema` and `target_file` are never read

Check warning on line 44 in src/mock.rs

View workflow job for this annotation

GitHub Actions / Cargo check (macos-latest, stable)

fields `schema` and `target_file` are never read

Check warning on line 44 in src/mock.rs

View workflow job for this annotation

GitHub Actions / Cargo check (windows-latest, stable)

fields `schema` and `target_file` are never read

Check warning on line 44 in src/mock.rs

View workflow job for this annotation

GitHub Actions / Cargo check (macos-latest, nightly)

fields `schema` and `target_file` are never read
target_file: Option<PathBuf>,
}

impl Mocker {
pub fn new(schema: schema::FixedSchema, target_file: Option<PathBuf>) -> Self {
Self { schema, target_file }
}

pub fn generate(&self, n_rows: usize, multithreaded: bool) {

Check warning on line 53 in src/mock.rs

View workflow job for this annotation

GitHub Actions / Cargo check (ubuntu-latest, stable)

unused variable: `n_rows`

Check warning on line 53 in src/mock.rs

View workflow job for this annotation

GitHub Actions / Cargo check (ubuntu-latest, stable)

unused variable: `multithreaded`

Check warning on line 53 in src/mock.rs

View workflow job for this annotation

GitHub Actions / Cargo check (ubuntu-latest, nightly)

unused variable: `n_rows`

Check warning on line 53 in src/mock.rs

View workflow job for this annotation

GitHub Actions / Cargo check (ubuntu-latest, nightly)

unused variable: `multithreaded`

Check warning on line 53 in src/mock.rs

View workflow job for this annotation

GitHub Actions / Cargo check (windows-latest, nightly)

unused variable: `n_rows`

Check warning on line 53 in src/mock.rs

View workflow job for this annotation

GitHub Actions / Cargo check (windows-latest, nightly)

unused variable: `multithreaded`

Check warning on line 53 in src/mock.rs

View workflow job for this annotation

GitHub Actions / Cargo check (macos-latest, stable)

unused variable: `n_rows`

Check warning on line 53 in src/mock.rs

View workflow job for this annotation

GitHub Actions / Cargo check (macos-latest, stable)

unused variable: `multithreaded`

Check warning on line 53 in src/mock.rs

View workflow job for this annotation

GitHub Actions / Cargo check (windows-latest, stable)

unused variable: `n_rows`

Check warning on line 53 in src/mock.rs

View workflow job for this annotation

GitHub Actions / Cargo check (windows-latest, stable)

unused variable: `multithreaded`

Check warning on line 53 in src/mock.rs

View workflow job for this annotation

GitHub Actions / Cargo check (macos-latest, nightly)

unused variable: `n_rows`

Check warning on line 53 in src/mock.rs

View workflow job for this annotation

GitHub Actions / Cargo check (macos-latest, nightly)

unused variable: `multithreaded`
todo!()
}
}

///
pub struct FixedMocker {
schema: schema::FixedSchema,
Expand Down

0 comments on commit a71faf4

Please sign in to comment.