fluvio_controlplane_metadata/topic/
mod.rs

1mod spec;
2mod status;
3mod deduplication;
4mod update;
5pub mod config;
6
7pub use self::update::*;
8pub use self::spec::*;
9pub use self::status::*;
10pub use self::deduplication::*;
11
12pub const PENDING_REASON: &str = "waiting for live spus";
13
14#[cfg(feature = "k8")]
15mod k8;
16
17mod metadata {
18
19    use crate::core::{Spec, Status, Removable, Creatable};
20    use crate::extended::{SpecExt, ObjectType};
21
22    use super::*;
23
24    impl Spec for TopicSpec {
25        const LABEL: &'static str = "Topic";
26        type IndexKey = String;
27        type Status = TopicStatus;
28        type Owner = Self;
29    }
30
31    impl SpecExt for TopicSpec {
32        const OBJECT_TYPE: ObjectType = ObjectType::Topic;
33    }
34
35    impl Removable for TopicSpec {
36        type DeleteKey = String;
37    }
38
39    impl Creatable for TopicSpec {}
40
41    impl Status for TopicStatus {}
42
43    #[cfg(feature = "k8")]
44    mod extended {
45
46        use crate::store::k8::K8ExtendedSpec;
47        use crate::store::k8::K8ConvertError;
48        use crate::store::k8::K8MetaItem;
49        use crate::store::MetadataStoreObject;
50        use crate::k8_types::K8Obj;
51        use crate::store::k8::default_convert_from_k8;
52
53        use super::TopicSpec;
54
55        impl K8ExtendedSpec for TopicSpec {
56            type K8Spec = Self;
57
58            const DELETE_WAIT_DEPENDENTS: bool = true;
59
60            fn convert_from_k8(
61                k8_obj: K8Obj<Self::K8Spec>,
62                multi_namespace_context: bool,
63            ) -> Result<MetadataStoreObject<Self, K8MetaItem>, K8ConvertError<Self::K8Spec>>
64            {
65                default_convert_from_k8(k8_obj, multi_namespace_context)
66            }
67
68            fn convert_status_from_k8(status: Self::Status) -> Self::Status {
69                status
70            }
71
72            fn into_k8(self) -> Self::K8Spec {
73                self
74            }
75        }
76    }
77}