sapling/eden/fs/model
Andrey Chursin c24bb6096b Make ObjectId a variable length hash [proxy hash removal 4/n]
Summary:
This diff modifies ObjectId structure to support storing more information directly in ObjectId, avoiding proxy objects like HgProxyHash and ReCasDigestProxyHash.

Storing this information directly in ObjectId allows to avoid additional db access for loading/storing those proxy hash objects, reducing file access latency in hot case.

**New ObjectId format**

ObjectId can now content variable length hash.

The variable length can be used in following cases:
(1) To replace ReCasDigestProxyHash, extra 8 bytes can be used to store size portion of `remote_execution::TDigest`
(2) To replace HgProxyHash, extra 1 byte can be used to identify whether ObjectId represents ProxyHashId or an HgId.

In the future, ObjectId can contain path or other information needed to implement ACL

**Compatibility notes**

For compatibility reasons, we only currently initialize ObjectId with 20-bytes content.

This is essential to allow smooth migration to a new format
(a) Until new hash format is actually used(e.g. we switch HgBackingStore to store HgId inside ObjectId), this code is backwards compatible with other EdenFs versions. This revision can be safely rolled back and previous version of EdenFs can still read inode data written by this version
(b) When we introduce support for new ObjectId into HgBackingStore, we can gate it's usage behind config, allowing controlled slow roll out of new ObjectId format.

**ToDo**

Just to track progress of removing proxy hashes, few things are still left:
* We need different format for SerializedTreeMetadata
* We need to support new format for thriftHash
* We need to actually switch HgBackingStore to embed HgId information into ObjectId, instead of using ProxyHash

Not planned:
* Migration of ReCasDigestProxyHash - I don't know how to test it, so someone else should probably do that

Reviewed By: chadaustin

Differential Revision: D31668130

fbshipit-source-id: 720127354c648651bb35e850beb8dd252a5566b2
2021-10-22 17:52:01 -07:00
..
git Make ObjectId a variable length hash [proxy hash removal 4/n] 2021-10-22 17:52:01 -07:00
test Make ObjectId a variable length hash [proxy hash removal 4/n] 2021-10-22 17:52:01 -07:00
Blob.h separate out ObjectId [proxy hash removal 1/n] 2021-10-01 10:25:46 -07:00
CMakeLists.txt model: add tests to CMake 2020-05-07 10:07:32 -07:00
Hash.cpp explicit Hash20 instead of Hash [proxy hash removal 2/n] 2021-10-01 12:43:26 -07:00
Hash.h explicit Hash20 instead of Hash [proxy hash removal 2/n] 2021-10-01 12:43:26 -07:00
ObjectId.cpp Make ObjectId a variable length hash [proxy hash removal 4/n] 2021-10-22 17:52:01 -07:00
ObjectId.h Make ObjectId a variable length hash [proxy hash removal 4/n] 2021-10-22 17:52:01 -07:00
RootId.cpp add missing headers 2021-09-27 17:01:18 -07:00
RootId.h introduce a variable-width RootId type that identifies the root of an EdenFS checkout's contents 2021-06-07 17:25:31 -07:00
Tree.cpp model: namespace facebook::eden 2021-06-08 19:29:37 -07:00
Tree.h separate out ObjectId [proxy hash removal 1/n] 2021-10-01 10:25:46 -07:00
TreeEntry.cpp rename ObjectId::toString to toLogString 2021-10-19 18:58:52 -07:00
TreeEntry.h explicit Hash20 instead of Hash [proxy hash removal 2/n] 2021-10-01 12:43:26 -07:00