BIND 10 trac2378, updated. 87cb0214c609c0754612ebc1d9ed9ebe23a1a0c5 [2378] Simplify the loadIncremental code
BIND 10 source code commits
bind10-changes at lists.isc.org
Fri Dec 7 13:11:12 UTC 2012
The branch, trac2378 has been updated
via 87cb0214c609c0754612ebc1d9ed9ebe23a1a0c5 (commit)
via 58fefe3f7c13bca1960abbd0405ff01ae3ed8034 (commit)
from 537d5346c160136eceeae3ae4f7b2909683bf27b (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 87cb0214c609c0754612ebc1d9ed9ebe23a1a0c5
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date: Fri Dec 7 14:09:05 2012 +0100
[2378] Simplify the loadIncremental code
Some of the code can be shared between the variants, saving some code.
commit 58fefe3f7c13bca1960abbd0405ff01ae3ed8034
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date: Fri Dec 7 14:00:49 2012 +0100
[2378] Note about late detection of end
-----------------------------------------------------------------------
Summary of changes:
src/lib/datasrc/zone_loader.cc | 26 +++++++++-----------------
src/lib/datasrc/zone_loader.h | 5 +++++
2 files changed, 14 insertions(+), 17 deletions(-)
-----------------------------------------------------------------------
diff --git a/src/lib/datasrc/zone_loader.cc b/src/lib/datasrc/zone_loader.cc
index 4cb3e0d..5a36b32 100644
--- a/src/lib/datasrc/zone_loader.cc
+++ b/src/lib/datasrc/zone_loader.cc
@@ -110,26 +110,18 @@ ZoneLoader::loadIncremental(size_t limit) {
if (iterator_ == ZoneIteratorPtr()) {
assert(loader_.get() != NULL);
- if (loader_->loadIncremental(limit)) {
- complete_ = true;
- if (!loaded_ok_) {
- isc_throw(MasterFileError, "Error while loading master file");
- } else {
- updater_->commit();
- }
- return (true);
- } else {
- return (false);
+ complete_ = loader_->loadIncremental(limit);
+ if (complete_ && !loaded_ok_) {
+ isc_throw(MasterFileError, "Error while loading master file");
}
} else {
- if (copyRRsets(updater_, iterator_, limit)) {
- updater_->commit();
- complete_ = true;
- return (true);
- } else {
- return (false);
- }
+ complete_ = copyRRsets(updater_, iterator_, limit);
+ }
+
+ if (complete_) {
+ updater_->commit();
}
+ return (complete_);
}
} // end namespace datasrc
diff --git a/src/lib/datasrc/zone_loader.h b/src/lib/datasrc/zone_loader.h
index 37bc14a..2946116 100644
--- a/src/lib/datasrc/zone_loader.h
+++ b/src/lib/datasrc/zone_loader.h
@@ -133,6 +133,11 @@ public:
/// \throw DataSourceError in case some error (possibly low-level) happens.
/// \throw MasterFileError when the master_file is badly formatted or some
/// similar problem is found when loading the master file.
+ /// \note If the limit is exactly the number of RRs available to be loaded,
+ /// the method still returns false and true'll be returned on the next
+ /// call (which will load 0 RRs). This is because the end of iterator or
+ /// master file is detected when reading past the end, not when the last
+ /// one is read.
bool loadIncremental(size_t limit);
private:
/// \brief The iterator used as source of data in case of the copy mode.
More information about the bind10-changes
mailing list