[bind10-dev] iterator type zone loader

JINMEI Tatuya / 神明達哉 jinmei at isc.org
Thu Apr 26 18:56:54 UTC 2012


There was a comment in the zone loader discussion about
"iterator(?)"-type of main loader.  Compared to the sample (and
incomplete) "masterLoad" function shown in
http://bind10.isc.org/wiki/ZoneLoadingAPIDesign#a2.1ClassesFunctionsforLoading
does that mean something like this?

- Make it an independent class with (something like) a
  "getNextRRset()" method
- this method internally runs a single iteration of the masterLoad()
  function described in the above URL and returns the first RRset it
  can build

That is,

class MasterLoad {
public:
    RRsetPtr getNextRRset() {
        while (lexer_.getToken() != MasterLexer::END_OF_FILE) {
            // get name, type, class, RDATA
	    rrset = RRsetPtr(new RRset(name, rrtype, rrclass, ttl));
            // add RDATA(s)
	    return (rrset);
        }
	return (RRsetPtr());
    }

private:
    MasterLexer lexer_;
};

If so, it may make sense now that it appears we also want to allow
some module (maybe zonemgr-ng) to be able to load a zone into the data
source, in which case we probably want to make it incremental (so that
the module can work on the loading task while handling other possible
commands/events).

---
JINMEI, Tatuya


More information about the bind10-dev mailing list