MCPcopy Create free account
hub / github.com/ceph/ceph / pick_method

Method pick_method

src/msg/compressor_registry.cc:92–109  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

90}
91
92Compressor::CompressionAlgorithm
93CompressorRegistry::pick_method(uint32_t peer_type,
94 const std::vector<uint32_t>& preferred_methods)
95{
96 std::vector<uint32_t> allowed_methods = get_methods(peer_type);
97 auto preferred = std::find_first_of(preferred_methods.begin(),
98 preferred_methods.end(),
99 allowed_methods.begin(),
100 allowed_methods.end());
101 if (preferred == preferred_methods.end()) {
102 ldout(cct,1) << "failed to pick compression method from client's "
103 << preferred_methods
104 << " and our " << allowed_methods << dendl;
105 return Compressor::COMP_ALG_NONE;
106 } else {
107 return static_cast<Compressor::CompressionAlgorithm>(*preferred);
108 }
109}
110
111Compressor::CompressionMode
112CompressorRegistry::get_mode(uint32_t peer_type, bool is_secure)

Callers 2

TESTFunction · 0.80

Calls 2

beginMethod · 0.45
endMethod · 0.45

Tested by 1

TESTFunction · 0.64