adding comments, moving technical documentation, improve Dockerfile, delete unuseful files
This commit is contained in:
@@ -1,53 +0,0 @@
|
||||
//! Benchmarks for file operations in OxiCloud
|
||||
#![feature(test)]
|
||||
|
||||
extern crate test;
|
||||
use test::{black_box, Bencher};
|
||||
|
||||
use oxicloud::application::services::file_service::{FileCreationOptions, FileService};
|
||||
use oxicloud::domain::entities::file::File;
|
||||
use std::sync::Arc;
|
||||
use tokio::runtime::Runtime;
|
||||
use uuid::Uuid;
|
||||
|
||||
/// Benchmark for creating files
|
||||
#[bench]
|
||||
fn bench_create_file(b: &mut Bencher) {
|
||||
let rt = Runtime::new().unwrap();
|
||||
|
||||
// Initialize services - this would need adaptation based on actual application structure
|
||||
let file_service = Arc::new(get_file_service());
|
||||
|
||||
let user_id = Uuid::parse_str("00000000-0000-0000-0000-000000000000").unwrap();
|
||||
let filename = "benchmark_test.txt";
|
||||
let content = "This is a test file for benchmarking".as_bytes().to_vec();
|
||||
let folder_id = Uuid::parse_str("00000000-0000-0000-0000-000000000001").unwrap();
|
||||
|
||||
b.iter(|| {
|
||||
black_box(rt.block_on(async {
|
||||
let options = FileCreationOptions {
|
||||
overwrite: true,
|
||||
..Default::default()
|
||||
};
|
||||
|
||||
// Create a file with the service
|
||||
file_service.create_file(
|
||||
user_id,
|
||||
folder_id,
|
||||
filename.to_string(),
|
||||
content.clone(),
|
||||
options,
|
||||
).await
|
||||
}))
|
||||
});
|
||||
}
|
||||
|
||||
/// Mock implementation for getting a file service instance for benchmarking
|
||||
fn get_file_service() -> FileService {
|
||||
// This is a simplified mock implementation
|
||||
// In a real benchmark, you would use actual dependencies
|
||||
FileService::new(
|
||||
// Add required repositories/services as needed
|
||||
// For illustration only - will need adaptation for actual implementation
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user