From b66371f79b22fd017faacbc7120306b916bd2776 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Sun, 2 Dec 2018 23:52:14 +0100 Subject: Rewrite Store::new* API: libimagstore does not export backend types With this change applied, libimagstore does not export backend representing types anymore. This change is necessar because when we want to switch the `StoreId` implementation from "complex and stateful" to "Stateless and Cow<'_, &str>", we need to be able to have a type which represents a "`StoreId` plus the path of the Store itself". This "the path of the Store itself" is passed around as reference, to minimize runtime impact. Because such a type should not be exported by the libimagstore crate, we make it `pub(crate)` internally. But because the backend APIs also have to use this type, we would export the (private) type in the APIs of the backend. Because of that we make the backend API also non-visible to crate users, which also decreases the surface of the libimagstore API itself. Besides: Remove function `Link::with_base()` which is not needed anymore (was used in tests only). Signed-off-by: Matthias Beyer --- lib/core/libimagrt/src/runtime.rs | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'lib/core/libimagrt') diff --git a/lib/core/libimagrt/src/runtime.rs b/lib/core/libimagrt/src/runtime.rs index 8fb59022..e5fd4041 100644 --- a/lib/core/libimagrt/src/runtime.rs +++ b/lib/core/libimagrt/src/runtime.rs @@ -22,7 +22,6 @@ use std::process::Command; use std::env; use std::process::exit; use std::io::Stdin; -use std::sync::Arc; use std::io::StdoutLock; use std::borrow::Borrow; use std::result::Result as RResult; @@ -48,7 +47,6 @@ use libimagerror::trace::*; use libimagerror::io::ToExitCode; use libimagstore::store::Store; use libimagstore::storeid::StoreId; -use libimagstore::file_abstraction::InMemoryFileAbstraction; use libimagutil::debug_result::DebugResult; use spec::CliSpec; use atty; @@ -143,9 +141,7 @@ impl<'a> Runtime<'a> { trace!("Config = {:#?}", config); let store_result = if cli_app.use_inmemory_fs() { - Store::new_with_backend(storepath, - &config, - Arc::new(InMemoryFileAbstraction::default())) + Store::new_inmemory(storepath, &config) } else { Store::new(storepath, &config) }; -- cgit v1.2.3 From 642702b724e365ae67974bf4a0387dd54948f6e9 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Wed, 5 Dec 2018 19:01:42 +0100 Subject: Rewrite: StoreId::new_baseless() -> StoreId::new() Signed-off-by: Matthias Beyer --- lib/core/libimagrt/src/runtime.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/core/libimagrt') diff --git a/lib/core/libimagrt/src/runtime.rs b/lib/core/libimagrt/src/runtime.rs index e5fd4041..4f2a485f 100644 --- a/lib/core/libimagrt/src/runtime.rs +++ b/lib/core/libimagrt/src/runtime.rs @@ -414,7 +414,7 @@ impl<'a> Runtime<'a> { trace!("Got IDs = {}", buf); buf.lines() .map(PathBuf::from) - .map(|id| StoreId::new_baseless(id).map_err(Error::from)) + .map(|id| StoreId::new(id).map_err(Error::from)) .collect() }) } else { -- cgit v1.2.3