Add store-internal cache
This commit is contained in:
parent
4f8aacfa5a
commit
fff41b447a
1 changed files with 11 additions and 0 deletions
|
@ -1,3 +1,5 @@
|
||||||
|
use std::collections::HashMap;
|
||||||
|
use std::fs::File;
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
use std::result::Result as RResult;
|
use std::result::Result as RResult;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
@ -10,6 +12,15 @@ pub type Result<T> = RResult<T, StoreError>;
|
||||||
|
|
||||||
pub struct Store {
|
pub struct Store {
|
||||||
location: PathBuf,
|
location: PathBuf,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Internal Path->File cache map
|
||||||
|
*
|
||||||
|
* Caches the files, so they remain flock()ed
|
||||||
|
*
|
||||||
|
* Could be optimized for a threadsafe HashMap
|
||||||
|
*/
|
||||||
|
cache: Arc<RWLock<HashMap<PathBuf, File>>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Store {
|
impl Store {
|
||||||
|
|
Loading…
Reference in a new issue