feat(runtime): implement shared transactional memcard with async saves
Intrepid/Prometeu/Runtime/pipeline/pr-master This commit looks good
Intrepid/Prometeu/Runtime/pipeline/pr-master This commit looks good
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
//! Host region IO. Logical mapping, checksums and publication belong to the runtime.
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
pub enum MemcardIoError {
|
||||
Unavailable,
|
||||
ReadOnly,
|
||||
InvalidRange,
|
||||
NoSpace,
|
||||
Unsupported,
|
||||
IoError,
|
||||
}
|
||||
|
||||
/// Implementations return success only for a complete transfer. Errors may have
|
||||
/// partial effects. Instances stay owned by their worker until all IO has ceased.
|
||||
pub trait MemcardStorage: Send {
|
||||
fn len(&self) -> Result<u64, MemcardIoError>;
|
||||
fn is_empty(&self) -> Result<bool, MemcardIoError> {
|
||||
self.len().map(|length| length == 0)
|
||||
}
|
||||
fn read_at(&mut self, offset: u64, target: &mut [u8]) -> Result<(), MemcardIoError>;
|
||||
fn write_at(&mut self, offset: u64, source: &[u8]) -> Result<(), MemcardIoError>;
|
||||
fn sync(&mut self) -> Result<(), MemcardIoError>;
|
||||
fn read_only(&self) -> bool;
|
||||
}
|
||||
Reference in New Issue
Block a user