From 84dc3857498c3824628e8c96df8a1d8e46acb94c Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Mon, 20 Feb 2017 16:03:03 +0100 Subject: [PATCH] Doc for Store::new() --- libimagstore/src/store.rs | 37 ++++++++++++++++++++++++++++++------- 1 file changed, 30 insertions(+), 7 deletions(-) diff --git a/libimagstore/src/store.rs b/libimagstore/src/store.rs index 9aab9d7f..8d05da9d 100644 --- a/libimagstore/src/store.rs +++ b/libimagstore/src/store.rs @@ -212,19 +212,42 @@ pub struct Store { pre_move_aspects : Arc>>, post_move_aspects : Arc>>, - /** - * Internal Path->File cache map - * - * Caches the files, so they remain flock()ed - * - * Could be optimized for a threadsafe HashMap - */ + /// + /// Internal Path->File cache map + /// + /// Caches the files, so they remain flock()ed + /// + /// Could be optimized for a threadsafe HashMap + /// entries: Arc>>, } impl Store { /// Create a new Store object + /// + /// This opens a Store in `location` using the configuration from `store_config` (if absent, it + /// uses defaults). + /// + /// If the configuration is not valid, this fails. + /// + /// If the location does not exist, creating directories is by default denied and the operation + /// fails, if not configured otherwise. + /// An error is returned in this case. + /// + /// If the path exists and is a file, the operation is aborted as well, an error is returned. + /// + /// After that, the store hook aspects are created and registered in the store. + /// + /// # Return values + /// + /// - On success: Store object + /// - On Failure: + /// - ConfigurationError if config is faulty + /// - IoError(FileError(CreateStoreDirDenied())) if store location does not exist and creating + /// is denied + /// - StorePathCreate(_) if creating the store directory failed + /// - StorePathExists() if location exists but is a file pub fn new(location: PathBuf, store_config: Option) -> Result { use configuration::*;