mirror of
https://github.com/floci-io/floci.git
synced 2026-11-24 06:20:24 -05:00
CopyObject read the whole source into a byte array with getObject and wrote it back out for the copy, so a source of 2 GiB or more failed as an internal error, even though S3 copies objects up to 5 GiB in one call. In the disk-backed modes the source is now pinned with a temporary hard link to the file generation its metadata describes, taken through the same optimistic snapshot GetObject uses, and that link is moved into place as the copy's file. The copy's ETag and checksum are prepared before any bucket monitor is taken, and the pinned file is read, once and streamed, only for what cannot carry over: a single-part source's ETag is the MD5 of its bytes and is kept, while a multipart source needs the MD5 computed, and a requested or composite checksum becomes a full-object one through a new incremental S3Checksum.Calculator. A failed copy removes its pinned link. Memory mode still copies the byte array. As on S3, a CopyObject source larger than 5 GiB (5368709120 bytes) is now rejected with InvalidRequest, "The specified copy source is larger than the maximum allowable size for a copy source: 5368709120"; such an object is copied with UploadPartCopy.