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

Move I/O to another repository #112

Merged
merged 45 commits into from
Oct 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
9e919d6
win:ReadFile,ReadFileEx
sergey-shandar Oct 21, 2023
2d6a6b8
file flags
sergey-shandar Oct 22, 2023
3434b70
windows
sergey-shandar Oct 22, 2023
61186bc
another try
sergey-shandar Oct 22, 2023
8b177f9
read and write with non-blocking API
sergey-shandar Oct 22, 2023
27ba1b8
test.txt
sergey-shandar Oct 22, 2023
745dfee
fmt
sergey-shandar Oct 22, 2023
13ca7ad
windows only
sergey-shandar Oct 22, 2023
19cfec0
operation
sergey-shandar Oct 22, 2023
4c4f105
Overlapped::default()
sergey-shandar Oct 22, 2023
423fa25
posix
sergey-shandar Oct 23, 2023
ee41fb6
but coverage fails
sergey-shandar Oct 23, 2023
5994f44
fmt
sergey-shandar Oct 23, 2023
6e3c143
os
sergey-shandar Oct 23, 2023
63ceb37
family
sergey-shandar Oct 23, 2023
97c9f2d
posix
sergey-shandar Oct 23, 2023
7839587
posix
sergey-shandar Oct 23, 2023
6948c47
fmt
sergey-shandar Oct 23, 2023
0c519c4
644
sergey-shandar Oct 23, 2023
f886745
common function
sergey-shandar Oct 23, 2023
43dde28
no r
sergey-shandar Oct 23, 2023
4db1afc
Operation
sergey-shandar Oct 24, 2023
c0ad081
CStr
sergey-shandar Oct 24, 2023
cb3d5b5
Windows with OperationResult
sergey-shandar Oct 24, 2023
bd38052
fmt
sergey-shandar Oct 27, 2023
f97375f
async_io fpr posix
sergey-shandar Oct 27, 2023
8c2c5bd
real_async_io
sergey-shandar Oct 27, 2023
cd02bcd
real_async_io with Windows
sergey-shandar Oct 27, 2023
b2d0e92
with Posix
sergey-shandar Oct 27, 2023
14c931c
unix
sergey-shandar Oct 27, 2023
c800e01
fmt
sergey-shandar Oct 27, 2023
df3e1ee
remove duplicate tests
sergey-shandar Oct 27, 2023
6886a92
get_result
sergey-shandar Oct 27, 2023
ec7c077
cargo n
sergey-shandar Oct 27, 2023
9fbfc26
io-trait
sergey-shandar Oct 27, 2023
78afc62
io_impl
sergey-shandar Oct 27, 2023
4dd582a
no IO and Virtual IO
sergey-shandar Oct 27, 2023
f5faf1e
async in io-trait
sergey-shandar Oct 27, 2023
3dfedfa
Async
sergey-shandar Oct 27, 2023
cf661bd
fmt
sergey-shandar Oct 27, 2023
56343be
Merge branch 'async_io' of https://github.com/datablockset/blockset i…
sergey-shandar Oct 27, 2023
ac0a155
unix
sergey-shandar Oct 27, 2023
a50ca3a
io_test 0.2.0
sergey-shandar Oct 27, 2023
7096b04
cargo n
sergey-shandar Oct 27, 2023
9a058a6
remove libc
sergey-shandar Oct 27, 2023
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ Cargo.lock
tarpaulin-report.html
cdt0
.DS_Store
_*
3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ authors = ["Sergey Shandar"]
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
io-trait = "0.1.4"
io-impl = "0.1.5"

[dev-dependencies]
io-test = "0.2.0"
wasm-bindgen-test = "0.3.37"
16 changes: 8 additions & 8 deletions src/app.rs
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
use std::io::{self, Read, Write};

use io_trait::{DirEntry, Io, Metadata};

use crate::{
base32::{StrEx, ToBase32},
file_table::{FileTable, CDT0, PARTS, ROOTS},
io::{DirEntry, Io},
level_storage::LevelStorage,
state::{mb, progress, State},
storage::{Null, Storage},
table::{Table, Type},
tree::Tree,
u224::U224,
Metadata,
};

trait ResultEx {
Expand Down Expand Up @@ -153,15 +153,15 @@ pub fn run(io: &impl Io) -> Result<(), String> {

#[cfg(test)]
mod test {
use io_test::VirtualIo;
use io_trait::Io;
use wasm_bindgen_test::wasm_bindgen_test;

use crate::{
base32::ToBase32,
run,
sha224::{compress, compress_one},
u256::{to_u224, U256},
virtual_io::VirtualIo,
Io,
};

#[wasm_bindgen_test]
Expand Down Expand Up @@ -216,7 +216,7 @@ mod test {
0x68000000_00000000_00000000_00000000,
];
let s = to_u224(&compress([d, [0, 0]])).unwrap().to_base32();
assert_eq!(io.stdout.to_string(), s + "\n");
assert_eq!(io.stdout.to_stdout(), s + "\n");
}

#[wasm_bindgen_test]
Expand All @@ -231,7 +231,7 @@ mod test {
0x68000000_00000000_00000000_00000000,
];
let s = compress_one(&d).to_base32();
assert_eq!(io.stdout.to_string(), s.clone() + "\n");
assert_eq!(io.stdout.to_stdout(), s.clone() + "\n");
let v = io
.read(&("cdt0/roots/".to_owned() + &s[..2] + "/" + &s[2..4] + "/" + &s[4..]))
.unwrap();
Expand Down Expand Up @@ -287,7 +287,7 @@ mod test {
assert_eq!(e, Ok(()));
let d: U256 = [0, 0];
let s = compress_one(&d).to_base32();
assert_eq!(io.stdout.to_string(), s.clone() + "\n");
assert_eq!(io.stdout.to_stdout(), s.clone() + "\n");
}

#[wasm_bindgen_test]
Expand All @@ -305,7 +305,7 @@ mod test {
io.write("a.txt", src.as_bytes()).unwrap();
let e = run(&mut io);
assert_eq!(e, Ok(()));
let x = &io.stdout.to_string()[..45];
let x = &io.stdout.to_stdout()[..45];
io.args = ["blockset", "get", x, "b.txt"]
.iter()
.map(|s| s.to_string())
Expand Down
3 changes: 2 additions & 1 deletion src/file_table.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
use std::io;

use io_trait::Io;

use crate::{
base32::ToBase32,
table::{Table, Type},
u224::U224,
Io,
};

pub struct FileTable<'a, T: Io>(pub &'a T);
Expand Down
134 changes: 0 additions & 134 deletions src/io.rs

This file was deleted.

6 changes: 0 additions & 6 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@ mod base32;
mod bit_vec;
mod digest;
mod file_table;
mod io;
mod level_storage;
mod real_io;
mod sha224;
mod sigma32;
mod state;
Expand All @@ -25,9 +23,5 @@ mod u512;
mod mem_table;
#[cfg(test)]
mod static_assert;
#[cfg(test)]
mod virtual_io;

pub use app::run;
pub use io::{Io, Metadata};
pub use real_io::RealIo;
3 changes: 2 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use blockset::{run, RealIo};
use blockset::run;
use io_impl::RealIo;

fn main() -> Result<(), String> {
run(&RealIo::default())
Expand Down
68 changes: 0 additions & 68 deletions src/real_io.rs

This file was deleted.

Loading