mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-04-25 23:26:19 +00:00
Choose 'memofs' as the vfs name
This commit is contained in:
@@ -5,7 +5,7 @@ authors = ["Lucien Greathouse <me@lpghatguy.com>"]
|
|||||||
edition = "2018"
|
edition = "2018"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
homepage = "https://github.com/rojo-rbx/rojo"
|
homepage = "https://github.com/rojo-rbx/rojo/tree/master/vfs"
|
||||||
|
|
||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,18 @@
|
|||||||
# [vfs]
|
# vfs
|
||||||
Name pending. Implementation of a virtual filesystem with a configurable backend and file watching.
|
Implementation of a virtual filesystem with a configurable backend and file watching.
|
||||||
|
|
||||||
|
memofs is currently an unstable minimum viable library. Its primary consumer is [Rojo](https://github.com/rojo-rbx/rojo), a build system for Roblox.
|
||||||
|
|
||||||
|
### Current Features
|
||||||
|
* API similar to `std::fs`
|
||||||
|
* Configurable backends
|
||||||
|
* `StdBackend`, which uses `std::fs` and the `notify` crate
|
||||||
|
* `NoopBackend`, which always throws errors
|
||||||
|
* `InMemoryFs`, a simple in-memory filesystem useful for testing
|
||||||
|
|
||||||
|
### Future Features
|
||||||
|
* Hash-based hierarchical memoization keys (hence the name)
|
||||||
|
* Configurable caching (write-through, write-around, write-back)
|
||||||
|
|
||||||
## License
|
## License
|
||||||
[vfs] is available under the terms of the MIT license. See [LICENSE.txt](LICENSE.txt) or <https://opensource.org/licenses/MIT> for more details.
|
memofs is available under the terms of the MIT license. See [LICENSE.txt](LICENSE.txt) or <https://opensource.org/licenses/MIT> for more details.
|
||||||
|
|||||||
7
vfs/README.tpl
Normal file
7
vfs/README.tpl
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
# {{crate}}
|
||||||
|
[](https://crates.io/crates/memofs)
|
||||||
|
|
||||||
|
{{readme}}
|
||||||
|
|
||||||
|
## License
|
||||||
|
memofs is available under the terms of the MIT license. See [LICENSE.txt](LICENSE.txt) or <https://opensource.org/licenses/MIT> for more details.
|
||||||
@@ -1,3 +1,20 @@
|
|||||||
|
/*!
|
||||||
|
Implementation of a virtual filesystem with a configurable backend and file watching.
|
||||||
|
|
||||||
|
memofs is currently an unstable minimum viable library. Its primary consumer is [Rojo](https://github.com/rojo-rbx/rojo), a build system for Roblox.
|
||||||
|
|
||||||
|
## Current Features
|
||||||
|
* API similar to `std::fs`
|
||||||
|
* Configurable backends
|
||||||
|
* `StdBackend`, which uses `std::fs` and the `notify` crate
|
||||||
|
* `NoopBackend`, which always throws errors
|
||||||
|
* `InMemoryFs`, a simple in-memory filesystem useful for testing
|
||||||
|
|
||||||
|
## Future Features
|
||||||
|
* Hash-based hierarchical memoization keys (hence the name)
|
||||||
|
* Configurable caching (write-through, write-around, write-back)
|
||||||
|
*/
|
||||||
|
|
||||||
mod in_memory_fs;
|
mod in_memory_fs;
|
||||||
mod noop_backend;
|
mod noop_backend;
|
||||||
mod snapshot;
|
mod snapshot;
|
||||||
@@ -178,6 +195,10 @@ impl VfsInner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// A virtual filesystem with a configurable backend.
|
/// A virtual filesystem with a configurable backend.
|
||||||
|
///
|
||||||
|
/// All operations on the Vfs take a lock on an internal backend. For performing
|
||||||
|
/// large batches of operations, it might be more performant to call `lock()`
|
||||||
|
/// and use [`VfsLock`](struct.VfsLock.html) instead.
|
||||||
pub struct Vfs {
|
pub struct Vfs {
|
||||||
inner: Mutex<VfsInner>,
|
inner: Mutex<VfsInner>,
|
||||||
}
|
}
|
||||||
@@ -199,6 +220,7 @@ impl Vfs {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Manually lock the Vfs, useful for large batches of operations.
|
||||||
pub fn lock(&self) -> VfsLock<'_> {
|
pub fn lock(&self) -> VfsLock<'_> {
|
||||||
VfsLock {
|
VfsLock {
|
||||||
inner: self.inner.lock().unwrap(),
|
inner: self.inner.lock().unwrap(),
|
||||||
@@ -286,7 +308,9 @@ impl Vfs {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A locked handle to a `Vfs`, created by `Vfs::lock`.
|
/// A locked handle to a [`Vfs`](struct.Vfs.html), created by `Vfs::lock`.
|
||||||
|
///
|
||||||
|
/// Implements roughly the same API as [`Vfs`](struct.Vfs.html).
|
||||||
pub struct VfsLock<'a> {
|
pub struct VfsLock<'a> {
|
||||||
inner: MutexGuard<'a, VfsInner>,
|
inner: MutexGuard<'a, VfsInner>,
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user