MCPcopy Create free account
hub / github.com/catboost/catboost / Resolve

Method Resolve

library/cpp/dns/cache.cpp:53–81  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

51 class TGlobalCachedDns: public IDns, public TNonCopyable {
52 public:
53 const TResolvedHost* Resolve(const TResolveTask& rt) override {
54 //2. search host in cache
55 {
56 TReadGuard guard(L_);
57
58 TCache::const_iterator it = C_.find(rt.Info);
59
60 if (it != C_.end()) {
61 return it->second.Get();
62 }
63 }
64
65 TResolvedHostPtr res = ResolveA(rt);
66
67 //update cache
68 {
69 TWriteGuard guard(L_);
70
71 std::pair<TCache::iterator, bool> updateResult = C_.insert(std::make_pair(TResolveInfo(res->Host, rt.Info.Port), res));
72 TResolvedHost* rh = updateResult.first->second.Get();
73
74 if (updateResult.second) {
75 //fresh resolved host, set cache record id for it
76 rh->Id = C_.size() - 1;
77 }
78
79 return rh;
80 }
81 }
82
83 void AddAlias(const TString& host, const TString& alias) noexcept {
84 TWriteGuard guard(LA_);

Callers

nothing calls this directly

Calls 6

TResolveInfoClass · 0.85
findMethod · 0.45
endMethod · 0.45
GetMethod · 0.45
insertMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected