Add db cleanup api

This commit is contained in:
Oliver Sauder
2018-06-20 15:04:02 +02:00
committed by Lorenzo Bolla
parent f09a273ad7
commit b4efe6a810
4 changed files with 216 additions and 0 deletions

View File

@@ -7,6 +7,9 @@ import (
// AllLocalReposResourcesKey to be used as resource key when all local repos are needed
const AllLocalReposResourcesKey = "__alllocalrepos__"
// AllResourcesKey to be used as resource key when all resources are needed
const AllResourcesKey = "__all__"
// ResourceConflictError represents a list tasks
// using conflicitng resources
type ResourceConflictError struct {
@@ -51,6 +54,12 @@ func (r *ResourcesSet) UsedBy(resources []string) []Task {
tasks = appendTask(tasks, task)
}
}
} else if resource == AllResourcesKey {
for _, task := range r.set {
tasks = appendTask(tasks, task)
}
break
}
task, found = r.set[resource]
@@ -63,6 +72,10 @@ func (r *ResourcesSet) UsedBy(resources []string) []Task {
if found {
tasks = appendTask(tasks, task)
}
task, found = r.set[AllResourcesKey]
if found {
tasks = appendTask(tasks, task)
}
return tasks
}