ReleaseUpload
Corex\Config\Releases\ReleaseUpload · class · Config layer
Receives a release package in parts (spec 107, plan D12). A package is known by the SHA-256 of the whole file, which the browser computes before it sends anything. Its parts are appended to one file named for that hash, each saying where it starts; a part that does not start where the last one ended is answered with how much the site holds, and the browser goes on from there. So an upload that was cut off resumes, a part sent twice does no harm, and two packages being received do not touch. When all of it has arrived the file is hashed here. If it is what was sent it takes the package’s name; if it is not, it is deleted. Nothing is opened as a package until then.
Public API
Section titled “Public API”__construct(ReleaseStore $store, int $largest)
Section titled “__construct(ReleaseStore $store, int $largest)”received(string $sha256): int
Section titled “received(string $sha256): int”How much of the package with this hash the site holds: where the next part starts.
append(string $sha256, int $offset, string $bytes): int
Section titled “append(string $sha256, int $offset, string $bytes): int”Append a part, and answer how much is held after it.
complete(string $sha256, int $size, string $name): string
Section titled “complete(string $sha256, int $size, string $name): string”Make what arrived the package, if it is all there and it is what was sent.