BIND 10 trac2209, updated. 4a9e338f845772c9a0888a276c30449f89beea9c [2209] Skeleton of the getCachedZoneWriter method
BIND 10 source code commits
bind10-changes at lists.isc.org
Wed Oct 24 12:57:28 UTC 2012
The branch, trac2209 has been updated
via 4a9e338f845772c9a0888a276c30449f89beea9c (commit)
from a92defd1deceebc13a7bcc93cee6579ed42be41e (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 4a9e338f845772c9a0888a276c30449f89beea9c
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date: Wed Oct 24 14:54:44 2012 +0200
[2209] Skeleton of the getCachedZoneWriter method
It is mostly copy of the reload() method. Currently, it does not contain
the initialization of load_action for the zone writer, so if a real zone
writer is returned, it doesn't work (it throws). But the tests for the
unsuccessful cases succeed.
There's also need to do something about the duplicate code between this
method and the reload(). Later on, we'll probably rewrite reload to use
the ZoneWriter (and even later deprecate reload, maybe? Or keep it as
the thin wrapper for convenience?)
-----------------------------------------------------------------------
Summary of changes:
src/lib/datasrc/client_list.cc | 46 ++++++++++++++++++++++++++++++++++++----
1 file changed, 42 insertions(+), 4 deletions(-)
-----------------------------------------------------------------------
diff --git a/src/lib/datasrc/client_list.cc b/src/lib/datasrc/client_list.cc
index cf96a47..744776b 100644
--- a/src/lib/datasrc/client_list.cc
+++ b/src/lib/datasrc/client_list.cc
@@ -12,14 +12,16 @@
// OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
// PERFORMANCE OF THIS SOFTWARE.
-#include <util/memory_segment_local.h>
#include "client_list.h"
#include "client.h"
#include "factory.h"
#include "memory/memory_client.h"
+#include "memory/zone_table_segment.h"
+#include "memory/zone_writer.h"
#include "logger.h"
#include <dns/masterload.h>
+#include <util/memory_segment_local.h>
#include <memory>
#include <boost/foreach.hpp>
@@ -377,9 +379,45 @@ ConfigurableClientList::reload(const Name& name) {
}
ConfigurableClientList::ZoneWriterPair
-ConfigurableClientList::getCachedZoneWriter(const Name& ) {
- // TODO: Just for now.
- return (ZoneWriterPair(CACHE_DISABLED, ZoneWriterPtr()));
+ConfigurableClientList::getCachedZoneWriter(const Name& name) {
+ if (!allow_cache_) {
+ return (ZoneWriterPair(CACHE_DISABLED, ZoneWriterPtr()));
+ }
+ // Try to find the correct zone.
+ MutableResult result;
+ findInternal(result, name, true, true);
+ if (!result.finder) {
+ return (ZoneWriterPair(ZONE_NOT_FOUND, ZoneWriterPtr()));
+ }
+ // Try to get the in-memory cache for the zone. If there's none,
+ // we can't provide the result.
+ if (!result.info->cache_) {
+ return (ZoneWriterPair(ZONE_NOT_CACHED, ZoneWriterPtr()));
+ }
+ memory::LoadAction load_action;
+ DataSourceClient* client(result.info->data_src_client_);
+ if (client) {
+ // Now finally provide the writer.
+ // If it does not exist in client,
+ // DataSourceError is thrown, which is exactly the result what we
+ // want, so no need to handle it.
+ ZoneIteratorPtr iterator(client->getIterator(name));
+ if (!iterator) {
+ isc_throw(isc::Unexpected, "Null iterator from " << name);
+ }
+ // TODO
+ } else {
+ // The MasterFiles special case
+ const string filename(result.info->cache_->getFileName(name));
+ if (filename.empty()) {
+ isc_throw(isc::Unexpected, "Confused about missing both filename "
+ "and data source");
+ }
+ // TODO
+ }
+ return (ZoneWriterPair(ZONE_RELOADED,
+ ZoneWriterPtr(result.info->cache_->getZoneTableSegment().
+ getZoneWriter(load_action, name, rrclass_))));
}
// NOTE: This function is not tested, it would be complicated. However, the
More information about the bind10-changes
mailing list