reader/writer rename

This commit is contained in:
Dmitry Belyaev 2022-09-20 14:35:47 +03:00
parent d77e164d07
commit 61587132a3
Signed by: b4tman
GPG Key ID: 41A00BF15EA7E5F3

View File

@ -279,7 +279,8 @@ struct WriteQueueItem {
type WriteQueue = Arc<Mutex<VecDeque<Option<WriteQueueItem>>>>;
async fn data_reader(queue: WriteQueue) {
/// read txt files from zip and convert to json
async fn reader_converter(queue: WriteQueue) {
// open archive just to list files
let archive = ZipFileReader::new(String::from(INPUT_FILENAME))
.await
@ -315,7 +316,9 @@ async fn data_reader(queue: WriteQueue) {
println!("convert done ✅");
}
async fn data_writer(queue: WriteQueue) {
/// write json data to zip files
async fn zip_writer(queue: WriteQueue) {
let mut file = fs::File::create(OUTPUT_FILENAME).await.unwrap();
let mut writer = ZipFileWriter::new(&mut file);
@ -370,8 +373,8 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
let queue_w = Arc::clone(&queue);
tokio::try_join!(
tokio::spawn(data_reader(queue_r)),
tokio::spawn(data_writer(queue_w))
tokio::spawn(reader_converter(queue_r)),
tokio::spawn(zip_writer(queue_w))
)?;
println!("all done ✅");