Implement shared-root publish execution
This commit is contained in:
@@ -159,23 +159,35 @@ func (b *Backend) HasAny(ctx context.Context, prefix string) (bool, error) {
|
||||
}
|
||||
|
||||
func (b *Backend) DeleteManagedBundle(ctx context.Context, bundlePath string, managedOutputPaths []string, opts storage.DeleteOptions) error {
|
||||
return b.deleteManagedTargets(ctx, storage.OpDeleteManagedBundle, func() ([]string, error) {
|
||||
return storage.ManagedBundleTargets(bundlePath, managedOutputPaths)
|
||||
}, opts)
|
||||
}
|
||||
|
||||
func (b *Backend) DeleteManagedOutputs(ctx context.Context, bundlePath string, managedOutputPaths []string, opts storage.DeleteOptions) error {
|
||||
return b.deleteManagedTargets(ctx, storage.OpDeleteManagedOutputs, func() ([]string, error) {
|
||||
return storage.ManagedOutputTargets(bundlePath, managedOutputPaths)
|
||||
}, opts)
|
||||
}
|
||||
|
||||
func (b *Backend) deleteManagedTargets(ctx context.Context, op string, targetsFunc func() ([]string, error), opts storage.DeleteOptions) error {
|
||||
if err := ctx.Err(); err != nil {
|
||||
return err
|
||||
}
|
||||
targets, err := storage.ManagedBundleTargets(bundlePath, managedOutputPaths)
|
||||
targets, err := targetsFunc()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
for _, target := range targets {
|
||||
if _, ok := b.dirs[target]; ok {
|
||||
return storage.NewError(storage.OpDeleteManagedBundle, backendName, target, storage.ErrUnsupported, nil)
|
||||
return storage.NewError(op, backendName, target, storage.ErrUnsupported, nil)
|
||||
}
|
||||
if !b.exists(target) {
|
||||
if opts.IgnoreMissing {
|
||||
continue
|
||||
}
|
||||
return storage.NewError(storage.OpDeleteManagedBundle, backendName, target, storage.ErrNotFound, nil)
|
||||
return storage.NewError(op, backendName, target, storage.ErrNotFound, nil)
|
||||
}
|
||||
delete(b.files, target)
|
||||
delete(b.symlinks, target)
|
||||
|
||||
Reference in New Issue
Block a user