Update cleanup internals documentation

This commit is contained in:
2026-06-02 19:00:09 +00:00
parent 67dc07435d
commit bb276101d2
4 changed files with 30 additions and 2 deletions

View File

@@ -26,6 +26,19 @@ Storage errors use typed categories such as not found, already exists, invalid p
Backends may wrap implementation-specific errors, but callers should receive storage errors where practical. Traversal can stop cleanly with `ErrStopWalk`.
## Traversal helpers
Backends own their traversal mechanics. The local adapter owns filesystem walking, the SSH adapter owns SFTP directory walking, and the S3 adapter owns object listing and pagination.
`internal/storage` owns the shared callback emission rules used by backends:
- context cancellation is checked before callback emission;
- `WalkOptions.Limit` bounds the number of emitted entries;
- `ErrStopWalk` stops traversal without becoming a caller-visible error;
- callback errors are wrapped as storage walk errors.
`storage.HasAny(ctx, backend, prefix)` provides the shared destination-content check. It calls `Walk` with non-recursive, limit-one traversal and stops after the first emitted entry.
## Deletion
`DeleteManagedBundle` may delete listed managed outputs plus `.distributor.json`.