Add catalog destination state schema
This commit is contained in:
@@ -233,7 +233,7 @@ func removePrunedStateRecords(ctx context.Context, backend storage.Backend, stat
|
||||
}
|
||||
return true, writeRepairedState(ctx, backend, statePath, next)
|
||||
}
|
||||
return false, fmt.Errorf("destination state document is empty")
|
||||
return false, unsupportedStateDocumentError(document)
|
||||
}
|
||||
|
||||
func PlanPrune(document state.StateDocument, policy config.PrunePolicy, options PrunePlanOptions) (PrunePlanReport, error) {
|
||||
@@ -276,7 +276,17 @@ func pruneCandidatesForDocument(document state.StateDocument, scope state.OwnerS
|
||||
if document.SharedRoot != nil {
|
||||
return state.SharedRootPruneCandidates(*document.SharedRoot, scope), nil
|
||||
}
|
||||
return nil, fmt.Errorf("destination state document is empty")
|
||||
return nil, unsupportedStateDocumentError(document)
|
||||
}
|
||||
|
||||
func unsupportedStateDocumentError(document state.StateDocument) error {
|
||||
if document.SupersededLegacy != nil {
|
||||
return fmt.Errorf("destination state schema_version %d is superseded legacy state", document.SupersededLegacy.SchemaVersion)
|
||||
}
|
||||
if document.Catalog != nil {
|
||||
return fmt.Errorf("catalog destination state is not supported by this command")
|
||||
}
|
||||
return fmt.Errorf("destination state document is empty")
|
||||
}
|
||||
|
||||
func pruneOlderThan(policy config.PrunePolicy) *time.Duration {
|
||||
|
||||
Reference in New Issue
Block a user