You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: ARCHITECTURE.md
+134Lines changed: 134 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -309,6 +309,140 @@ Interactive mode provides persistent shell sessions with single-node or multiple
309
309
- Node-prefixed output with color coding
310
310
- Visual status indicators (● connected, ○ disconnected)
311
311
312
+
## PTY Implementation Design
313
+
314
+
### Architecture Overview
315
+
316
+
The PTY implementation provides true terminal emulation for interactive SSH sessions. It's designed with careful attention to performance, memory usage, and user experience through systematic configuration of timeouts, buffer sizes, and concurrency controls.
317
+
318
+
### Core Components
319
+
320
+
1.**PTY Session (`pty/session.rs`)**
321
+
- Manages bidirectional terminal communication
322
+
- Handles terminal resize events
323
+
- Processes key sequences and ANSI escape codes
324
+
- Provides graceful shutdown with proper cleanup
325
+
326
+
2.**PTY Manager (`pty/mod.rs`)**
327
+
- Orchestrates multiple PTY sessions
328
+
- Supports both single-node and multiplex modes
329
+
- Manages session lifecycle and resource cleanup
330
+
331
+
3.**Terminal State Management (`pty/terminal.rs`)**
332
+
- RAII guards for terminal state preservation
333
+
- Raw mode management with global synchronization
334
+
- Mouse support and alternate screen handling
335
+
336
+
### Buffer Pool Design (`utils/buffer_pool.rs`)
337
+
338
+
The buffer pool uses a three-tier system optimized for different I/O patterns:
This design provides a production-ready PTY implementation that balances performance, reliability, and user experience while maintaining strict resource controls and graceful error handling.
about = "Backend.AI SSH - SSH-compatible parallel command execution tool",
24
-
long_about = "bssh is a high-performance SSH client with parallel execution capabilities.\nIt can be used as a drop-in replacement for SSH (single host) or as a powerful cluster management tool (multiple hosts).\n\nSSH Compatibility Mode:\n bssh user@host # Interactive shell\n bssh user@host command # Execute command\n bssh -p 2222 user@host # Custom port\n bssh -i key.pem user@host # Custom key\n\nMulti-Server Mode:\n bssh -C production \"uptime\" # Execute on cluster\n bssh -H \"host1,host2\"\"df -h\" # Execute on hosts\n\nThe tool provides secure file transfer using SFTP and supports SSH keys, SSH agent, and password authentication.\nIt automatically detects Backend.AI multi-node session environments.",
25
-
after_help = "EXAMPLES:\n SSH Mode:\n bssh user@host # Interactive shell\n bssh admin@server.com \"uptime\" # Execute command\n bssh -p 2222 -i ~/.ssh/key user@host # Custom port and key\n\n Multi-Server Mode:\n bssh -C production \"systemctl status\" # Use cluster config\n bssh -H \"web1,web2,web3\"\"df -h\" # Direct hosts\n\n File Operations:\n bssh -C staging upload file.txt /tmp/ # Upload to cluster\n bssh -H host1,host2 download /etc/hosts ./backups/\n\n Other Commands:\n bssh list # List configured clusters\n bssh -C production ping # Test connectivity\n\nFor more information: https://github.com/lablup/bssh"
24
+
long_about = "bssh is a high-performance SSH client with parallel execution capabilities.\nIt can be used as a drop-in replacement for SSH (single host) or as a powerful cluster management tool (multiple hosts).\n\nThe tool provides secure file transfer using SFTP and supports SSH keys, SSH agent, and password authentication.\nIt automatically detects Backend.AI multi-node session environments.",
25
+
after_help = "EXAMPLES:\n SSH Mode:\n bssh user@host # Interactive shell\n bssh admin@server.com \"uptime\" # Execute command\n bssh -p 2222 -i ~/.ssh/key user@host # Custom port and key\n\n Multi-Server Mode:\n bssh -C production \"systemctl status\" # Use cluster config\n bssh -H \"web1,web2,web3\"\"df -h\" # Direct hosts\n\n File Operations:\n bssh -C staging upload file.txt /tmp/ # Upload to cluster\n bssh -H host1,host2 download /etc/hosts ./backups/\n\n Other Commands:\n bssh list # List configured clusters\n bssh -C production ping # Test connectivity\n\nDeveloped and maintained as part of the Backend.AI project.\nFor more information: https://github.com/lablup/bssh"
26
26
)]
27
27
pubstructCli{
28
28
/// SSH destination in format: [user@]hostname[:port] or ssh://[user@]hostname[:port]
0 commit comments