proxygen
CertDecompressionManager.cpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2018-present, Facebook, Inc.
3  * All rights reserved.
4  *
5  * This source code is licensed under the BSD-style license found in the
6  * LICENSE file in the root directory of this source tree.
7  */
8 
10 
11 namespace fizz {
12 
14 
16  std::vector<std::shared_ptr<CertificateDecompressor>> decompressors) {
17  setDecompressors(std::move(decompressors));
18 }
19 
21  std::vector<std::shared_ptr<CertificateDecompressor>> decompressors) {
22  decompressors_.clear();
23  for (const auto& decompressor : decompressors) {
24  decompressors_[decompressor->getAlgorithm()] = decompressor;
25  }
26  supportedAlgos_.clear();
27  for (const auto& pair : decompressors_) {
28  supportedAlgos_.push_back(pair.first);
29  }
30 }
31 
32 std::vector<CertificateCompressionAlgorithm>
34  return supportedAlgos_;
35 }
36 
37 std::shared_ptr<CertificateDecompressor>
40  try {
41  return decompressors_.at(algo);
42  } catch (const std::out_of_range&) {
43  VLOG(4) << "Requested unknown algorithm: " << toString(algo);
44  return nullptr;
45  }
46 }
47 
48 } // namespace fizz
folly::StringPiece toString(StateEnum state)
Definition: State.cpp:16
CertificateCompressionAlgorithm
Definition: Types.h:167
constexpr detail::Map< Move > move
Definition: Base-inl.h:2567
std::shared_ptr< CertificateDecompressor > getDecompressor(CertificateCompressionAlgorithm algo) const
std::vector< CertificateCompressionAlgorithm > supportedAlgos_
std::map< CertificateCompressionAlgorithm, std::shared_ptr< CertificateDecompressor > > decompressors_
Definition: Actions.h:16
std::vector< CertificateCompressionAlgorithm > getSupportedAlgorithms() const
Definition: Traits.h:577
void setDecompressors(std::vector< std::shared_ptr< CertificateDecompressor >> decompressors)