mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-10-21 12:01:38 +00:00
Major Subsystem Rewrite (Reconciler Mk5) (#217)
This commit is contained in:
parent
8e8291a0bd
commit
fea303ac8b
80 changed files with 3843 additions and 5609 deletions
32
server/src/imfs/fetcher.rs
Normal file
32
server/src/imfs/fetcher.rs
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
use std::{
|
||||
io,
|
||||
path::{Path, PathBuf},
|
||||
};
|
||||
|
||||
use crossbeam_channel::Receiver;
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
pub enum FileType {
|
||||
File,
|
||||
Directory,
|
||||
}
|
||||
|
||||
// TODO: Use our own event type instead of notify's.
|
||||
pub type ImfsEvent = notify::DebouncedEvent;
|
||||
|
||||
/// The generic interface that `Imfs` uses to lazily read files from the disk.
|
||||
/// In tests, it's stubbed out to do different versions of absolutely nothing
|
||||
/// depending on the test.
|
||||
pub trait ImfsFetcher {
|
||||
fn file_type(&mut self, path: &Path) -> io::Result<FileType>;
|
||||
fn read_children(&mut self, path: &Path) -> io::Result<Vec<PathBuf>>;
|
||||
fn read_contents(&mut self, path: &Path) -> io::Result<Vec<u8>>;
|
||||
|
||||
fn create_directory(&mut self, path: &Path) -> io::Result<()>;
|
||||
fn write_file(&mut self, path: &Path, contents: &[u8]) -> io::Result<()>;
|
||||
fn remove(&mut self, path: &Path) -> io::Result<()>;
|
||||
|
||||
fn watch(&mut self, path: &Path);
|
||||
fn unwatch(&mut self, path: &Path);
|
||||
fn receiver(&self) -> Receiver<ImfsEvent>;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue