LoadSnapshot 加载快照
(ctx context.Context, agentID string, snapshotID string)
| 218 | |
| 219 | // LoadSnapshot 加载快照 |
| 220 | func (js *JSONStore) LoadSnapshot(ctx context.Context, agentID string, snapshotID string) (*types.Snapshot, error) { |
| 221 | js.mu.RLock() |
| 222 | defer js.mu.RUnlock() |
| 223 | |
| 224 | var snapshot types.Snapshot |
| 225 | path := filepath.Join(js.agentDir(agentID), "snapshots", snapshotID+".json") |
| 226 | if err := js.loadJSON(path, &snapshot); err != nil { |
| 227 | return nil, err |
| 228 | } |
| 229 | |
| 230 | return &snapshot, nil |
| 231 | } |
| 232 | |
| 233 | // ListSnapshots 列出快照 |
| 234 | func (js *JSONStore) ListSnapshots(ctx context.Context, agentID string) ([]types.Snapshot, error) { |