manta_server/backend_dispatcher/
console.rs

1//! Dispatches `ConsoleTrait` methods to csm-rs or ochami-rs.
2
3use manta_backend_dispatcher::{
4  error::Error, interfaces::console::ConsoleTrait, types::K8sDetails,
5};
6
7use StaticBackendDispatcher::*;
8use tokio::io::{AsyncRead, AsyncWrite};
9
10use crate::manta_backend_dispatcher::StaticBackendDispatcher;
11
12impl ConsoleTrait for StaticBackendDispatcher {
13  type T = Box<dyn AsyncWrite + Unpin + Send>;
14  type U = Box<dyn AsyncRead + Unpin + Send>;
15
16  async fn attach_to_node_console(
17    &self,
18    shasta_token: &str,
19    site_name: &str,
20    xname: &str,
21    width: u16,
22    height: u16,
23    k8s: &K8sDetails,
24  ) -> Result<
25    (
26      Box<dyn AsyncWrite + Unpin + Send>,
27      Box<dyn AsyncRead + Unpin + Send>,
28    ),
29    Error,
30  > {
31    dispatch!(
32      self,
33      attach_to_node_console,
34      shasta_token,
35      site_name,
36      xname,
37      width,
38      height,
39      k8s
40    )
41  }
42
43  async fn attach_to_session_console(
44    &self,
45    shasta_token: &str,
46    site_name: &str,
47    session_name: &str,
48    width: u16,
49    height: u16,
50    k8s: &K8sDetails,
51  ) -> Result<
52    (
53      Box<dyn AsyncWrite + Unpin + Send>,
54      Box<dyn AsyncRead + Unpin + Send>,
55    ),
56    Error,
57  > {
58    dispatch!(
59      self,
60      attach_to_session_console,
61      shasta_token,
62      site_name,
63      session_name,
64      width,
65      height,
66      k8s
67    )
68  }
69}