Commit ecbfb7cf authored by zhanglikun's avatar zhanglikun
Browse files

[master] Rename one interface: from lookupClosestRRset() to lookupDeepestNS(),...

[master] Rename one interface: from lookupClosestRRset() to lookupDeepestNS(), and remove one parameter of it.
parent 6689f461
176. [func] zhang likun
src/lib/cache: Rename one interface: from lookupClosestRRset()
to lookupDeepestNS(), and remove one parameter of it.
(Trac #492, git)
175. [bug] jerry
src/bin/xfrout: Xfrout use the case-sensitive mode to compress
names in an AXFR massage.
......
......@@ -175,10 +175,10 @@ ResolverCache::lookup(const isc::dns::Name& qname,
}
isc::dns::RRsetPtr
ResolverCache::lookupClosestRRset(const isc::dns::Name& qname,
const isc::dns::RRType& qtype,
const isc::dns::RRClass& qclass) const
ResolverCache::lookupDeepestNS(const isc::dns::Name& qname,
const isc::dns::RRClass& qclass) const
{
isc::dns::RRType qtype = RRType::NS();
ResolverClassCache* cc = getClassCache(qclass);
if (cc) {
unsigned int count = qname.getLabelCount();
......@@ -199,7 +199,6 @@ ResolverCache::lookupClosestRRset(const isc::dns::Name& qname,
bool
ResolverCache::update(const isc::dns::Message& msg) {
QuestionIterator iter = msg.beginQuestion();
ResolverClassCache* cc = getClassCache((*iter)->getClass());
if (cc) {
......
......@@ -241,28 +241,27 @@ public:
const isc::dns::RRType& qtype,
const isc::dns::RRClass& qclass) const;
/// \brief Look up closest rrset in cache.
/// \brief Look up closest enclosing NS rrset in cache.
///
/// \param qname The query name to look up
/// \param qtype The query type to look up
/// \param qclass The query class to look up
///
/// \return return the shared_ptr of rrset if it can be found in
/// cache, or else return NULL.
/// \return return the shared_ptr of closest enclosing ns rrset
/// if it can be found in cache, or else return NULL.
///
/// Currently the implementation is: search exact rrset
/// label by lable, If the rrset can't be found, remove the last
/// Currently the implementation is: search exact ns rrset
/// label by lable, If the ns rrset can't be found, remove the last
/// label, then search again. The efficiency may be very low when
/// the name of rrset is very long but it's closest rrset's name
/// is very short.
/// If a good perfermance is needed when looking up the closest rrset,
/// rrset cache structure(HashTable) should be redesigned. By using
/// HashTable, it can only garantee the performance for looking
/// up exact rrset.
/// the name is very long but it's closest rrset's name is very short.
///
/// If a good perfermance is needed when looking up the closest
/// enclosing ns rrset, cache structure(HashTable) should be
/// redesigned. By using HashTable, it can only garantee the
/// performance for looking up exact rrset.
///
/// So here there is another question, which rrset looking up interface
/// is used frequently? Exact or closest looking up.
isc::dns::RRsetPtr lookupClosestRRset(const isc::dns::Name& qname,
const isc::dns::RRType& qtype,
/// is used frequently? Exact or closest enclosing ns looking up.
isc::dns::RRsetPtr lookupDeepestNS(const isc::dns::Name& qname,
const isc::dns::RRClass& qclass) const;
//@}
......
......@@ -112,18 +112,15 @@ TEST_F(ResolverCacheTest, testLookupClosestRRset) {
Name qname("www.test.example.com.");
RRsetPtr rrset_ptr = cache->lookupClosestRRset(qname, RRType::NS(),
RRClass::IN());
RRsetPtr rrset_ptr = cache->lookupDeepestNS(qname, RRClass::IN());
EXPECT_TRUE(rrset_ptr);
EXPECT_EQ(rrset_ptr->getName(), Name("example.com."));
rrset_ptr = cache->lookupClosestRRset(Name("example.com."),
RRType::NS(), RRClass::IN());
rrset_ptr = cache->lookupDeepestNS(Name("example.com."), RRClass::IN());
EXPECT_TRUE(rrset_ptr);
EXPECT_EQ(rrset_ptr->getName(), Name("example.com."));
rrset_ptr = cache->lookupClosestRRset(Name("com."),
RRType::NS(), RRClass::IN());
rrset_ptr = cache->lookupDeepestNS(Name("com."), RRClass::IN());
EXPECT_FALSE(rrset_ptr);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment