Repository navigation
Description
Summary
Implement Rename so mv works on a mount. S3 has no native rename for general-purpose
buckets, so this is CopyObject + DeleteObject, recursive for directory prefixes.
Background
Rename is absent from internal/fuse/filesystem.go. It is already declared in
internal/filesystem/interface.go, implemented only by a test mock.
RenameObject is not usable here. The 2026 S3 RenameObject API is restricted to
directory buckets (S3 Express One Zone), and object annotations — which the attribute-storage
work depends on — are unsupported on directory buckets. The two features are mutually
exclusive, so general-purpose buckets must use copy-then-delete. RenameObject is worth
keeping as an optional fast path behind capability detection, but it cannot be the primary
implementation.
This is the least atomic operation in the milestone and the acceptance criteria should reflect
that honestly rather than implying POSIX rename semantics.
Implementation
Single file — CopyObject to the new key, then DeleteObject the old one. Preserve
metadata, storage class, and Content-Encoding through the copy; losing Content-Encoding
here would reintroduce the corruption class fixed in #153.
Directory — list the prefix and copy each object under the new prefix, then delete the old
ones. Two hard constraints:
- Objects above 5 GB cannot use single-part
CopyObject— it fails with an
InvalidRequest. Those need multipart copy (UploadPartCopy). Detect viaHeadObjectsize
and route accordingly. - A large directory rename is not atomic and can fail midway. Do not attempt a
transactional illusion. Delete each source object only after its copy succeeds, so a partial
failure leaves both trees intact rather than losing data, and return the error.
POSIX expects rename-over-existing to replace the destination silently. Match that. Invalidate
cache and buffer entries for both source and destination paths.
Acceptance Criteria
-
mv a brenames a single file; content, metadata, andContent-Encodingare preserved - Renaming over an existing file replaces it
- Renaming a directory moves all objects beneath it
- An object larger than 5 GB is renamed via multipart copy
- A partial directory-rename failure leaves source objects intact — no data loss
- Cache and buffer are invalidated for both paths
- Renaming a nonexistent path returns
ENOENT - Non-atomicity of directory rename is documented in the operations docs
-
go test -race ./internal/fuse/...passes -
AWS_PROFILE=aws AWS_REGION=us-west-2 go test -race -tags=integration ./internal/fuse/...passes
Dependencies
Depends on #163 (shares delete-path cache invalidation). Needs no persisted attributes.
Activity
scttfrdmn commentedon Aug 3, 2026
Depends on #163. Rename here is CopyObject + DeleteObject, and
DirectoryNode.Unlinkcurrently returns EROFS (internal/fuse/filesystem.go:628) — so the delete half of rename has no working implementation to call. Do #163 first.Worth noting for whoever picks this up:
RenameObject(2026) is not usable as a shortcut. It is directory-bucket/Express One Zone only, and object annotations are unsupported on directory buckets, so the two features are mutually exclusive.test: put the prefix tests in the package that owns the code
v0.11.0 phase A: mv works, and the README says how far short of POSIX…