swh_graph/views/contiguous_subgraph/
timestamps.rs1use super::*;
9use properties::{
10 NoTimestamps, OptTimestamps, PropertiesBackend, PropertiesResult, SwhGraphProperties,
11};
12
13impl<
14 G: SwhGraphWithProperties<Timestamps: OptTimestamps>,
15 N: ContractionBackend,
16 MAPS: properties::MaybeMaps,
17 PERSONS: properties::MaybePersons,
18 CONTENTS: properties::MaybeContents,
19 STRINGS: properties::MaybeStrings,
20 LABELNAMES: properties::MaybeLabelNames,
21 > ContiguousSubgraph<G, N, MAPS, NoTimestamps, PERSONS, CONTENTS, STRINGS, LABELNAMES>
22{
23 pub fn with_timestamps(
27 self,
28 ) -> ContiguousSubgraph<
29 G,
30 N,
31 MAPS,
32 ContiguousSubgraphTimestamps<G, N>,
33 PERSONS,
34 CONTENTS,
35 STRINGS,
36 LABELNAMES,
37 > {
38 let ContiguousSubgraph {
39 properties:
40 SwhGraphProperties {
41 path,
42 num_nodes,
43 maps,
44 timestamps: NoTimestamps,
45 persons,
46 contents,
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: ContiguousSubgraphTimestamps {
60 graph: Arc::clone(&inner),
61 },
62 persons,
63 contents,
64 strings,
65 label_names,
66 label_names_are_in_base64_order,
67 },
68 inner,
69 }
70 }
71}
72
73pub struct ContiguousSubgraphTimestamps<
75 G: SwhGraphWithProperties<Timestamps: OptTimestamps>,
76 N: ContractionBackend,
77> {
78 graph: Arc<ContiguousSubgraphInner<G, N>>,
79}
80
81impl<G: SwhGraphWithProperties<Timestamps: OptTimestamps>, N: ContractionBackend> PropertiesBackend
82 for ContiguousSubgraphTimestamps<G, N>
83{
84 type DataFilesAvailability =
85 <<G as SwhGraphWithProperties>::Timestamps as PropertiesBackend>::DataFilesAvailability;
86}
87impl<G: SwhGraphWithProperties<Timestamps: OptTimestamps>, N: ContractionBackend> OptTimestamps
88 for ContiguousSubgraphTimestamps<G, N>
89{
90 #[inline(always)]
91 fn author_timestamp(&self, node: NodeId) -> PropertiesResult<'_, Option<i64>, Self> {
92 self.graph
93 .underlying_graph
94 .properties()
95 .timestamps
96 .author_timestamp(self.graph.contraction.underlying_node_id(node))
97 }
98 #[inline(always)]
99 fn author_timestamp_offset(&self, node: NodeId) -> PropertiesResult<'_, Option<i16>, Self> {
100 self.graph
101 .underlying_graph
102 .properties()
103 .timestamps
104 .author_timestamp_offset(self.graph.contraction.underlying_node_id(node))
105 }
106 #[inline(always)]
107 fn committer_timestamp(&self, node: NodeId) -> PropertiesResult<'_, Option<i64>, Self> {
108 self.graph
109 .underlying_graph
110 .properties()
111 .timestamps
112 .committer_timestamp(self.graph.contraction.underlying_node_id(node))
113 }
114 #[inline(always)]
115 fn committer_timestamp_offset(&self, node: NodeId) -> PropertiesResult<'_, Option<i16>, Self> {
116 self.graph
117 .underlying_graph
118 .properties()
119 .timestamps
120 .committer_timestamp_offset(self.graph.contraction.underlying_node_id(node))
121 }
122}