Files
calypso/docs/alpha/srs/SRS-02-File-Sharing.md
2026-01-04 13:19:40 +07:00

142 lines
4.0 KiB
Markdown

# SRS-02: File Sharing (SMB/NFS)
## 1. Overview
File Sharing module provides management of SMB/CIFS and NFS shares for network file access.
## 2. Functional Requirements
### 2.1 Share Management
**FR-FS-001**: System shall allow users to create shares
- **Input**: Dataset ID, share type (SMB/NFS/Both), share name, mount point
- **Output**: Created share with UUID
- **Validation**: Dataset exists, share name uniqueness
**FR-FS-002**: System shall allow users to list all shares
- **Output**: Share list with type, dataset, status
- **Filtering**: By protocol, dataset, status
**FR-FS-003**: System shall allow users to view share details
- **Output**: Share configuration, protocol settings, access control
**FR-FS-004**: System shall allow users to update shares
- **Input**: Share ID, updated configuration
- **Validation**: Valid configuration values
**FR-FS-005**: System shall allow users to delete shares
- **Validation**: Share must not be actively accessed
### 2.2 SMB/CIFS Configuration
**FR-FS-006**: System shall allow users to configure SMB share name
- **Input**: Share ID, SMB share name
- **Validation**: Valid SMB share name format
**FR-FS-007**: System shall allow users to configure SMB path
- **Input**: Share ID, SMB path
- **Validation**: Path exists and is accessible
**FR-FS-008**: System shall allow users to configure SMB comment
- **Input**: Share ID, comment text
**FR-FS-009**: System shall allow users to enable/disable guest access
- **Input**: Share ID, guest access flag
**FR-FS-010**: System shall allow users to configure read-only access
- **Input**: Share ID, read-only flag
**FR-FS-011**: System shall allow users to configure browseable option
- **Input**: Share ID, browseable flag
### 2.3 NFS Configuration
**FR-FS-012**: System shall allow users to configure NFS clients
- **Input**: Share ID, client list (IP addresses or hostnames)
- **Validation**: Valid IP/hostname format
**FR-FS-013**: System shall allow users to add NFS clients
- **Input**: Share ID, client address
- **Validation**: Client not already in list
**FR-FS-014**: System shall allow users to remove NFS clients
- **Input**: Share ID, client address
**FR-FS-015**: System shall allow users to configure NFS options
- **Input**: Share ID, NFS options (ro, rw, sync, async, etc.)
### 2.4 Share Status
**FR-FS-016**: System shall display share status (enabled/disabled)
- **Output**: Current status for each protocol
**FR-FS-017**: System shall allow users to enable/disable SMB protocol
- **Input**: Share ID, enabled flag
**FR-FS-018**: System shall allow users to enable/disable NFS protocol
- **Input**: Share ID, enabled flag
## 3. User Interface Requirements
### 3.1 Share List View
- Master-detail layout
- Search and filter functionality
- Protocol indicators (SMB/NFS badges)
- Status indicators
### 3.2 Share Detail View
- Protocol tabs (SMB, NFS)
- Configuration forms
- Client management (for NFS)
- Quick actions (enable/disable protocols)
### 3.3 Create Share Modal
- Dataset selection
- Share name input
- Protocol selection
- Initial configuration
## 4. API Endpoints
```
GET /api/v1/shares
GET /api/v1/shares/:id
POST /api/v1/shares
PUT /api/v1/shares/:id
DELETE /api/v1/shares/:id
```
## 5. Data Model
### Share Object
```json
{
"id": "uuid",
"dataset_id": "uuid",
"dataset_name": "string",
"mount_point": "string",
"share_type": "smb|nfs|both",
"smb_enabled": boolean,
"smb_share_name": "string",
"smb_path": "string",
"smb_comment": "string",
"smb_guest_ok": boolean,
"smb_read_only": boolean,
"smb_browseable": boolean,
"nfs_enabled": boolean,
"nfs_clients": ["string"],
"nfs_options": "string",
"is_active": boolean,
"created_at": "timestamp",
"updated_at": "timestamp",
"created_by": "uuid"
}
```
## 6. Permissions
- **storage:read**: Required for viewing shares
- **storage:write**: Required for creating, updating, deleting shares
## 7. Error Handling
- Invalid dataset ID
- Duplicate share name
- Invalid client address format
- Share in use
- Insufficient permissions