File tree Expand file tree Collapse file tree 5 files changed +10
-6
lines changed
third-party/thrift/src/thrift/compiler
test/fixtures/service-schema/out Expand file tree Collapse file tree 5 files changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -913,8 +913,7 @@ class cpp_mstch_service : public mstch_service {
913
913
return escape_binary_string (s.identify_definition (*service_));
914
914
}
915
915
mstch::node definition_key_length () {
916
- schematizer s (*service_->program ()->scope (), sm_, {});
917
- return escape_binary_string (s.identify_definition (*service_)).length ();
916
+ return schematizer::definition_identifier_length ();
918
917
}
919
918
920
919
private:
Original file line number Diff line number Diff line change @@ -949,6 +949,10 @@ std::string_view schematizer::program_checksum(const t_program& program) {
949
949
std::string (reinterpret_cast <const char *>(hash), sizeof (hash)));
950
950
}
951
951
952
+ size_t schematizer::definition_identifier_length () {
953
+ return 16 ;
954
+ }
955
+
952
956
std::string schematizer::identify_definition (const t_named& node) {
953
957
// @lint-ignore CLANGTIDY facebook-hte-CArray
954
958
unsigned char hash[SHA256_DIGEST_LENGTH];
@@ -958,8 +962,8 @@ std::string schematizer::identify_definition(const t_named& node) {
958
962
node.program ()->path (),
959
963
node.name ());
960
964
SHA256 (reinterpret_cast <const unsigned char *>(val.c_str ()), val.size (), hash);
961
- constexpr size_t num_bytes = 16 ;
962
- return std::string ( reinterpret_cast <const char *>(hash), num_bytes );
965
+ return std::string (
966
+ reinterpret_cast <const char *>(hash), definition_identifier_length () );
963
967
}
964
968
965
969
int64_t schematizer::identify_program (const t_program& node) {
Original file line number Diff line number Diff line change @@ -86,6 +86,7 @@ class schematizer {
86
86
// across runs on different including programs.
87
87
std::string identify_definition (const t_named& node);
88
88
int64_t identify_program (const t_program& node);
89
+ static size_t definition_identifier_length ();
89
90
90
91
// Get the name of the program's schema const.
91
92
static std::string name_schema (source_manager& sm, const t_program& node);
Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ apache::thrift::ServiceHandler<::cpp2::PrimitivesService>::CreateMethodMetadataR
23
23
std::optional<apache::thrift::schema::DefinitionsSchema> apache::thrift::ServiceHandler<::cpp2::PrimitivesService>::getServiceSchema() {
24
24
std::optional<apache::thrift::schema::DefinitionsSchema> ret = schema::DefinitionsSchema{};
25
25
ret->schema = ::apache::thrift::SchemaRegistry::mergeSchemas (::cpp2::module_constants::_fbthrift_schema_b747839c13cb3aa5_includes ());
26
- ret->definitions = { {" \x0d\x05\x1d\xbc\xb2\xd5\x1d\x8f\x95\x45\xbb\x51\xfa\xcf\x0f\xfe " , 64 } };
26
+ ret->definitions = { {" \x0d\x05\x1d\xbc\xb2\xd5\x1d\x8f\x95\x45\xbb\x51\xfa\xcf\x0f\xfe " , 16 } };
27
27
return ret;
28
28
}
29
29
#endif
Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ apache::thrift::ServiceHandler<::cpp2::PrimitivesService>::CreateMethodMetadataR
23
23
std::optional<apache::thrift::schema::DefinitionsSchema> apache::thrift::ServiceHandler<::cpp2::PrimitivesService>::getServiceSchema() {
24
24
std::optional<apache::thrift::schema::DefinitionsSchema> ret = schema::DefinitionsSchema{};
25
25
ret->schema = ::apache::thrift::SchemaRegistry::mergeSchemas (::cpp2::module_constants::_fbthrift_schema_b747839c13cb3aa5_includes ());
26
- ret->definitions = { {" \x0d\x05\x1d\xbc\xb2\xd5\x1d\x8f\x95\x45\xbb\x51\xfa\xcf\x0f\xfe " , 64 } };
26
+ ret->definitions = { {" \x0d\x05\x1d\xbc\xb2\xd5\x1d\x8f\x95\x45\xbb\x51\xfa\xcf\x0f\xfe " , 16 } };
27
27
return ret;
28
28
}
29
29
#endif
You can’t perform that action at this time.
0 commit comments