Skip to content

CAS: Avoid double write for received blobs

All blobs are currently written to disk using the add_object() method. To avoid CAS corruption due to the file passed to add_object() being modified after adding it to the CAS, add_object() writes the contents to a new file while computing the hash. This precaution makes sense for files passed in from the user, however, it's unnecessary overhead for files that are created by the CAS client or server itself, as is the case for downloaded or uploaded blobs.

One option to improve this is to have CAS implement a File-like object that computes the hash while the file is being written. This could be used in place of NamedTemporaryFile by both the CAS client and the CAS server.

See also the discussion in !813 (merged).

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information