-
-
Notifications
You must be signed in to change notification settings - Fork 608
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add intermediate file system (#8631)
- Loading branch information
1 parent
3836042
commit 9e1205c
Showing
15 changed files
with
815 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
use std::fmt::Debug; | ||
|
||
use rspack_paths::Utf8Path; | ||
|
||
use super::Result; | ||
|
||
#[async_trait::async_trait] | ||
pub trait IntermediateFileSystemExtras: Debug + Send + Sync { | ||
async fn rename(&self, from: &Utf8Path, to: &Utf8Path) -> Result<()>; | ||
async fn create_read_stream(&self, file: &Utf8Path) -> Result<Box<dyn ReadStream>>; | ||
async fn create_write_stream(&self, file: &Utf8Path) -> Result<Box<dyn WriteStream>>; | ||
} | ||
|
||
#[async_trait::async_trait] | ||
pub trait ReadStream: Debug + Sync + Send { | ||
async fn read(&mut self, buf: &mut [u8]) -> Result<()>; | ||
async fn read_until(&mut self, byte: u8, buf: &mut Vec<u8>) -> Result<usize>; | ||
async fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize>; | ||
async fn skip(&mut self, offset: usize) -> Result<()>; | ||
async fn close(&mut self) -> Result<()>; | ||
} | ||
|
||
#[async_trait::async_trait] | ||
pub trait WriteStream: Debug + Sync + Send { | ||
async fn write(&mut self, buf: &[u8]) -> Result<usize>; | ||
async fn write_all(&mut self, buf: &[u8]) -> Result<()>; | ||
async fn flush(&mut self) -> Result<()>; | ||
async fn close(&mut self) -> Result<()>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
9e1205c
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📝 Benchmark detail: Open
9e1205c
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📝 Ran ecosystem CI: Open