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_dns;
10 : mod hadron_queries;
11 : pub mod hadron_requests;
12 : pub mod hadron_utils;
13 : mod heartbeater;
14 : pub mod http;
15 : mod id_lock_map;
16 : mod leadership;
17 : pub mod metrics;
18 : mod node;
19 : mod operation_utils;
20 : mod pageserver_client;
21 : mod peer_client;
22 : pub mod persistence;
23 : mod reconciler;
24 : mod safekeeper;
25 : mod safekeeper_client;
26 : mod scheduler;
27 : mod schema;
28 : pub mod service;
29 : mod sk_node;
30 : mod tenant_shard;
31 : mod timeline_import;
32 :
33 : #[derive(Ord, PartialOrd, Eq, PartialEq, Copy, Clone, Serialize)]
34 : struct Sequence(u64);
35 :
36 : impl Sequence {
37 0 : fn initial() -> Self {
38 0 : Self(0)
39 0 : }
40 : }
41 :
42 : impl std::fmt::Display for Sequence {
43 0 : fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
44 0 : write!(f, "{}", self.0)
45 0 : }
46 : }
47 :
48 : impl std::fmt::Debug for Sequence {
49 0 : fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
50 0 : write!(f, "{}", self.0)
51 0 : }
52 : }
53 :
54 : impl MonotonicCounter<Sequence> for Sequence {
55 0 : fn cnt_advance(&mut self, v: Sequence) {
56 0 : assert!(*self <= v);
57 0 : *self = v;
58 0 : }
59 0 : fn cnt_value(&self) -> Sequence {
60 0 : *self
61 0 : }
62 : }
63 :
64 : impl Sequence {
65 0 : fn next(&self) -> Sequence {
66 0 : Sequence(self.0 + 1)
67 0 : }
68 : }
|