Updated database structure

- Using Slotted Pages
- Using compression
- Using file locking to prevent race conditions
This commit is contained in:
euzu
2025-12-29 13:12:39 +01:00
parent d95932227e
commit 59c95fde3a
6 changed files with 506 additions and 96 deletions
+24 -20
View File
@@ -205,32 +205,36 @@ mod tests {
#[test]
fn test_read_json_file_into_struct() {
let file_content = fs::read_to_string("/tmp/series-info.json").expect("Unable to read file");
match serde_json::from_str::<XtreamSeriesInfo>(&file_content) {
Ok(series_info) => {
println!("{:#?}", series_info);
assert!(true);
}
Err(err) => {
assert!(false, "Failed to parse json file: {err}");
if fs::exists("/tmp/series-info.json").unwrap_or(false) {
let file_content = fs::read_to_string("/tmp/series-info.json").expect("Unable to read file");
match serde_json::from_str::<XtreamSeriesInfo>(&file_content) {
Ok(series_info) => {
println!("{:#?}", series_info);
assert!(true);
}
Err(err) => {
assert!(false, "Failed to parse json file: {err}");
}
}
}
}
#[tokio::test]
async fn test_read_json_stream_into_struct() -> std::io::Result<()> {
let reader = Box::pin(async_file_reader(tokio::fs::File::open("/tmp/vod_streams.json").await?));
match map_to_xtream_streams(XtreamCluster::Video, reader).await {
Ok(_streams) => {
println!("{:?}", _streams.get(1));
println!("{:?}", _streams.get(100));
println!("{:?}", _streams.get(200));
assert!(true);
}
Err(err) => {
assert!(false, "Failed to parse json file: {err}");
}
};
if fs::exists("/tmp/vod_streams.json").unwrap_or(false) {
let reader = Box::pin(async_file_reader(tokio::fs::File::open("/tmp/vod_streams.json").await?));
match map_to_xtream_streams(XtreamCluster::Video, reader).await {
Ok(_streams) => {
println!("{:?}", _streams.get(1));
println!("{:?}", _streams.get(100));
println!("{:?}", _streams.get(200));
assert!(true);
}
Err(err) => {
assert!(false, "Failed to parse json file: {err}");
}
};
}
Ok(())
}
}