BIND 10 trac2850_2, updated. c45efc1b129fc4b64d79040e0bec33f08658b170 [2850] Pass ZoneTableSegment by reference to the ZoneWriter constructor
BIND 10 source code commits
bind10-changes at lists.isc.org
Thu May 2 08:40:06 UTC 2013
The branch, trac2850_2 has been updated
via c45efc1b129fc4b64d79040e0bec33f08658b170 (commit)
from 4a5506ec8f3474513c7de10969628385cec138b2 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit c45efc1b129fc4b64d79040e0bec33f08658b170
Author: Mukund Sivaraman <muks at isc.org>
Date: Thu May 2 14:09:55 2013 +0530
[2850] Pass ZoneTableSegment by reference to the ZoneWriter constructor
-----------------------------------------------------------------------
Summary of changes:
src/lib/datasrc/client_list.cc | 4 ++--
src/lib/datasrc/memory/zone_writer.cc | 12 ++++++------
src/lib/datasrc/memory/zone_writer.h | 4 ++--
src/lib/datasrc/tests/client_list_unittest.cc | 7 ++++---
src/lib/datasrc/tests/memory/zone_loader_util.cc | 4 ++--
.../datasrc/tests/memory/zone_writer_unittest.cc | 4 ++--
.../datasrc/tests/zone_finder_context_unittest.cc | 2 +-
src/lib/datasrc/tests/zone_loader_unittest.cc | 2 +-
8 files changed, 20 insertions(+), 19 deletions(-)
-----------------------------------------------------------------------
diff --git a/src/lib/datasrc/client_list.cc b/src/lib/datasrc/client_list.cc
index 94aee85..19f12c0 100644
--- a/src/lib/datasrc/client_list.cc
+++ b/src/lib/datasrc/client_list.cc
@@ -155,7 +155,7 @@ ConfigurableClientList::configure(const ConstElementPtr& config,
assert(load_action); // in this loop this should be always true
try {
memory::ZoneWriter writer(
- new_data_sources.back().ztable_segment_.get(),
+ *new_data_sources.back().ztable_segment_,
load_action, zname, rrclass_);
writer.load();
writer.install();
@@ -349,7 +349,7 @@ ConfigurableClientList::getCachedZoneWriter(const Name& name) {
return (ZoneWriterPair(ZONE_SUCCESS,
ZoneWriterPtr(
new memory::ZoneWriter(
- result.info->ztable_segment_.get(),
+ *result.info->ztable_segment_,
load_action, name, rrclass_))));
}
diff --git a/src/lib/datasrc/memory/zone_writer.cc b/src/lib/datasrc/memory/zone_writer.cc
index abe2c6f..43932fe 100644
--- a/src/lib/datasrc/memory/zone_writer.cc
+++ b/src/lib/datasrc/memory/zone_writer.cc
@@ -23,7 +23,7 @@ namespace isc {
namespace datasrc {
namespace memory {
-ZoneWriter::ZoneWriter(ZoneTableSegment* segment,
+ZoneWriter::ZoneWriter(ZoneTableSegment& segment,
const LoadAction& load_action,
const dns::Name& origin,
const dns::RRClass& rrclass) :
@@ -34,7 +34,7 @@ ZoneWriter::ZoneWriter(ZoneTableSegment* segment,
zone_data_(NULL),
state_(ZW_UNUSED)
{
- if (!segment->isWritable()) {
+ if (!segment.isWritable()) {
isc_throw(isc::InvalidOperation,
"Attempt to construct ZoneWriter for a read-only segment");
}
@@ -52,7 +52,7 @@ ZoneWriter::load() {
isc_throw(isc::InvalidOperation, "Trying to load twice");
}
- zone_data_ = load_action_(segment_->getMemorySegment());
+ zone_data_ = load_action_(segment_.getMemorySegment());
if (!zone_data_) {
// Bug inside load_action_.
@@ -68,12 +68,12 @@ ZoneWriter::install() {
isc_throw(isc::InvalidOperation, "No data to install");
}
- ZoneTable* table(segment_->getHeader().getTable());
+ ZoneTable* table(segment_.getHeader().getTable());
if (!table) {
isc_throw(isc::Unexpected, "No zone table present");
}
const ZoneTable::AddResult result(table->addZone(
- segment_->getMemorySegment(),
+ segment_.getMemorySegment(),
rrclass_, origin_, zone_data_));
state_ = ZW_INSTALLED;
@@ -85,7 +85,7 @@ ZoneWriter::cleanup() {
// We eat the data (if any) now.
if (zone_data_ != NULL) {
- ZoneData::destroy(segment_->getMemorySegment(), zone_data_, rrclass_);
+ ZoneData::destroy(segment_.getMemorySegment(), zone_data_, rrclass_);
zone_data_ = NULL;
state_ = ZW_CLEANED;
}
diff --git a/src/lib/datasrc/memory/zone_writer.h b/src/lib/datasrc/memory/zone_writer.h
index c0369d3..816370e 100644
--- a/src/lib/datasrc/memory/zone_writer.h
+++ b/src/lib/datasrc/memory/zone_writer.h
@@ -48,7 +48,7 @@ public:
/// \param load_action The callback used to load data.
/// \param install_action The callback used to install the loaded zone.
/// \param rrclass The class of the zone.
- ZoneWriter(ZoneTableSegment* segment,
+ ZoneWriter(ZoneTableSegment& segment,
const LoadAction& load_action, const dns::Name& name,
const dns::RRClass& rrclass);
@@ -100,7 +100,7 @@ public:
void cleanup();
private:
- ZoneTableSegment* const segment_;
+ ZoneTableSegment& segment_;
const LoadAction load_action_;
const dns::Name origin_;
const dns::RRClass rrclass_;
diff --git a/src/lib/datasrc/tests/client_list_unittest.cc b/src/lib/datasrc/tests/client_list_unittest.cc
index 0bd58ff..2a67418 100644
--- a/src/lib/datasrc/tests/client_list_unittest.cc
+++ b/src/lib/datasrc/tests/client_list_unittest.cc
@@ -166,9 +166,10 @@ public:
// Load the data into the zone table.
if (enabled) {
boost::scoped_ptr<memory::ZoneWriter> writer(
- new memory::ZoneWriter(&(*dsrc_info.ztable_segment_),
- cache_conf->getLoadAction(rrclass_, zone),
- zone, rrclass_));
+ new memory::ZoneWriter(
+ *dsrc_info.ztable_segment_,
+ cache_conf->getLoadAction(rrclass_, zone),
+ zone, rrclass_));
writer->load();
writer->install();
writer->cleanup(); // not absolutely necessary, but just in case
diff --git a/src/lib/datasrc/tests/memory/zone_loader_util.cc b/src/lib/datasrc/tests/memory/zone_loader_util.cc
index 77f23fd..0075a65 100644
--- a/src/lib/datasrc/tests/memory/zone_loader_util.cc
+++ b/src/lib/datasrc/tests/memory/zone_loader_util.cc
@@ -44,7 +44,7 @@ loadZoneIntoTable(ZoneTableSegment& zt_sgmt, const dns::Name& zname,
" \"params\": {\"" + zname.toText() + "\": \"" + zone_file +
"\"}}"), true);
boost::scoped_ptr<memory::ZoneWriter> writer(
- new memory::ZoneWriter(&zt_sgmt,
+ new memory::ZoneWriter(zt_sgmt,
cache_conf.getLoadAction(zclass, zname),
zname, zclass));
writer->load();
@@ -77,7 +77,7 @@ loadZoneIntoTable(ZoneTableSegment& zt_sgmt, const dns::Name& zname,
const dns::RRClass& zclass, ZoneIterator& iterator)
{
boost::scoped_ptr<memory::ZoneWriter> writer(
- new memory::ZoneWriter(&zt_sgmt,
+ new memory::ZoneWriter(zt_sgmt,
IteratorLoader(zclass, zname, iterator),
zname, zclass));
writer->load();
diff --git a/src/lib/datasrc/tests/memory/zone_writer_unittest.cc b/src/lib/datasrc/tests/memory/zone_writer_unittest.cc
index 13a5537..a4b516d 100644
--- a/src/lib/datasrc/tests/memory/zone_writer_unittest.cc
+++ b/src/lib/datasrc/tests/memory/zone_writer_unittest.cc
@@ -43,7 +43,7 @@ public:
ZoneWriterTest() :
segment_(ZoneTableSegment::create(RRClass::IN(), "local")),
writer_(new
- ZoneWriter(segment_.get(),
+ ZoneWriter(*segment_,
bind(&ZoneWriterTest::loadAction, this, _1),
Name("example.org"), RRClass::IN())),
load_called_(false),
@@ -106,7 +106,7 @@ public:
TEST_F(ZoneWriterTest, constructForReadOnlySegment) {
MemorySegmentTest mem_sgmt;
ReadOnlySegment ztable_segment(RRClass::IN(), mem_sgmt);
- EXPECT_THROW(ZoneWriter(&ztable_segment,
+ EXPECT_THROW(ZoneWriter(ztable_segment,
bind(&ZoneWriterTest::loadAction, this, _1),
Name("example.org"), RRClass::IN()),
isc::InvalidOperation);
diff --git a/src/lib/datasrc/tests/zone_finder_context_unittest.cc b/src/lib/datasrc/tests/zone_finder_context_unittest.cc
index ef81896..409bdef 100644
--- a/src/lib/datasrc/tests/zone_finder_context_unittest.cc
+++ b/src/lib/datasrc/tests/zone_finder_context_unittest.cc
@@ -80,7 +80,7 @@ createInMemoryClient(RRClass zclass, const Name& zname) {
shared_ptr<ZoneTableSegment> ztable_segment(
ZoneTableSegment::create(zclass, cache_conf.getSegmentType()));
scoped_ptr<memory::ZoneWriter> writer(
- new memory::ZoneWriter(&(*ztable_segment),
+ new memory::ZoneWriter(*ztable_segment,
cache_conf.getLoadAction(zclass, zname),
zname, zclass));
writer->load();
diff --git a/src/lib/datasrc/tests/zone_loader_unittest.cc b/src/lib/datasrc/tests/zone_loader_unittest.cc
index 5fd190b..80d23b7 100644
--- a/src/lib/datasrc/tests/zone_loader_unittest.cc
+++ b/src/lib/datasrc/tests/zone_loader_unittest.cc
@@ -319,7 +319,7 @@ protected:
rrclass_, cache_conf.getSegmentType()));
if (filename) {
boost::scoped_ptr<memory::ZoneWriter> writer(
- new memory::ZoneWriter(&(*ztable_segment_),
+ new memory::ZoneWriter(*ztable_segment_,
cache_conf.getLoadAction(rrclass_, zone),
zone, rrclass_));
writer->load();
More information about the bind10-changes
mailing list