MCPcopy Create free account
hub / github.com/astercloud/aster / SaveSnapshot

Method SaveSnapshot

pkg/store/mysql.go:207–215  ·  view source on GitHub ↗

SaveSnapshot 保存快照

(ctx context.Context, agentID string, snapshot types.Snapshot)

Source from the content-addressed store, hash-verified

205
206// SaveSnapshot 保存快照
207func (s *MySQLStore) SaveSnapshot(ctx context.Context, agentID string, snapshot types.Snapshot) error {
208 data, err := json.Marshal(snapshot)
209 if err != nil {
210 return fmt.Errorf("marshal snapshot: %w", err)
211 }
212
213 record := AgentSnapshot{AgentID: agentID, SnapshotID: snapshot.ID, Data: string(data)}
214 return s.db.WithContext(ctx).Create(&record).Error
215}
216
217// LoadSnapshot 加载快照
218func (s *MySQLStore) LoadSnapshot(ctx context.Context, agentID string, snapshotID string) (*types.Snapshot, error) {

Callers

nothing calls this directly

Calls 1

CreateMethod · 0.65

Tested by

no test coverage detected