swh_graph/views/contiguous_subgraph/
contents.rs1use super::*;
9use properties::{
10 NoContents, OptContents, PropertiesBackend, PropertiesResult, SwhGraphProperties,
11};
12
13impl<
14 G: SwhGraphWithProperties<Contents: OptContents>,
15 N: ContractionBackend,
16 MAPS: properties::MaybeMaps,
17 TIMESTAMPS: properties::MaybeTimestamps,
18 PERSONS: properties::MaybePersons,
19 STRINGS: properties::MaybeStrings,
20 LABELNAMES: properties::MaybeLabelNames,
21 > ContiguousSubgraph<G, N, MAPS, TIMESTAMPS, PERSONS, NoContents, STRINGS, LABELNAMES>
22{
23 pub fn with_contents(
27 self,
28 ) -> ContiguousSubgraph<
29 G,
30 N,
31 MAPS,
32 TIMESTAMPS,
33 PERSONS,
34 ContiguousSubgraphContents<G, N>,
35 STRINGS,
36 LABELNAMES,
37 > {
38 let ContiguousSubgraph {
39 properties:
40 SwhGraphProperties {
41 path,
42 num_nodes,
43 maps,
44 timestamps,
45 persons,
46 contents: NoContents,
47 strings,
48 label_names,
49 label_names_are_in_base64_order,
50 },
51 inner,
52 } = self;
53
54 ContiguousSubgraph {
55 properties: SwhGraphProperties {
56 path,
57 num_nodes,
58 maps,
59 timestamps,
60 persons,
61 contents: ContiguousSubgraphContents {
62 graph: Arc::clone(&inner),
63 },
64 strings,
65 label_names,
66 label_names_are_in_base64_order,
67 },
68 inner,
69 }
70 }
71}
72
73pub struct ContiguousSubgraphContents<
75 G: SwhGraphWithProperties<Contents: OptContents>,
76 N: ContractionBackend,
77> {
78 graph: Arc<ContiguousSubgraphInner<G, N>>,
79}
80
81impl<G: SwhGraphWithProperties<Contents: OptContents>, N: ContractionBackend> PropertiesBackend
82 for ContiguousSubgraphContents<G, N>
83{
84 type DataFilesAvailability =
85 <<G as SwhGraphWithProperties>::Contents as PropertiesBackend>::DataFilesAvailability;
86}
87impl<G: SwhGraphWithProperties<Contents: OptContents>, N: ContractionBackend> OptContents
88 for ContiguousSubgraphContents<G, N>
89{
90 #[inline(always)]
91 fn is_skipped_content(&self, node: NodeId) -> PropertiesResult<'_, Option<bool>, Self> {
92 self.graph
93 .underlying_graph
94 .properties()
95 .contents
96 .is_skipped_content(self.graph.contraction.underlying_node_id(node))
97 }
98 #[inline(always)]
99 fn content_length(&self, node: NodeId) -> PropertiesResult<'_, Option<u64>, Self> {
100 self.graph
101 .underlying_graph
102 .properties()
103 .contents
104 .content_length(self.graph.contraction.underlying_node_id(node))
105 }
106}