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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
|
//! ref: composer/src/Composer/Repository/InstalledFilesystemRepository.php
use anyhow::Result;
use indexmap::IndexMap;
use shirabe_php_shim::Countable;
use shirabe_semver::constraint::AnyConstraint;
use crate::json::JsonFile;
use crate::package::BasePackageHandle;
use crate::package::PackageInterfaceHandle;
use crate::package::RootPackageInterfaceHandle;
use crate::repository::AdvisoryProviderInterface;
use crate::repository::FilesystemRepository;
use crate::repository::InstalledRepositoryInterface;
use crate::repository::WritableRepositoryInterface;
use crate::repository::{
FindPackageConstraint, LoadPackagesResult, ProviderInfo, RepositoryInterface, SearchResult,
};
use crate::util::Filesystem;
#[derive(Debug)]
pub struct InstalledFilesystemRepository {
inner: FilesystemRepository,
}
impl InstalledFilesystemRepository {
pub fn new(
repository_file: JsonFile,
dump_versions: bool,
root_package: Option<RootPackageInterfaceHandle>,
filesystem: Option<std::rc::Rc<std::cell::RefCell<Filesystem>>>,
) -> Result<Self> {
Ok(Self {
inner: FilesystemRepository::new(
repository_file,
dump_versions,
root_package,
filesystem,
)?,
})
}
pub fn get_repo_name(&self) -> String {
format!("installed {}", self.inner.get_repo_name())
}
}
impl InstalledRepositoryInterface for InstalledFilesystemRepository {
fn get_dev_mode(&self) -> Option<bool> {
self.inner.get_dev_mode()
}
fn is_fresh(&self) -> bool {
!self.inner.file.exists()
}
}
impl WritableRepositoryInterface for InstalledFilesystemRepository {
fn write(
&mut self,
dev_mode: bool,
installation_manager: &crate::installer::InstallationManager,
) -> anyhow::Result<()> {
todo!()
}
fn add_package(
&mut self,
package: crate::package::PackageInterfaceHandle,
) -> anyhow::Result<()> {
todo!()
}
fn remove_package(
&mut self,
package: crate::package::PackageInterfaceHandle,
) -> anyhow::Result<()> {
todo!()
}
fn get_canonical_packages(&self) -> Vec<crate::package::PackageInterfaceHandle> {
todo!()
}
fn reload(&mut self) {
todo!()
}
fn set_dev_package_names(&mut self, dev_package_names: Vec<String>) {
todo!()
}
fn get_dev_package_names(&self) -> &Vec<String> {
todo!()
}
}
impl Countable for InstalledFilesystemRepository {
fn count(&self) -> i64 {
todo!()
}
}
impl RepositoryInterface for InstalledFilesystemRepository {
fn has_package(&self, _package: PackageInterfaceHandle) -> bool {
todo!()
}
fn find_package(
&self,
_name: &str,
_constraint: FindPackageConstraint,
) -> Option<BasePackageHandle> {
todo!()
}
fn find_packages(
&self,
_name: &str,
_constraint: Option<FindPackageConstraint>,
) -> Vec<BasePackageHandle> {
todo!()
}
fn get_packages(&self) -> Vec<BasePackageHandle> {
todo!()
}
fn load_packages(
&self,
_package_name_map: IndexMap<String, Option<AnyConstraint>>,
_acceptable_stabilities: IndexMap<String, i64>,
_stability_flags: IndexMap<String, i64>,
_already_loaded: IndexMap<String, IndexMap<String, PackageInterfaceHandle>>,
) -> LoadPackagesResult {
todo!()
}
fn search(&self, _query: String, _mode: i64, _type: Option<String>) -> Vec<SearchResult> {
todo!()
}
fn get_providers(&self, _package_name: String) -> IndexMap<String, ProviderInfo> {
todo!()
}
fn get_repo_name(&self) -> String {
todo!()
}
fn as_advisory_provider(&self) -> Option<&dyn AdvisoryProviderInterface> {
None
}
fn as_any(&self) -> &dyn std::any::Any {
todo!()
}
}
|