datastore: make unsafe functions only visible in their own crate

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
Thomas Lamprecht 2022-06-03 13:42:42 +02:00
parent f418f4e48b
commit 615a50c108
1 changed files with 5 additions and 4 deletions

View File

@ -65,7 +65,7 @@ pub struct DataStoreImpl {
impl DataStoreImpl { impl DataStoreImpl {
// This one just panics on everything // This one just panics on everything
#[doc(hidden)] #[doc(hidden)]
pub unsafe fn new_test() -> Arc<Self> { pub(crate) unsafe fn new_test() -> Arc<Self> {
Arc::new(Self { Arc::new(Self {
chunk_store: Arc::new(unsafe { ChunkStore::panic_store() }), chunk_store: Arc::new(unsafe { ChunkStore::panic_store() }),
gc_mutex: Mutex::new(()), gc_mutex: Mutex::new(()),
@ -112,7 +112,7 @@ impl Drop for DataStore {
impl DataStore { impl DataStore {
// This one just panics on everything // This one just panics on everything
#[doc(hidden)] #[doc(hidden)]
pub unsafe fn new_test() -> Arc<Self> { pub(crate) unsafe fn new_test() -> Arc<Self> {
Arc::new(Self { Arc::new(Self {
inner: unsafe { DataStoreImpl::new_test() }, inner: unsafe { DataStoreImpl::new_test() },
operation: None, operation: None,
@ -180,7 +180,8 @@ impl DataStore {
/// ///
/// # Safety /// # Safety
/// See the safety section in `open_from_config` /// See the safety section in `open_from_config`
pub unsafe fn open_path( #[allow(dead_code)]
pub(crate) unsafe fn open_path(
name: &str, name: &str,
path: impl AsRef<Path>, path: impl AsRef<Path>,
operation: Option<Operation>, operation: Option<Operation>,
@ -202,7 +203,7 @@ impl DataStore {
/// chunkstore's process locker will close all locks from our process on the config.path, /// chunkstore's process locker will close all locks from our process on the config.path,
/// breaking guarantees we need to uphold for safe long backup + GC interaction on newer/older /// breaking guarantees we need to uphold for safe long backup + GC interaction on newer/older
/// process instances (from package update). /// process instances (from package update).
pub unsafe fn open_from_config( pub(crate) unsafe fn open_from_config(
config: DataStoreConfig, config: DataStoreConfig,
operation: Option<Operation>, operation: Option<Operation>,
) -> Result<Arc<Self>, Error> { ) -> Result<Arc<Self>, Error> {