Files
rust_raidguardx/README_GUI.md
T
2026-03-29 00:37:18 +08:00

269 lines
9.4 KiB
Markdown

# RAIDGuard X - GUI Client/Server Architecture
A modern Rust-based GUI application for managing RAID storage systems.
## Architecture
```
┌─────────────────────────────────────────────────────────────────────┐
│ raidguard_x_gui_client (Slint GUI) │
│ - Cross-platform UI (macOS, Windows, Linux) │
│ - TCP connection to server │
│ - Real-time data display │
└─────────────────────────┬───────────────────────────────────────────┘
│ TCP JSON Protocol (:8923)
┌─────────────────────────────────────────────────────────────────────┐
│ raidguard_x_gui_server (Mock/Real Backend) │
│ - Provides RAID controller data │
│ - Currently serves mock data │
│ - Future: In-Band API to real RAID systems │
└─────────────────────────────────────────────────────────────────────┘
```
## Project Structure
```
raidguard_x_gui_server/ # Data server
├── Cargo.toml
├── src/
│ ├── main.rs # Entry point
│ ├── lib.rs
│ ├── server.rs # TCP server
│ ├── protocol/ # JSON message protocol
│ ├── handlers/ # Request handlers
│ └── mock/ # Mock data provider
raidguard_x_gui_client/ # GUI client
├── Cargo.toml
├── build.rs # Slint build script
├── src/
│ ├── main.rs # Entry point + Slint integration
│ ├── lib.rs
│ ├── app.rs # App state management
│ ├── models/ # Data models
│ └── protocol/ # Client protocol
└── ui/
└── main_window.slint # Slint UI definition
```
## Build Requirements
- Rust 1.70+
- For GUI client: `xcode-select` (macOS) or equivalent
## Build Instructions
### Server
```bash
cd raidguard_x_gui_server
cargo build --release
```
Run:
```bash
# Default port 8923
cargo run --release
# Custom port
SERVER_ADDR=127.0.0.1:8923 cargo run --release
```
### Client
```bash
cd raidguard_x_gui_client
cargo build --release
```
Run:
```bash
cargo run --release
```
## Protocol
### Request Format
```json
{
"id": "uuid-v4",
"type": "request",
"action": "get_controllers",
"params": {}
}
```
### Response Format
```json
{
"id": "uuid-v4",
"type": "response",
"status": "success",
"data": { ... },
"error": null
}
```
### Available Actions
| Action | Description |
|--------|-------------|
| `get_controllers` | Get all controllers |
| `get_raids` | Get RAID arrays |
| `get_disks` | Get physical disks |
| `get_events` | Get event log |
| `ping` | Health check |
## Development
### Testing the Server
```bash
# Terminal 1: Start server
cd raidguard_x_gui_server
cargo run --release
# Terminal 2: Connect with netcat
nc localhost 8923
# Send request:
{"id":"test","type":"request","action":"get_controllers","params":{}}
# Response:
{"id":"test","type":"response","status":"success","data":{"controllers":[...]}}
```
---
## Menu Bar & Toolbar Functionality
### Menu Bar Structure
```
┌─────────────────────────────────────────────────────────────────┐
│ [File] [Controller] [Language] [Help] │
├─────────────────────────────────────────────────────────────────┤
```
#### File Menu
| Item | Function |
|------|----------|
| Exit | Close application |
| Load Controller List | Load saved controller list |
| **Language** (submenu) | English / Japanese |
#### Controller Menu
| Item | Function |
|------|----------|
| Manual Add Controller | Manually add a controller |
| Update System Code | Firmware update |
| Dump Controller Log | Export controller log |
| Shutdown | Shutdown controller |
| **Update** (submenu) | |
| - Update Expander Code | Update expander firmware |
| - Update JBOD Code | Update JBOD firmware |
| - Update Boot Code | Update boot firmware |
| - Update BIOS/EFI | Update BIOS/EFI |
| Disk RW Test | Run disk read/write test |
| Polling On/Off | Toggle polling |
#### Help Menu
| Item | Function |
|------|----------|
| Help Center | Open local help |
| Play Menu | Debug/testing menu |
| About | Show About dialog |
### Toolbar Buttons
| Button | Function |
|--------|----------|
| **+** (Add) | Add Controller |
| **-** (Remove) | Remove Controller |
| **Create Array** | Create new RAID array |
| **Delete Array** | Delete RAID array |
| **Mirror** | Mirror configuration |
| **Email** | Email notification settings |
| **Settings** | Application preferences |
| **Advanced** | Advanced operations menu |
### Advanced Menu (frmAdvanced)
| Category | Functions |
|----------|-----------|
| **LUN Mask** | LUN masking configuration |
| **Slicing** | Storage slicing |
| **Snapshot** | Snapshot management |
| **Migrate** | Migration operations |
| **Expansion** | Storage expansion |
| **Maintenance** | System maintenance |
| **Email Settings** | Email configuration |
---
## Java Source Code Architecture (Reference for Migration)
### 1. System Architecture
```
┌─────────────────────────────────────────────────────────────┐
│ GUI Client (Swing) │
│ ┌──────────────┐ ┌──────────────┐ ┌──────────────────┐ │
│ │ frmMain │ │ frmSettings │ │ frmCreateArray │ │
│ └──────────────┘ └──────────────┘ └──────────────────┘ │
│ ┌──────────────┐ ┌──────────────┐ ┌──────────────────┐ │
│ │ jpController │ │ dlgServer │ │ dlgDiskInfo │ │
│ └──────────────┘ └──────────────┘ └──────────────────┘ │
├─────────────────────────────────────────────────────────────┤
│ Global Data Layer │
│ ┌─────────────────────────────────────────────────────┐ │
│ │ PageDataDB.java (~7300 lines) │ │
│ └─────────────────────────────────────────────────────┘ │
├─────────────────────────────────────────────────────────────┤
│ Protocol Layer │
│ ┌──────────────────┐ ┌──────────────────────────┐ │
│ │ InBandAPI │ │ SNMP │ │
│ │ Port 8922 │ │ Port 162/8922 │ │
│ └──────────────────┘ └──────────────────────────┘ │
└─────────────────────────────────────────────────────────────┘
```
### 2. In-Band API Protocol (Port 8922)
**OpCodes:**
| OpCode | Function |
|--------|----------|
| 0x01 | GET_PAGE (read info pages) |
| 0x1D | SEND_PASSWORD (authentication) |
| 0xBC | Unlock |
| 0x1B | Erase RAID |
| 0xCC | Create RAID |
| 0xCE | Set Global Config |
| 0x26 | Commit Config |
**Page Codes:**
- Page 0: Controller Info
- Page 1: RAID Snapshot
- Page 7: LUN Map Table
- Page 10-14: RAID Info
- Page 16-17: Disk/Slice Names
- Page 20: Array Info
- Page 26: Enclosure Info
- Page 27: Disk List
### 3. Key Java Files
| File | Description |
|------|-------------|
| `InBandAPI/SendCmd.java` | TCP communication core |
| `InBandAPI/BasePage.java` | Abstract base for page data |
| `PageDataDB.java` | Global database (~7300 lines) |
| `frmMain.java` | Main window (~318KB) |
---
## License
Proprietary - Accusys Inc.