Skip to content

Commit c260c5d

Browse files
Dragyxfaukah
authored andcommitted
Remove dependency graph query.
This query was never actually used by dix. We can include it again if we ever need it.
1 parent b756685 commit c260c5d

File tree

6 files changed

+0
-85
lines changed

6 files changed

+0
-85
lines changed

src/lib.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,6 @@ mod store;
3434
pub mod version;
3535
use version::Version;
3636

37-
#[derive(Deref, Debug, Clone, Copy, PartialEq, Eq, Hash)]
38-
struct DerivationId(i64);
39-
4037
/// A validated store path. Always starts with `/nix/store`.
4138
///
4239
/// Can be created using `StorePath::try_from(path_buf)`.

src/store.rs

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ use log::warn;
2626
use size::Size;
2727

2828
use crate::{
29-
DerivationId,
3029
StorePath,
3130
store::{
3231
db_eager::EagerDBConnection,
@@ -62,11 +61,6 @@ pub trait StoreBackend<'a> {
6261
&self,
6362
path: &Path,
6463
) -> Result<Box<dyn Iterator<Item = StorePath> + '_>>;
65-
#[expect(dead_code)]
66-
fn query_dependency_graph(
67-
&self,
68-
path: &Path,
69-
) -> Result<Box<dyn Iterator<Item = (DerivationId, DerivationId)> + '_>>;
7064
}
7165

7266
/// wrapper trait for debug information
@@ -243,16 +237,6 @@ impl<'a> StoreBackend<'a> for CombinedStoreBackend<'a> {
243237
self
244238
.fallback_query(|backend, path| (**backend).query_dependents(path), path)
245239
}
246-
247-
fn query_dependency_graph(
248-
&self,
249-
path: &Path,
250-
) -> Result<Box<dyn Iterator<Item = (DerivationId, DerivationId)> + '_>> {
251-
self.fallback_query(
252-
|backend, path| (**backend).query_dependency_graph(path),
253-
path,
254-
)
255-
}
256240
}
257241

258242
#[cfg(test)]
@@ -331,14 +315,6 @@ mod test {
331315
) -> Result<Box<dyn Iterator<Item = StorePath> + '_>> {
332316
unimplemented!()
333317
}
334-
335-
fn query_dependency_graph(
336-
&self,
337-
_path: &Path,
338-
) -> Result<Box<dyn Iterator<Item = (DerivationId, DerivationId)> + '_>>
339-
{
340-
unimplemented!()
341-
}
342318
}
343319

344320
#[test]

src/store/db_eager.rs

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ use anyhow::{
1313
use rusqlite::Row;
1414

1515
use crate::{
16-
DerivationId,
1716
StorePath,
1817
path_to_canonical_string,
1918
store::{
@@ -116,17 +115,4 @@ impl<'a> StoreBackend<'a> for EagerDBConnection<'_> {
116115
Ok(StorePath(row.get::<_, String>(0)?.into()))
117116
})
118117
}
119-
120-
fn query_dependency_graph(
121-
&self,
122-
path: &std::path::Path,
123-
) -> Result<
124-
Box<dyn Iterator<Item = (crate::DerivationId, crate::DerivationId)> + '_>,
125-
> {
126-
self.execute_row_query_with_path(
127-
queries::QUERY_DEPENDENCY_GRAPH,
128-
path,
129-
|row| Ok((DerivationId(row.get(0)?), DerivationId(row.get(1)?))),
130-
)
131-
}
132118
}

src/store/db_lazy.rs

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ use rusqlite::{
2525
use size::Size;
2626

2727
use crate::{
28-
DerivationId,
2928
StorePath,
3029
path_to_canonical_string,
3130
store::{
@@ -256,19 +255,4 @@ impl<'a> StoreBackend<'a> for LazyDBConnection<'_> {
256255
Ok(StorePath(row.get::<_, String>(0)?.into()))
257256
})
258257
}
259-
260-
/// Returns all edges of the dependency graph.
261-
///
262-
/// You might want to build an adjacency list from the resulting
263-
/// edges.
264-
fn query_dependency_graph(
265-
&self,
266-
path: &Path,
267-
) -> Result<Box<dyn Iterator<Item = (DerivationId, DerivationId)> + '_>> {
268-
self.execute_row_query_with_path(
269-
queries::QUERY_DEPENDENCY_GRAPH,
270-
path,
271-
|row| Ok((DerivationId(row.get(0)?), DerivationId(row.get(1)?))),
272-
)
273-
}
274258
}

src/store/nix_command.rs

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ use anyhow::{
1818
use size::Size;
1919

2020
use crate::{
21-
DerivationId,
2221
StorePath,
2322
store::StoreBackend,
2423
};
@@ -108,17 +107,4 @@ impl<'a> StoreBackend<'a> for CommandBackend {
108107
) -> Result<Box<dyn Iterator<Item = StorePath> + '_>> {
109108
nix_command_query(&["--query", "--requisites", &*path.to_string_lossy()])
110109
}
111-
112-
/// This is currently not supported by this final fallback
113-
///
114-
/// Always returns an error
115-
fn query_dependency_graph(
116-
&self,
117-
path: &Path,
118-
) -> Result<Box<dyn Iterator<Item = (DerivationId, DerivationId)> + '_>> {
119-
Err(anyhow!(
120-
"The nix command backend does not support querying the dependency \
121-
graph. (path: {path:?})"
122-
))
123-
}
124110
}

src/store/queries.rs

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,3 @@
1-
pub(crate) const QUERY_DEPENDENCY_GRAPH: &str = "
2-
WITH RECURSIVE
3-
graph(p, c) AS (
4-
SELECT id as par, reference as chd
5-
FROM ValidPaths
6-
JOIN Refs ON referrer = id
7-
WHERE path = ?
8-
UNION
9-
SELECT referrer as par, reference as chd FROM Refs
10-
JOIN graph ON referrer = c
11-
)
12-
SELECT p, c from graph;
13-
";
14-
151
pub(crate) const QUERY_DEPENDENTS: &str = "
162
WITH RECURSIVE
173
graph(p) AS (

0 commit comments

Comments
 (0)