1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
mod concurrent_hashmap;
pub mod actions;
mod metadata;
mod filter;
mod dual_store;
pub mod event;

#[cfg(feature = "k8")]
pub mod k8;

pub use filter::*;
pub use concurrent_hashmap::*;
pub use metadata::*;
pub use dual_store::*;

// re-export epoch
pub use crate::epoch::*;

/// simple memory based metadata
pub mod memory {

    use crate::core::{MetadataItem, MetadataRevExtension};

    /// simple memory representation of meta
    #[derive(Debug, Default, Eq, PartialEq, Clone)]
    pub struct MemoryMeta {
        pub rev: u32,
    }

    impl MetadataItem for MemoryMeta {
        type UId = u32;

        fn uid(&self) -> &Self::UId {
            &self.rev
        }

        fn is_newer(&self, another: &Self) -> bool {
            self.rev >= another.rev
        }
    }

    impl MetadataRevExtension for MemoryMeta {
        fn next_rev(&self) -> Self {
            Self { rev: self.rev + 1 }
        }
    }

    impl MemoryMeta {
        #[allow(unused)]
        pub fn new(rev: u32) -> Self {
            Self { rev }
        }
    }
}