mirror of
https://github.com/apple/foundationdb.git
synced 2025-05-15 02:18:39 +08:00
Fix Build: use boost::hash to compute hash for std::pair
Description Fix Build: use boost::hash to compute hash for std::pair Testing 1. Build - gcc/clang 2. Simulation test: EncryptKeyProxyTest, EncryptionOps 3. Unit test: flow/BlobCipher 4. Running 10k correctness Joshua run
This commit is contained in:
parent
706164d8ae
commit
6c9030408e
@ -154,17 +154,6 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct pair_hash {
|
|
||||||
template <class T1, class T2>
|
|
||||||
std::size_t operator()(const std::pair<T1, T2>& pair) const {
|
|
||||||
auto hash1 = std::hash<T1>{}(pair.first);
|
|
||||||
auto hash2 = std::hash<T2>{}(pair.second);
|
|
||||||
|
|
||||||
// Equal hashes XOR would be ZERO.
|
|
||||||
return hash1 == hash2 ? hash1 : hash1 ^ hash2;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
ACTOR Future<Void> getCipherKeysByBaseCipherKeyIds(Reference<EncryptKeyProxyData> ekpProxyData,
|
ACTOR Future<Void> getCipherKeysByBaseCipherKeyIds(Reference<EncryptKeyProxyData> ekpProxyData,
|
||||||
KmsConnectorInterface kmsConnectorInf,
|
KmsConnectorInterface kmsConnectorInf,
|
||||||
EKPGetBaseCipherKeysByIdsRequest req) {
|
EKPGetBaseCipherKeysByIdsRequest req) {
|
||||||
@ -179,7 +168,9 @@ ACTOR Future<Void> getCipherKeysByBaseCipherKeyIds(Reference<EncryptKeyProxyData
|
|||||||
|
|
||||||
// Dedup the requested pair<baseCipherId, encryptDomainId>
|
// Dedup the requested pair<baseCipherId, encryptDomainId>
|
||||||
// TODO: endpoint serialization of std::unordered_set isn't working at the moment
|
// TODO: endpoint serialization of std::unordered_set isn't working at the moment
|
||||||
std::unordered_set<std::pair<EncryptCipherBaseKeyId, EncryptCipherDomainId>, pair_hash> dedupedCipherIds;
|
std::unordered_set<std::pair<EncryptCipherBaseKeyId, EncryptCipherDomainId>,
|
||||||
|
boost::hash<std::pair<EncryptCipherBaseKeyId, EncryptCipherDomainId>>>
|
||||||
|
dedupedCipherIds;
|
||||||
for (const auto& item : req.baseCipherIds) {
|
for (const auto& item : req.baseCipherIds) {
|
||||||
dedupedCipherIds.emplace(item);
|
dedupedCipherIds.emplace(item);
|
||||||
}
|
}
|
||||||
|
@ -233,20 +233,12 @@ private:
|
|||||||
// required encryption key, however, CPs/SSs cache-miss would result in RPC to
|
// required encryption key, however, CPs/SSs cache-miss would result in RPC to
|
||||||
// EncryptKeyServer to refresh the desired encryption key.
|
// EncryptKeyServer to refresh the desired encryption key.
|
||||||
|
|
||||||
struct pair_hash {
|
|
||||||
template <class T1, class T2>
|
|
||||||
std::size_t operator()(const std::pair<T1, T2>& pair) const {
|
|
||||||
auto hash1 = std::hash<T1>{}(pair.first);
|
|
||||||
auto hash2 = std::hash<T2>{}(pair.second);
|
|
||||||
|
|
||||||
// Equal hashes XOR would be ZERO.
|
|
||||||
return hash1 == hash2 ? hash1 : hash1 ^ hash2;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
using BlobCipherKeyIdCacheKey = std::pair<EncryptCipherBaseKeyId, EncryptCipherRandomSalt>;
|
using BlobCipherKeyIdCacheKey = std::pair<EncryptCipherBaseKeyId, EncryptCipherRandomSalt>;
|
||||||
using BlobCipherKeyIdCacheMap = std::unordered_map<BlobCipherKeyIdCacheKey, Reference<BlobCipherKey>, pair_hash>;
|
using BlobCipherKeyIdCacheKeyHash = boost::hash<BlobCipherKeyIdCacheKey>;
|
||||||
|
using BlobCipherKeyIdCacheMap =
|
||||||
|
std::unordered_map<BlobCipherKeyIdCacheKey, Reference<BlobCipherKey>, BlobCipherKeyIdCacheKeyHash>;
|
||||||
using BlobCipherKeyIdCacheMapCItr =
|
using BlobCipherKeyIdCacheMapCItr =
|
||||||
std::unordered_map<BlobCipherKeyIdCacheKey, Reference<BlobCipherKey>, pair_hash>::const_iterator;
|
std::unordered_map<BlobCipherKeyIdCacheKey, Reference<BlobCipherKey>, BlobCipherKeyIdCacheKeyHash>::const_iterator;
|
||||||
|
|
||||||
struct BlobCipherKeyIdCache : ReferenceCounted<BlobCipherKeyIdCache> {
|
struct BlobCipherKeyIdCache : ReferenceCounted<BlobCipherKeyIdCache> {
|
||||||
public:
|
public:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user