Line data Source code
1 : use serde::Serialize;
2 : use utils::seqwait::MonotonicCounter;
3 :
4 : extern crate hyper0 as hyper;
5 :
6 : mod auth;
7 : mod background_node_operations;
8 : mod compute_hook;
9 : pub mod hadron_token;
10 : pub mod hadron_utils;
11 : mod heartbeater;
12 : pub mod http;
13 : mod id_lock_map;
14 : mod leadership;
15 : pub mod metrics;
16 : mod node;
17 : mod operation_utils;
18 : mod pageserver_client;
19 : mod peer_client;
20 : pub mod persistence;
21 : mod reconciler;
22 : mod safekeeper;
23 : mod safekeeper_client;
24 : mod scheduler;
25 : mod schema;
26 : pub mod service;
27 : mod tenant_shard;
28 : mod timeline_import;
29 :
30 : #[derive(Ord, PartialOrd, Eq, PartialEq, Copy, Clone, Serialize)]
31 : struct Sequence(u64);
32 :
33 : impl Sequence {
34 0 : fn initial() -> Self {
35 0 : Self(0)
36 0 : }
37 : }
38 :
39 : impl std::fmt::Display for Sequence {
40 0 : fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
41 0 : write!(f, "{}", self.0)
42 0 : }
43 : }
44 :
45 : impl std::fmt::Debug for Sequence {
46 0 : fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
47 0 : write!(f, "{}", self.0)
48 0 : }
49 : }
50 :
51 : impl MonotonicCounter<Sequence> for Sequence {
52 0 : fn cnt_advance(&mut self, v: Sequence) {
53 0 : assert!(*self <= v);
54 0 : *self = v;
55 0 : }
56 0 : fn cnt_value(&self) -> Sequence {
57 0 : *self
58 0 : }
59 : }
60 :
61 : impl Sequence {
62 0 : fn next(&self) -> Sequence {
63 0 : Sequence(self.0 + 1)
64 0 : }
65 : }
|