manta_server/backend_dispatcher/
console.rs

1//! [`ConsoleTrait`] impl for [`StaticBackendDispatcher`].
2//!
3//! Opens a PTY-style attachment to a CSM `cray-console-operator`
4//! pod (per-node) or the CFS session pod (per-session) via the
5//! Kubernetes exec subprotocol. Ochami's `impl ConsoleTrait for
6//! Ochami {}` uses the trait default, so both methods on the Ochami
7//! branch return [`Error::Message`] ("Attach to … console command
8//! not implemented for this backend").
9
10use manta_backend_dispatcher::interfaces::console::{
11  ConsoleAttachment, TermSize,
12};
13
14use super::*;
15
16impl ConsoleTrait for StaticBackendDispatcher {
17  /// Attach to `xname`'s console. Returns the
18  /// stdin/stdout/resize handle; the caller drives the lifetime by
19  /// dropping the channels.
20  async fn attach_to_node_console(
21    &self,
22    token: &str,
23    site_name: &str,
24    xname: &str,
25    initial_size: TermSize,
26    k8s: &K8sDetails,
27  ) -> Result<ConsoleAttachment, Error> {
28    dispatch!(
29      self,
30      attach_to_node_console,
31      token,
32      site_name,
33      xname,
34      initial_size,
35      k8s
36    )
37  }
38
39  /// Attach to the Ansible-container console of a running CFS
40  /// session, identified by `session_name`. Same handle shape as
41  /// [`attach_to_node_console`](Self::attach_to_node_console).
42  async fn attach_to_session_console(
43    &self,
44    token: &str,
45    site_name: &str,
46    session_name: &str,
47    initial_size: TermSize,
48    k8s: &K8sDetails,
49  ) -> Result<ConsoleAttachment, Error> {
50    dispatch!(
51      self,
52      attach_to_session_console,
53      token,
54      site_name,
55      session_name,
56      initial_size,
57      k8s
58    )
59  }
60}