Commit aa7400d4 authored by JINMEI Tatuya's avatar JINMEI Tatuya
Browse files

[trac1060] first step of trivial refactoring: rename some classes

parent 902ad260
......@@ -163,7 +163,7 @@ MemoryDatasourceConfig::build(ConstElementPtr config_value) {
isc_throw(AuthConfigError, "Missing zone file for zone: "
<< origin->str());
}
shared_ptr<MemoryZone> new_zone(new MemoryZone(rrclass_,
shared_ptr<MemoryZoneFinder> new_zone(new MemoryZoneFinder(rrclass_,
Name(origin->stringValue())));
const result::Result result = memory_datasrc_->addZone(new_zone);
if (result == result::EXIST) {
......
......@@ -136,8 +136,8 @@ public:
// that doesn't block other server operations.
// TODO: we may (should?) want to check the "last load time" and
// the timestamp of the file and skip loading if the file isn't newer.
shared_ptr<MemoryZone> newzone(new MemoryZone(oldzone->getClass(),
oldzone->getOrigin()));
shared_ptr<MemoryZoneFinder> newzone(
new MemoryZoneFinder(oldzone->getClass(), oldzone->getOrigin()));
newzone->load(oldzone->getFileName());
oldzone->swap(*newzone);
LOG_DEBUG(auth_logger, DBG_AUTH_OPS, AUTH_LOAD_ZONE)
......@@ -145,7 +145,8 @@ public:
}
private:
shared_ptr<MemoryZone> oldzone; // zone to be updated with the new file.
// zone finder to be updated with the new file.
shared_ptr<MemoryZoneFinder> oldzone;
// A helper private method to parse and validate command parameters.
// On success, it sets 'oldzone' to the zone to be updated.
......@@ -194,7 +195,8 @@ private:
" is not found in data source");
}
oldzone = boost::dynamic_pointer_cast<MemoryZone>(result.zone);
oldzone = boost::dynamic_pointer_cast<MemoryZoneFinder>(
result.zone_finder);
return (true);
}
......
......@@ -31,14 +31,14 @@ namespace isc {
namespace auth {
void
Query::getAdditional(const Zone& zone, const RRset& rrset) const {
Query::getAdditional(const ZoneFinder& zone, const RRset& rrset) const {
RdataIteratorPtr rdata_iterator(rrset.getRdataIterator());
for (; !rdata_iterator->isLast(); rdata_iterator->next()) {
const Rdata& rdata(rdata_iterator->getCurrent());
if (rrset.getType() == RRType::NS()) {
// Need to perform the search in the "GLUE OK" mode.
const generic::NS& ns = dynamic_cast<const generic::NS&>(rdata);
findAddrs(zone, ns.getNSName(), Zone::FIND_GLUE_OK);
findAddrs(zone, ns.getNSName(), ZoneFinder::FIND_GLUE_OK);
} else if (rrset.getType() == RRType::MX()) {
const generic::MX& mx(dynamic_cast<const generic::MX&>(rdata));
findAddrs(zone, mx.getMXName());
......@@ -47,8 +47,8 @@ Query::getAdditional(const Zone& zone, const RRset& rrset) const {
}
void
Query::findAddrs(const Zone& zone, const Name& qname,
const Zone::FindOptions options) const
Query::findAddrs(const ZoneFinder& zone, const Name& qname,
const ZoneFinder::FindOptions options) const
{
// Out of zone name
NameComparisonResult result = zone.getOrigin().compare(qname);
......@@ -66,9 +66,9 @@ Query::findAddrs(const Zone& zone, const Name& qname,
// Find A rrset
if (qname_ != qname || qtype_ != RRType::A()) {
Zone::FindResult a_result = zone.find(qname, RRType::A(), NULL,
ZoneFinder::FindResult a_result = zone.find(qname, RRType::A(), NULL,
options);
if (a_result.code == Zone::SUCCESS) {
if (a_result.code == ZoneFinder::SUCCESS) {
response_.addRRset(Message::SECTION_ADDITIONAL,
boost::const_pointer_cast<RRset>(a_result.rrset));
}
......@@ -76,9 +76,9 @@ Query::findAddrs(const Zone& zone, const Name& qname,
// Find AAAA rrset
if (qname_ != qname || qtype_ != RRType::AAAA()) {
Zone::FindResult aaaa_result =
ZoneFinder::FindResult aaaa_result =
zone.find(qname, RRType::AAAA(), NULL, options);
if (aaaa_result.code == Zone::SUCCESS) {
if (aaaa_result.code == ZoneFinder::SUCCESS) {
response_.addRRset(Message::SECTION_ADDITIONAL,
boost::const_pointer_cast<RRset>(aaaa_result.rrset));
}
......@@ -86,10 +86,10 @@ Query::findAddrs(const Zone& zone, const Name& qname,
}
void
Query::putSOA(const Zone& zone) const {
Zone::FindResult soa_result(zone.find(zone.getOrigin(),
Query::putSOA(const ZoneFinder& zone) const {
ZoneFinder::FindResult soa_result(zone.find(zone.getOrigin(),
RRType::SOA()));
if (soa_result.code != Zone::SUCCESS) {
if (soa_result.code != ZoneFinder::SUCCESS) {
isc_throw(NoSOA, "There's no SOA record in zone " <<
zone.getOrigin().toText());
} else {
......@@ -104,11 +104,12 @@ Query::putSOA(const Zone& zone) const {
}
void
Query::getAuthAdditional(const Zone& zone) const {
Query::getAuthAdditional(const ZoneFinder& zone) const {
// Fill in authority and addtional sections.
Zone::FindResult ns_result = zone.find(zone.getOrigin(), RRType::NS());
ZoneFinder::FindResult ns_result = zone.find(zone.getOrigin(),
RRType::NS());
// zone origin name should have NS records
if (ns_result.code != Zone::SUCCESS) {
if (ns_result.code != ZoneFinder::SUCCESS) {
isc_throw(NoApexNS, "There's no apex NS records in zone " <<
zone.getOrigin().toText());
} else {
......@@ -145,11 +146,10 @@ Query::process() const {
while (keep_doing) {
keep_doing = false;
std::auto_ptr<RRsetList> target(qtype_is_any ? new RRsetList : NULL);
const Zone::FindResult db_result(result.zone->find(qname_, qtype_,
target.get()));
const ZoneFinder::FindResult db_result(
result.zone_finder->find(qname_, qtype_, target.get()));
switch (db_result.code) {
case Zone::DNAME: {
case ZoneFinder::DNAME: {
// First, put the dname into the answer
response_.addRRset(Message::SECTION_ANSWER,
boost::const_pointer_cast<RRset>(db_result.rrset));
......@@ -191,7 +191,7 @@ Query::process() const {
response_.addRRset(Message::SECTION_ANSWER, cname);
break;
}
case Zone::CNAME:
case ZoneFinder::CNAME:
/*
* We don't do chaining yet. Therefore handling a CNAME is
* mostly the same as handling SUCCESS, but we didn't get
......@@ -204,46 +204,46 @@ Query::process() const {
response_.addRRset(Message::SECTION_ANSWER,
boost::const_pointer_cast<RRset>(db_result.rrset));
break;
case Zone::SUCCESS:
case ZoneFinder::SUCCESS:
if (qtype_is_any) {
// If quety type is ANY, insert all RRs under the domain
// into answer section.
BOOST_FOREACH(RRsetPtr rrset, *target) {
response_.addRRset(Message::SECTION_ANSWER, rrset);
// Handle additional for answer section
getAdditional(*result.zone, *rrset.get());
getAdditional(*result.zone_finder, *rrset.get());
}
} else {
response_.addRRset(Message::SECTION_ANSWER,
boost::const_pointer_cast<RRset>(db_result.rrset));
// Handle additional for answer section
getAdditional(*result.zone, *db_result.rrset);
getAdditional(*result.zone_finder, *db_result.rrset);
}
// If apex NS records haven't been provided in the answer
// section, insert apex NS records into the authority section
// and AAAA/A RRS of each of the NS RDATA into the additional
// section.
if (qname_ != result.zone->getOrigin() ||
db_result.code != Zone::SUCCESS ||
if (qname_ != result.zone_finder->getOrigin() ||
db_result.code != ZoneFinder::SUCCESS ||
(qtype_ != RRType::NS() && !qtype_is_any))
{
getAuthAdditional(*result.zone);
getAuthAdditional(*result.zone_finder);
}
break;
case Zone::DELEGATION:
case ZoneFinder::DELEGATION:
response_.setHeaderFlag(Message::HEADERFLAG_AA, false);
response_.addRRset(Message::SECTION_AUTHORITY,
boost::const_pointer_cast<RRset>(db_result.rrset));
getAdditional(*result.zone, *db_result.rrset);
getAdditional(*result.zone_finder, *db_result.rrset);
break;
case Zone::NXDOMAIN:
case ZoneFinder::NXDOMAIN:
// Just empty answer with SOA in authority section
response_.setRcode(Rcode::NXDOMAIN());
putSOA(*result.zone);
putSOA(*result.zone_finder);
break;
case Zone::NXRRSET:
case ZoneFinder::NXRRSET:
// Just empty answer with SOA in authority section
putSOA(*result.zone);
putSOA(*result.zone_finder);
break;
}
}
......
......@@ -71,7 +71,7 @@ private:
/// Adds a SOA of the zone into the authority zone of response_.
/// Can throw NoSOA.
///
void putSOA(const isc::datasrc::Zone& zone) const;
void putSOA(const isc::datasrc::ZoneFinder& zone) const;
/// \brief Look up additional data (i.e., address records for the names
/// included in NS or MX records).
......@@ -83,11 +83,11 @@ private:
/// This method may throw a exception because its underlying methods may
/// throw exceptions.
///
/// \param zone The Zone wherein the additional data to the query is bo be
/// \param zone The ZoneFinder wherein the additional data to the query is bo be
/// found.
/// \param rrset The RRset (i.e., NS or MX rrset) which require additional
/// processing.
void getAdditional(const isc::datasrc::Zone& zone,
void getAdditional(const isc::datasrc::ZoneFinder& zone,
const isc::dns::RRset& rrset) const;
/// \brief Find address records for a specified name.
......@@ -102,18 +102,18 @@ private:
/// The glue records must exactly match the name in the NS RDATA, without
/// CNAME or wildcard processing.
///
/// \param zone The \c Zone wherein the address records is to be found.
/// \param zone The \c ZoneFinder wherein the address records is to be found.
/// \param qname The name in rrset RDATA.
/// \param options The search options.
void findAddrs(const isc::datasrc::Zone& zone,
void findAddrs(const isc::datasrc::ZoneFinder& zone,
const isc::dns::Name& qname,
const isc::datasrc::Zone::FindOptions options
= isc::datasrc::Zone::FIND_DEFAULT) const;
const isc::datasrc::ZoneFinder::FindOptions options
= isc::datasrc::ZoneFinder::FIND_DEFAULT) const;
/// \brief Look up \c Zone's NS and address records for the NS RDATA
/// \brief Look up \c ZoneFinder's NS and address records for the NS RDATA
/// (domain name) for authoritative answer.
///
/// On returning an authoritative answer, insert the \c Zone's NS into the
/// On returning an authoritative answer, insert the \c ZoneFinder's NS into the
/// authority section and AAAA/A RRs of each of the NS RDATA into the
/// additional section.
///
......@@ -126,9 +126,9 @@ private:
/// include AAAA/A RRs under a zone cut in additional section. (BIND 9
/// excludes under-cut RRs; NSD include them.)
///
/// \param zone The \c Zone wherein the additional data to the query is to
/// \param zone The \c ZoneFinder wherein the additional data to the query is to
/// be found.
void getAuthAdditional(const isc::datasrc::Zone& zone) const;
void getAuthAdditional(const isc::datasrc::ZoneFinder& zone) const;
public:
/// Constructor from query parameters.
......
......@@ -111,17 +111,17 @@ TEST_F(AuthCommandTest, shutdown) {
void
zoneChecks(AuthSrv& server) {
EXPECT_TRUE(server.getMemoryDataSrc(RRClass::IN()));
EXPECT_EQ(Zone::SUCCESS, server.getMemoryDataSrc(RRClass::IN())->
findZone(Name("ns.test1.example")).zone->
EXPECT_EQ(ZoneFinder::SUCCESS, server.getMemoryDataSrc(RRClass::IN())->
findZone(Name("ns.test1.example")).zone_finder->
find(Name("ns.test1.example"), RRType::A()).code);
EXPECT_EQ(Zone::NXRRSET, server.getMemoryDataSrc(RRClass::IN())->
findZone(Name("ns.test1.example")).zone->
EXPECT_EQ(ZoneFinder::NXRRSET, server.getMemoryDataSrc(RRClass::IN())->
findZone(Name("ns.test1.example")).zone_finder->
find(Name("ns.test1.example"), RRType::AAAA()).code);
EXPECT_EQ(Zone::SUCCESS, server.getMemoryDataSrc(RRClass::IN())->
findZone(Name("ns.test2.example")).zone->
EXPECT_EQ(ZoneFinder::SUCCESS, server.getMemoryDataSrc(RRClass::IN())->
findZone(Name("ns.test2.example")).zone_finder->
find(Name("ns.test2.example"), RRType::A()).code);
EXPECT_EQ(Zone::NXRRSET, server.getMemoryDataSrc(RRClass::IN())->
findZone(Name("ns.test2.example")).zone->
EXPECT_EQ(ZoneFinder::NXRRSET, server.getMemoryDataSrc(RRClass::IN())->
findZone(Name("ns.test2.example")).zone_finder->
find(Name("ns.test2.example"), RRType::AAAA()).code);
}
......@@ -148,20 +148,20 @@ configureZones(AuthSrv& server) {
void
newZoneChecks(AuthSrv& server) {
EXPECT_TRUE(server.getMemoryDataSrc(RRClass::IN()));
EXPECT_EQ(Zone::SUCCESS, server.getMemoryDataSrc(RRClass::IN())->
findZone(Name("ns.test1.example")).zone->
EXPECT_EQ(ZoneFinder::SUCCESS, server.getMemoryDataSrc(RRClass::IN())->
findZone(Name("ns.test1.example")).zone_finder->
find(Name("ns.test1.example"), RRType::A()).code);
// now test1.example should have ns/AAAA
EXPECT_EQ(Zone::SUCCESS, server.getMemoryDataSrc(RRClass::IN())->
findZone(Name("ns.test1.example")).zone->
EXPECT_EQ(ZoneFinder::SUCCESS, server.getMemoryDataSrc(RRClass::IN())->
findZone(Name("ns.test1.example")).zone_finder->
find(Name("ns.test1.example"), RRType::AAAA()).code);
// test2.example shouldn't change
EXPECT_EQ(Zone::SUCCESS, server.getMemoryDataSrc(RRClass::IN())->
findZone(Name("ns.test2.example")).zone->
EXPECT_EQ(ZoneFinder::SUCCESS, server.getMemoryDataSrc(RRClass::IN())->
findZone(Name("ns.test2.example")).zone_finder->
find(Name("ns.test2.example"), RRType::A()).code);
EXPECT_EQ(Zone::NXRRSET, server.getMemoryDataSrc(RRClass::IN())->
findZone(Name("ns.test2.example")).zone->
EXPECT_EQ(ZoneFinder::NXRRSET, server.getMemoryDataSrc(RRClass::IN())->
findZone(Name("ns.test2.example")).zone_finder->
find(Name("ns.test2.example"), RRType::AAAA()).code);
}
......
......@@ -181,8 +181,8 @@ TEST_F(MemoryDatasrcConfigTest, addOneZone) {
EXPECT_NO_THROW(parser->commit());
EXPECT_EQ(1, server.getMemoryDataSrc(rrclass)->getZoneCount());
// Check it actually loaded something
EXPECT_EQ(Zone::SUCCESS, server.getMemoryDataSrc(rrclass)->findZone(
Name("ns.example.com.")).zone->find(Name("ns.example.com."),
EXPECT_EQ(ZoneFinder::SUCCESS, server.getMemoryDataSrc(rrclass)->findZone(
Name("ns.example.com.")).zone_finder->find(Name("ns.example.com."),
RRType::A()).code);
}
......
......@@ -103,9 +103,9 @@ const char* const other_zone_rrs =
// will result in DNAME.
// This mock zone doesn't handle empty non terminal nodes (if we need to test
// such cases find() should have specialized code for it).
class MockZone : public Zone {
class MockZoneFinder : public ZoneFinder {
public:
MockZone() :
MockZoneFinder() :
origin_(Name("example.com")),
delegation_name_("delegation.example.com"),
dname_name_("dname.example.com"),
......@@ -120,7 +120,7 @@ public:
other_zone_rrs;
masterLoad(zone_stream, origin_, rrclass_,
boost::bind(&MockZone::loadRRset, this, _1));
boost::bind(&MockZoneFinder::loadRRset, this, _1));
}
virtual const isc::dns::Name& getOrigin() const { return (origin_); }
virtual const isc::dns::RRClass& getClass() const { return (rrclass_); }
......@@ -163,9 +163,9 @@ private:
const RRClass rrclass_;
};
Zone::FindResult
MockZone::find(const Name& name, const RRType& type,
RRsetList* target, const FindOptions options) const
ZoneFinder::FindResult
MockZoneFinder::find(const Name& name, const RRType& type,
RRsetList* target, const FindOptions options) const
{
// Emulating a broken zone: mandatory apex RRs are missing if specifically
// configured so (which are rare cases).
......@@ -233,10 +233,10 @@ protected:
response.setRcode(Rcode::NOERROR());
response.setOpcode(Opcode::QUERY());
// create and add a matching zone.
mock_zone = new MockZone();
memory_datasrc.addZone(ZonePtr(mock_zone));
mock_finder = new MockZoneFinder();
memory_datasrc.addZone(ZoneFinderPtr(mock_finder));
}
MockZone* mock_zone;
MockZoneFinder* mock_finder;
MemoryDataSrc memory_datasrc;
const Name qname;
const RRClass qclass;
......@@ -346,7 +346,7 @@ TEST_F(QueryTest, apexAnyMatch) {
"example.com. 3600 IN NS glue.delegation.example.com.\n"
"example.com. 3600 IN NS noglue.example.com.\n"
"example.com. 3600 IN NS example.net.\n",
NULL, ns_addrs_txt, mock_zone->getOrigin());
NULL, ns_addrs_txt, mock_finder->getOrigin());
}
TEST_F(QueryTest, mxANYMatch) {
......@@ -368,7 +368,7 @@ TEST_F(QueryTest, nodomainANY) {
EXPECT_NO_THROW(Query(memory_datasrc, Name("nxdomain.example.com"),
RRType::ANY(), response).process());
responseCheck(response, Rcode::NXDOMAIN(), AA_FLAG, 0, 1, 0,
NULL, soa_txt, NULL, mock_zone->getOrigin());
NULL, soa_txt, NULL, mock_finder->getOrigin());
}
// This tests that when we need to look up Zone's apex NS records for
......@@ -376,7 +376,7 @@ TEST_F(QueryTest, nodomainANY) {
// throw in that case.
TEST_F(QueryTest, noApexNS) {
// Disable apex NS record
mock_zone->setApexNSFlag(false);
mock_finder->setApexNSFlag(false);
EXPECT_THROW(Query(memory_datasrc, Name("noglue.example.com"), qtype,
response).process(), Query::NoApexNS);
......@@ -395,7 +395,7 @@ TEST_F(QueryTest, nxdomain) {
EXPECT_NO_THROW(Query(memory_datasrc, Name("nxdomain.example.com"), qtype,
response).process());
responseCheck(response, Rcode::NXDOMAIN(), AA_FLAG, 0, 1, 0,
NULL, soa_txt, NULL, mock_zone->getOrigin());
NULL, soa_txt, NULL, mock_finder->getOrigin());
}
TEST_F(QueryTest, nxrrset) {
......@@ -403,7 +403,7 @@ TEST_F(QueryTest, nxrrset) {
RRType::TXT(), response).process());
responseCheck(response, Rcode::NOERROR(), AA_FLAG, 0, 1, 0,
NULL, soa_txt, NULL, mock_zone->getOrigin());
NULL, soa_txt, NULL, mock_finder->getOrigin());
}
/*
......@@ -412,7 +412,7 @@ TEST_F(QueryTest, nxrrset) {
*/
TEST_F(QueryTest, noSOA) {
// disable zone's SOA RR.
mock_zone->setSOAFlag(false);
mock_finder->setSOAFlag(false);
// The NX Domain
EXPECT_THROW(Query(memory_datasrc, Name("nxdomain.example.com"),
......@@ -620,7 +620,7 @@ TEST_F(QueryTest, DNAME_NX_RRSET) {
RRType::TXT(), response).process());
responseCheck(response, Rcode::NOERROR(), AA_FLAG, 0, 1, 0,
NULL, soa_txt, NULL, mock_zone->getOrigin());
NULL, soa_txt, NULL, mock_finder->getOrigin());
}
/*
......
......@@ -32,10 +32,10 @@ using namespace isc::dns;
namespace isc {
namespace datasrc {
// Private data and hidden methods of MemoryZone
struct MemoryZone::MemoryZoneImpl {
// Private data and hidden methods of MemoryZoneFinder
struct MemoryZoneFinder::MemoryZoneFinderImpl {
// Constructor
MemoryZoneImpl(const RRClass& zone_class, const Name& origin) :
MemoryZoneFinderImpl(const RRClass& zone_class, const Name& origin) :
zone_class_(zone_class), origin_(origin), origin_data_(NULL),
domains_(true)
{
......@@ -223,7 +223,7 @@ struct MemoryZone::MemoryZoneImpl {
* Implementation of longer methods. We put them here, because the
* access is without the impl_-> and it will get inlined anyway.
*/
// Implementation of MemoryZone::add
// Implementation of MemoryZoneFinder::add
result::Result add(const ConstRRsetPtr& rrset, DomainTree* domains) {
// Sanitize input. This will cause an exception to be thrown
// if the input RRset is empty.
......@@ -409,7 +409,7 @@ struct MemoryZone::MemoryZoneImpl {
}
}
// Implementation of MemoryZone::find
// Implementation of MemoryZoneFinder::find
FindResult find(const Name& name, RRType type,
RRsetList* target, const FindOptions options) const
{
......@@ -593,50 +593,50 @@ struct MemoryZone::MemoryZoneImpl {
}
};
MemoryZone::MemoryZone(const RRClass& zone_class, const Name& origin) :
impl_(new MemoryZoneImpl(zone_class, origin))
MemoryZoneFinder::MemoryZoneFinder(const RRClass& zone_class, const Name& origin) :
impl_(new MemoryZoneFinderImpl(zone_class, origin))
{
LOG_DEBUG(logger, DBG_TRACE_BASIC, DATASRC_MEM_CREATE).arg(origin).
arg(zone_class);
}
MemoryZone::~MemoryZone() {
MemoryZoneFinder::~MemoryZoneFinder() {
LOG_DEBUG(logger, DBG_TRACE_BASIC, DATASRC_MEM_DESTROY).arg(getOrigin()).
arg(getClass());
delete impl_;
}
const Name&
MemoryZone::getOrigin() const {
MemoryZoneFinder::getOrigin() const {
return (impl_->origin_);
}
const RRClass&
MemoryZone::getClass() const {
MemoryZoneFinder::getClass() const {
return (impl_->zone_class_);
}
Zone::FindResult
MemoryZone::find(const Name& name, const RRType& type,
ZoneFinder::FindResult
MemoryZoneFinder::find(const Name& name, const RRType& type,
RRsetList* target, const FindOptions options) const
{
return (impl_->find(name, type, target, options));
}
result::Result
MemoryZone::add(const ConstRRsetPtr& rrset) {
MemoryZoneFinder::add(const ConstRRsetPtr& rrset) {
return (impl_->add(rrset, &impl_->domains_));
}
void
MemoryZone::load(const string& filename) {
MemoryZoneFinder::load(const string& filename) {
LOG_DEBUG(logger, DBG_TRACE_BASIC, DATASRC_MEM_LOAD).arg(getOrigin()).
arg(filename);
// Load it into a temporary tree
MemoryZoneImpl::DomainTree tmp;
MemoryZoneFinderImpl::DomainTree tmp;
masterLoad(filename.c_str(), getOrigin(), getClass(),
boost::bind(&MemoryZoneImpl::addFromLoad, impl_, _1, &tmp));
boost::bind(&MemoryZoneFinderImpl::addFromLoad, impl_, _1, &tmp));
// If it went well, put it inside
impl_->file_name_ = filename;
tmp.swap(impl_->domains_);
......@@ -644,14 +644,14 @@ MemoryZone::load(const string& filename) {
}
void
MemoryZone::swap(MemoryZone& zone) {
MemoryZoneFinder::swap(MemoryZoneFinder& zone) {
LOG_DEBUG(logger, DBG_TRACE_BASIC, DATASRC_MEM_SWAP).arg(getOrigin()).
arg(zone.getOrigin());
std::swap(impl_, zone.impl_);
}
const string
MemoryZone::getFileName() const {
MemoryZoneFinder::getFileName() const {
return (impl_->file_name_);
}
......@@ -659,7 +659,7 @@ MemoryZone::getFileName() const {
/// interface.
///
/// For now, \c MemoryDataSrc only contains a \c ZoneTable object, which
/// consists of (pointers to) \c MemoryZone objects, we may add more
/// consists of (pointers to) \c MemoryZoneFinder objects, we may add more
/// member variables later for new features.
class MemoryDataSrc::MemoryDataSrcImpl {
public:
......@@ -681,7 +681,7 @@ MemoryDataSrc::getZoneCount() const {
}
result::Result
MemoryDataSrc::addZone(ZonePtr zone) {
MemoryDataSrc::addZone(ZoneFinderPtr zone) {
if (!zone) {
isc_throw(InvalidParameter,
"Null pointer is passed to MemoryDataSrc::addZone()");
......
......@@ -17,6 +17,8 @@
#include <string>
#include <boost/noncopyable.hpp>
#include <datasrc/zonetable.h>
namespace isc {
......@@ -28,17 +30,16 @@ class RRsetList;
namespace datasrc {
/// A derived zone class intended to be used with the memory data source.
class MemoryZone : public Zone {
///
/// Conceptually this "finder" maintains a local in-memory copy of all RRs
/// of a single zone from some kind of source (right now it's a textual
/// master file, but it could also be another data source with a database
/// backend). This is why the class has methods like \c load() or \c add().
///
/// This class is non copyable.
class MemoryZoneFinder : boost::noncopyable, public ZoneFinder {
///
/// \name Constructors and Destructor.
///
/// \b Note:
/// The copy constructor and the assignment operator are intentionally
/// defined as private, making this class non copyable.
//@{
private:
MemoryZone(const MemoryZone& source);
MemoryZone& operator=(const MemoryZone& source);
public:
/// \brief Constructor from zone parameters.
///
......@@ -48,10 +49,11 @@ public:
///
/// \param rrclass The RR class of the zone.
/// \param origin The origin name of the zone.
MemoryZone(const isc::dns::RRClass& rrclass, const isc::dns::Name& origin);
MemoryZoneFinder(const isc::dns::RRClass& rrclass,
const isc::dns::Name& origin);
/// The destructor.
virtual ~MemoryZone();
virtual ~MemoryZoneFinder();