Commit 381cd00
TypeSystemDigest
Summary:
Adds a canonical, deterministic (SHA-256) digest for `TypeSystem` (`type_system.thrift`) in C++ (for now). This enables efficient equivalence checking across runtime and serialized representations, useful for cache invalidation, version compatibility checks, and deduplication.
The key goal is to have a deterministic hash, independent of serialization, language & platform behavior:
- Ordering is normalized (types sorted by URI, fields by ID, etc) so structurally equivalent type systems always produce identical hashes regardless of definition order.
- Runtime types (`TypeSystem`, `TypeRef`, `TypeId`) and their serializable counterparts (`SerializableTypeSystem`, `SerializableTypeDefinition`, `TypeIdUnion`) produce identical digests for *equivalent* types.
- Includes a version byte prefix for future algorithm evolution
- So we can invalidate in case of major changes/bugs/etc
Reviewed By: praihan
Differential Revision: D93045913
fbshipit-source-id: b81535f5c197b2b4d20f19cb1dd8562246a767d21 parent 0a8446e commit 381cd00
File tree
3 files changed
+2067
-0
lines changed- third-party/thrift/src/thrift/lib/cpp2/dynamic
- test
3 files changed
+2067
-0
lines changed
0 commit comments