[bind10-dev] iterator type zone loader

Michal 'vorner' Vaner michal.vaner at nic.cz
Mon Apr 30 07:28:04 UTC 2012


Hello

On Thu, Apr 26, 2012 at 06:56:54PM +0000, JINMEI Tatuya / 神明達哉 wrote:
> - 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_;
> };

Yes, something like this. I'd still argue that returning a single RR instead of
accumulating the whole RRset is better (so if someone incorrectly relies on the
loader collating all the RRs of the same RRset together, it breaks sooner than
later), but that's a different detail.

> 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).

Yes, and you can do other things. If you can rely on the RRs to be in some
specific order, you can go and compare two zone files without loading them into
memory with the iterator, for example. And changing it to the „load everything
and call callbacks“ can be done by a simple loop.

With regards

-- 
This email has not been checked by an antivirus system.
No virus found.

Michal 'vorner' Vaner
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <https://lists.isc.org/pipermail/bind10-dev/attachments/20120430/257a1736/attachment.bin>


More information about the bind10-dev mailing list