* 刷新存储列表
()
| 99 | * 刷新存储列表 |
| 100 | */ |
| 101 | async refresh(): Promise<void> { |
| 102 | try { |
| 103 | // 从 rcloneInfo.service 获取数据 |
| 104 | const sourceList = rcloneInfo.storageList |
| 105 | |
| 106 | // 更新缓存 |
| 107 | this.cache = [...sourceList] |
| 108 | this.lastRefresh = new Date() |
| 109 | |
| 110 | // 触发事件 |
| 111 | if (this.config.enableEventEmitter) { |
| 112 | this.emit(STORAGE_EVENTS.UPDATED, { |
| 113 | type: 'refresh', |
| 114 | timestamp: this.lastRefresh, |
| 115 | }) |
| 116 | } |
| 117 | } catch (error) { |
| 118 | const appError = AppError.api('Failed to refresh storage list', 'REFRESH_FAILED', { |
| 119 | error: String(error), |
| 120 | }) |
| 121 | |
| 122 | if (this.config.enableEventEmitter) { |
| 123 | this.emit(STORAGE_EVENTS.ERROR, appError) |
| 124 | } |
| 125 | |
| 126 | throw appError |
| 127 | } |
| 128 | } |
| 129 | |
| 130 | /** |
| 131 | * 获取所有存储列表 |