Compare commits

..

No commits in common. "de75ff52e2862701d2298d438dcc0f742cf9c893" and "c776f0902660db734550520d043d94a575c8db54" have entirely different histories.

View file

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