|
1 | | -use std::sync::Arc; |
| 1 | +use std::{collections::BTreeSet, time::Duration}; |
2 | 2 |
|
3 | 3 | use async_trait::async_trait; |
4 | | -use dora_core::uhlc::HLC; |
5 | 4 | use dora_message::{ |
6 | 5 | BuildId, |
7 | | - cli_to_coordinator::{BuildReq, CliToCoordinator}, |
| 6 | + cli_to_coordinator::{ |
| 7 | + BuildReq, CliAndDefaultDaemonIps, CliToCoordinator, StartReq, WaitForBuildResp, |
| 8 | + }, |
| 9 | + common::DaemonId, |
| 10 | + coordinator_to_cli::{DataflowListEntry, NodeInfo}, |
| 11 | + id::{NodeId, OperatorId}, |
8 | 12 | }; |
| 13 | +use eyre::Result; |
| 14 | +use uuid::Uuid; |
9 | 15 |
|
10 | | -use crate::build_dataflow; |
| 16 | +pub struct CliRequestHandler; |
11 | 17 |
|
12 | 18 | #[async_trait] |
13 | 19 | impl CliToCoordinator for CliRequestHandler { |
14 | | - async fn build(self, req: BuildReq) -> eyre::Result<BuildId> { |
15 | | - let BuildReq { |
16 | | - session_id, |
17 | | - dataflow, |
18 | | - git_sources, |
19 | | - prev_git_sources, |
20 | | - local_working_dir, |
21 | | - uv, |
22 | | - } = req; |
| 20 | + async fn build(self, req: BuildReq) -> Result<BuildId> { |
| 21 | + // let BuildReq { |
| 22 | + // session_id, |
| 23 | + // dataflow, |
| 24 | + // git_sources, |
| 25 | + // prev_git_sources, |
| 26 | + // local_working_dir, |
| 27 | + // uv, |
| 28 | + // } = req; |
23 | 29 |
|
24 | | - // assign a random build id |
25 | | - let build_id = BuildId::generate(); |
| 30 | + // // assign a random build id |
| 31 | + // let build_id = BuildId::generate(); |
26 | 32 |
|
27 | | - let result = build_dataflow( |
28 | | - build_id, |
29 | | - session_id, |
30 | | - dataflow, |
31 | | - git_sources, |
32 | | - prev_git_sources, |
33 | | - local_working_dir, |
34 | | - &self.clock, |
35 | | - uv, |
36 | | - &mut daemon_connections, |
37 | | - ) |
38 | | - .await; |
39 | | - match result { |
40 | | - Ok(build) => { |
41 | | - running_builds.insert(build_id, build); |
42 | | - Ok(build_id) |
43 | | - } |
44 | | - Err(err) => { |
45 | | - let _ = reply_sender.send(Err(err)); |
46 | | - } |
47 | | - } |
| 33 | + // let result = build_dataflow( |
| 34 | + // build_id, |
| 35 | + // session_id, |
| 36 | + // dataflow, |
| 37 | + // git_sources, |
| 38 | + // prev_git_sources, |
| 39 | + // local_working_dir, |
| 40 | + // &self.clock, |
| 41 | + // uv, |
| 42 | + // &mut daemon_connections, |
| 43 | + // ) |
| 44 | + // .await; |
| 45 | + // match result { |
| 46 | + // Ok(build) => { |
| 47 | + // running_builds.insert(build_id, build); |
| 48 | + // Ok(build_id) |
| 49 | + // } |
| 50 | + // Err(err) => { |
| 51 | + // let _ = reply_sender.send(Err(err)); |
| 52 | + // } |
| 53 | + // } |
| 54 | + todo!() |
| 55 | + } |
| 56 | + async fn wait_for_build(self, build_id: BuildId) -> Result<WaitForBuildResp> { |
| 57 | + todo!() |
| 58 | + } |
| 59 | + async fn start(self, req: StartReq) -> Result<Uuid> { |
| 60 | + todo!() |
| 61 | + } |
| 62 | + async fn wait_for_spawn(self, dataflow_id: Uuid) -> Result<Uuid> { |
| 63 | + todo!() |
| 64 | + } |
| 65 | + async fn reload( |
| 66 | + self, |
| 67 | + dataflow_id: Uuid, |
| 68 | + node_id: NodeId, |
| 69 | + operator_id: Option<OperatorId>, |
| 70 | + ) -> Result<Uuid> { |
| 71 | + todo!() |
| 72 | + } |
| 73 | + async fn check(self, dataflow_uuid: Uuid) -> Result<Uuid> { |
| 74 | + todo!() |
| 75 | + } |
| 76 | + async fn stop( |
| 77 | + self, |
| 78 | + dataflow_uuid: Uuid, |
| 79 | + grace_duration: Option<Duration>, |
| 80 | + force: bool, |
| 81 | + ) -> Result<()> { |
| 82 | + todo!() |
| 83 | + } |
| 84 | + async fn stop_by_name( |
| 85 | + self, |
| 86 | + name: String, |
| 87 | + grace_duration: Option<Duration>, |
| 88 | + force: bool, |
| 89 | + ) -> Result<()> { |
| 90 | + todo!() |
| 91 | + } |
| 92 | + async fn logs( |
| 93 | + self, |
| 94 | + uuid: Option<Uuid>, |
| 95 | + name: Option<String>, |
| 96 | + node: String, |
| 97 | + tail: Option<usize>, |
| 98 | + ) -> Result<Vec<u8>> { |
| 99 | + todo!() |
| 100 | + } |
| 101 | + async fn destroy(self) -> Result<()> { |
| 102 | + todo!() |
| 103 | + } |
| 104 | + async fn list(self) -> Result<Vec<DataflowListEntry>> { |
| 105 | + todo!() |
| 106 | + } |
| 107 | + async fn info(self, dataflow_uuid: Uuid) -> Result<()> { |
| 108 | + todo!() |
| 109 | + } |
| 110 | + async fn daemon_connected(self) -> Result<bool> { |
| 111 | + todo!() |
| 112 | + } |
| 113 | + async fn connected_machines(self) -> Result<BTreeSet<DaemonId>> { |
| 114 | + todo!() |
| 115 | + } |
| 116 | + async fn log_subscribe(self, dataflow_id: Uuid, level: log::LevelFilter) -> Result<()> { |
| 117 | + todo!() |
| 118 | + } |
| 119 | + async fn build_log_subscribe(self, build_id: BuildId, level: log::LevelFilter) -> Result<()> { |
| 120 | + todo!() |
| 121 | + } |
| 122 | + async fn cli_and_default_daemon_on_same_machine(self) -> Result<CliAndDefaultDaemonIps> { |
| 123 | + todo!() |
| 124 | + } |
| 125 | + async fn get_node_info(self) -> Result<Vec<NodeInfo>> { |
| 126 | + todo!() |
48 | 127 | } |
49 | 128 | } |
0 commit comments