1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
//! `RepositoryProvider` trait — application-layer abstraction for repository creation
//!
//! Defines the port that the application layer uses to create environment repositories
//! without depending on any concrete infrastructure type.
//!
//! The infrastructure layer implements this trait for `FileRepositoryFactory`.
//! The bootstrap layer creates the concrete implementation and injects it.
use PathBuf;
use Arc;
use crateEnvironmentRepository;
/// Application-layer trait for creating environment repositories.
///
/// This trait abstracts over the concrete `FileRepositoryFactory` from the
/// infrastructure layer, allowing the application layer and SDK to hold a
/// `Arc<dyn RepositoryProvider>` without a compile-time dependency on any
/// infrastructure type.
///
/// The bootstrap layer provides the default implementation via
/// `crate::infrastructure::persistence::file_repository_factory::FileRepositoryFactory`.
///
/// # Examples
///
/// ```rust,no_run
/// use std::path::PathBuf;
/// use std::sync::Arc;
/// use torrust_tracker_deployer_lib::application::traits::RepositoryProvider;
///
/// fn list_all_environments(
/// provider: Arc<dyn RepositoryProvider>,
/// data_dir: PathBuf,
/// ) {
/// let repo = provider.create(data_dir.clone());
/// // use repo ...
/// drop(repo);
/// }
/// ```