Add store-internal cache

This commit is contained in:
Matthias Beyer 2016-01-13 21:47:23 +01:00
parent 4f8aacfa5a
commit fff41b447a

View file

@ -1,3 +1,5 @@
use std::collections::HashMap;
use std::fs::File;
use std::path::PathBuf;
use std::result::Result as RResult;
use std::sync::Arc;
@ -10,6 +12,15 @@ pub type Result<T> = RResult<T, StoreError>;
pub struct Store {
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 {