vitess_grpc/generated/workflow.rs
1/// Workflow is the persisted state of a long-running workflow.
2#[allow(clippy::derive_partial_eq_without_eq)]
3#[derive(Clone, PartialEq, ::prost::Message)]
4pub struct Workflow {
5 /// uuid is set when the workflow is created, and immutable after
6 /// that.
7 #[prost(string, tag = "1")]
8 pub uuid: ::prost::alloc::string::String,
9 /// factory_name is set with the name of the factory that created the
10 /// job (and can also restart it). It is set at creation time, and
11 /// immutable after that.
12 #[prost(string, tag = "2")]
13 pub factory_name: ::prost::alloc::string::String,
14 /// name is the display name of the workflow.
15 #[prost(string, tag = "3")]
16 pub name: ::prost::alloc::string::String,
17 /// state describes the state of the job. A job is created as
18 /// NotStarted, then the Workflow Manager picks it up and starts it,
19 /// switching it to Running (and populating 'start_time'). The
20 /// workflow can then fail over to a new Workflow Manager is
21 /// necessary, and still be in Running state. When done, it goes to
22 /// Done, 'end_time' is populated, and 'error' is set if there was an
23 /// error.
24 #[prost(enumeration = "WorkflowState", tag = "4")]
25 pub state: i32,
26 /// data is workflow-specific stored data. It is usually a binary
27 /// proto-encoded data structure. It can vary throughout the
28 /// execution of the workflow. It will not change after the workflow
29 /// is Done.
30 #[prost(bytes = "vec", tag = "5")]
31 pub data: ::prost::alloc::vec::Vec<u8>,
32 /// error is set if the job finished with an error. This field only
33 /// makes sense if 'state' is Done.
34 #[prost(string, tag = "6")]
35 pub error: ::prost::alloc::string::String,
36 /// start_time is set when the workflow manager starts a workflow for
37 /// the first time. This field only makes sense if 'state' is Running
38 /// or Done.
39 #[prost(int64, tag = "7")]
40 pub start_time: i64,
41 /// end_time is set when the workflow is finished.
42 /// This field only makes sense if 'state' is Done.
43 #[prost(int64, tag = "8")]
44 pub end_time: i64,
45 /// create_time is set when the workflow is created.
46 #[prost(int64, tag = "9")]
47 pub create_time: i64,
48}
49#[allow(clippy::derive_partial_eq_without_eq)]
50#[derive(Clone, PartialEq, ::prost::Message)]
51pub struct WorkflowCheckpoint {
52 /// code_version is used to detect incompabilities between the version of the
53 /// running workflow and the one which wrote the checkpoint. If they don't
54 /// match, the workflow must not continue. The author of workflow must update
55 /// this variable in their implementation when incompabilities are introduced.
56 ///
57 /// tasks stores all tasks of the workflow in a map. The key is a unique name
58 /// to identify the task, e.g. clone/-80.
59 #[prost(int32, tag = "1")]
60 pub code_version: i32,
61 /// Task is the data structure that stores the execution status and the
62 /// attributes of a task.
63 #[prost(map = "string, message", tag = "2")]
64 pub tasks: ::std::collections::HashMap<::prost::alloc::string::String, Task>,
65 /// settings includes workflow specific data, e.g. the resharding workflow
66 /// would store the source shards and destination shards.
67 #[prost(map = "string, string", tag = "3")]
68 pub settings: ::std::collections::HashMap<
69 ::prost::alloc::string::String,
70 ::prost::alloc::string::String,
71 >,
72}
73#[allow(clippy::derive_partial_eq_without_eq)]
74#[derive(Clone, PartialEq, ::prost::Message)]
75pub struct Task {
76 #[prost(string, tag = "1")]
77 pub id: ::prost::alloc::string::String,
78 #[prost(enumeration = "TaskState", tag = "2")]
79 pub state: i32,
80 /// attributes includes the parameters the task needs.
81 #[prost(map = "string, string", tag = "3")]
82 pub attributes: ::std::collections::HashMap<
83 ::prost::alloc::string::String,
84 ::prost::alloc::string::String,
85 >,
86 #[prost(string, tag = "4")]
87 pub error: ::prost::alloc::string::String,
88}
89/// WorkflowState describes the state of a workflow.
90/// This constant should match the Node object described in
91/// web/vtctld2/src/app/workflows/node.ts as it is exposed as JSON to
92/// the Angular 2 web app.
93#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
94#[repr(i32)]
95pub enum WorkflowState {
96 NotStarted = 0,
97 Running = 1,
98 Done = 2,
99}
100impl WorkflowState {
101 /// String value of the enum field names used in the ProtoBuf definition.
102 ///
103 /// The values are not transformed in any way and thus are considered stable
104 /// (if the ProtoBuf definition does not change) and safe for programmatic use.
105 pub fn as_str_name(&self) -> &'static str {
106 match self {
107 WorkflowState::NotStarted => "NotStarted",
108 WorkflowState::Running => "Running",
109 WorkflowState::Done => "Done",
110 }
111 }
112 /// Creates an enum from field names used in the ProtoBuf definition.
113 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
114 match value {
115 "NotStarted" => Some(Self::NotStarted),
116 "Running" => Some(Self::Running),
117 "Done" => Some(Self::Done),
118 _ => None,
119 }
120 }
121}
122#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
123#[repr(i32)]
124pub enum TaskState {
125 TaskNotStarted = 0,
126 TaskRunning = 1,
127 TaskDone = 2,
128}
129impl TaskState {
130 /// String value of the enum field names used in the ProtoBuf definition.
131 ///
132 /// The values are not transformed in any way and thus are considered stable
133 /// (if the ProtoBuf definition does not change) and safe for programmatic use.
134 pub fn as_str_name(&self) -> &'static str {
135 match self {
136 TaskState::TaskNotStarted => "TaskNotStarted",
137 TaskState::TaskRunning => "TaskRunning",
138 TaskState::TaskDone => "TaskDone",
139 }
140 }
141 /// Creates an enum from field names used in the ProtoBuf definition.
142 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
143 match value {
144 "TaskNotStarted" => Some(Self::TaskNotStarted),
145 "TaskRunning" => Some(Self::TaskRunning),
146 "TaskDone" => Some(Self::TaskDone),
147 _ => None,
148 }
149 }
150}