New Imfs event type

This commit is contained in:
Lucien Greathouse 2019-10-01 11:29:09 -07:00
parent 1737da9c1f
commit 694b6101ca
3 changed files with 49 additions and 25 deletions

View file

@ -48,32 +48,17 @@ impl<F: ImfsFetcher> Imfs<F> {
}
pub fn commit_change(&mut self, event: &ImfsEvent) -> FsResult<()> {
use notify::DebouncedEvent::*;
use ImfsEvent::*;
log::trace!("Committing Imfs change {:?}", event);
match event {
Create(path) => {
Created(path) | Modified(path) => {
self.raise_file_changed(path)?;
}
Write(path) => {
self.raise_file_changed(path)?;
}
Remove(path) => {
Removed(path) => {
self.raise_file_removed(path)?;
}
Rename(from_path, to_path) => {
self.raise_file_removed(from_path)?;
self.raise_file_changed(to_path)?;
}
Error(err, path) => {
log::warn!("Filesystem error detected: {:?} on path {:?}", err, path);
}
Rescan => {
// FIXME: Implement rescanning
log::warn!("Unhandled filesystem rescan event");
}
NoticeWrite(_) | NoticeRemove(_) | Chmod(_) => {}
}
Ok(())