Let prune delete old .partial uploads and remote info count them (closes #466)
check / check (push) Waiting to run

A killed upload leaves a `.partial` object that only remote nuke
removed, and that remote info never showed.

The storage interface's DeletePartialUploads becomes ListPartialUploads,
which returns each such object's key, size and time; Delete removes it.
prune deletes those under metadata/ and blobs/ once older than
prune_grace_period, and reports kept, deleted and failed counts. remote
info counts them on their own line and in --json. remote nuke lists and
deletes them like any other object, and now names any it could not
delete.

Model: opus-5-5
This commit was merged in pull request #474.
This commit is contained in:
clawbot committed 2026-11-19 14:01:04 +01:00
1 parent aaa2219d6b
commit be362080d3
24 files changed
+625 -230

No files matched your search

+13 -14
View File
@@ -256,29 +256,28 @@ func (r *RcloneStorer) ListStream(
return ch
}
// DeletePartialUploads removes every object under prefix whose name ends
// in tempSuffix.
func (r *RcloneStorer) DeletePartialUploads(ctx context.Context, prefix string) error {
var partial []fs.Object
// ListPartialUploads returns each object under prefix whose name ends in
// tempSuffix.
func (r *RcloneStorer) ListPartialUploads(
ctx context.Context, prefix string,
) ([]ObjectInfo, error) {
var partial []ObjectInfo
err := operations.ListFn(ctx, r.fsys, func(obj fs.Object) {
key := obj.Remote()
if strings.HasPrefix(key, prefix) && strings.HasSuffix(key, tempSuffix) {
partial = append(partial, obj)
partial = append(partial, ObjectInfo{
Key: key,
Size: obj.Size(),
ModTime: obj.ModTime(ctx),
})
}
})
if err != nil {
return fmt.Errorf("listing objects: %w", err)
return nil, fmt.Errorf("listing objects: %w", err)
}
for _, obj := range partial {
err = obj.Remove(ctx)
if err != nil {
return fmt.Errorf("removing object: %w", err)
}
}
return nil
return partial, nil
}
// Info returns human-readable storage location information.