Compare commits

...

2 commits

Author SHA1 Message Date
de75ff52e2
pedantic clippy 2021-04-09 22:02:08 -04:00
109a0850f9
fixed imports 2021-04-09 22:00:59 -04:00

View file

@ -1,8 +1,10 @@
use std::collections::HashMap;
use std::path::{Path, PathBuf};
use std::pin::Pin;
use std::sync::atomic::{AtomicU8, Ordering};
use std::sync::Arc;
use std::task::{Context, Poll};
use std::{collections::HashMap, path::PathBuf};
use std::{path::Path, sync::atomic::Ordering};
use std::{pin::Pin, sync::atomic::AtomicU8};
use std::{sync::Arc, time::Duration};
use std::time::Duration;
use bytes::{Bytes, BytesMut};
use futures::{Future, Stream, StreamExt};
@ -21,7 +23,7 @@ pub async fn transparent_file_stream(
mut byte_stream: impl Stream<Item = Result<Bytes, Error>> + Unpin + Send + 'static,
) -> Result<impl Stream<Item = Result<Bytes, UpstreamError>>, std::io::Error> {
if let Some(arc) = WRITING_STATUS.read().get(path) {
FromFsStream::new(path, Arc::clone(&arc)).await
FromFsStream::new(path, Arc::clone(arc)).await
} else {
let done_writing_flag = Arc::new(CacheStatus::new());
@ -119,7 +121,7 @@ struct CacheStatus(AtomicU8);
impl CacheStatus {
#[inline]
fn new() -> Self {
const fn new() -> Self {
Self(AtomicU8::new(WritingStatus::NotDone as u8))
}