nautilus_persistence/writer/
run.rs1use crate::common::storage::StorageBackend;
13
14#[derive(Clone)]
15pub struct FeatherSessionSource {
16 pub storage: StorageBackend,
17 pub kind: String,
18 pub instance_id: String,
19}
20
21impl FeatherSessionSource {
22 #[must_use]
23 pub fn new(
24 storage: StorageBackend,
25 kind: impl Into<String>,
26 instance_id: impl Into<String>,
27 ) -> Self {
28 Self {
29 storage,
30 kind: kind.into(),
31 instance_id: instance_id.into(),
32 }
33 }
34}
35
36#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)]
37pub enum RunStatus {
38 InProgress,
39 Completed,
40 Promoted,
41 Failed,
42}
43
44impl RunStatus {
45 #[must_use]
46 pub const fn as_str(self) -> &'static str {
47 match self {
48 Self::InProgress => "in_progress",
49 Self::Completed => "completed",
50 Self::Promoted => "promoted",
51 Self::Failed => "failed",
52 }
53 }
54
55 #[must_use]
56 pub fn from_storage_str(value: &str) -> Self {
57 match value {
58 "in_progress" => Self::InProgress,
59 "completed" => Self::Completed,
60 "promoted" => Self::Promoted,
61 "failed" => Self::Failed,
62 _ => {
63 log::warn!(
64 "Unknown catalog run status '{value}'; treating the run as failed for recovery"
65 );
66 Self::Failed
67 }
68 }
69 }
70}