[bind10-dev] Ruminations on difference normalization (#1456)
JINMEI Tatuya / 神明達哉
jinmei at isc.org
Fri Dec 16 07:26:58 UTC 2011
At Thu, 15 Dec 2011 09:53:47 +0100,
Jelte Jansen <jelte at isc.org> wrote:
> >> O yes, it would definitely be in the layer that we make which talks to
> >> the actual backend db. Within the current code I'm thinking that would
> >> be in or on the level of database.cc.
> >
> > I mean even more generic layer. This is for all the database backends, but not
> > for datasource backends that are updatable, like data stored in a git, to name
> > some crazy ideas. There are potentially more datasources than database ones and
> > in-memory one ;-).
>
> Ah, yes, as such, that was one of the cons of extending the ZoneUpdater,
> since database.cc is currently where its only implementation lives.
Actually, the undocumented design intent is that if and when we want
to support a common higher level behavior for multiple different types
of data sources, we'll extract that into the base class and then
delegate data source specific considerations to each derived class.
In fact, for example, what DatabaseUpdater::validateAddOrDelete() does
is not specific to database backended data sources. For now, it's
defined as part of the derived class simply because it's the only type
of data source that supports writability (and so we can avoid
over-generalization). If and when see real need for extending
writability support for other types of data sources,
validateAddOrDelete() would be promoted as part of the base
ZoneUpdater class:
class ZoneUpdater {
public:
// right now this is pure virtual. But in the new design it's not
// even virtual.
void addRRset(rrset) {
validateAddOrDelete();
addRRsetImpl(rrset);
}
protected:
// In the revised design data source dependent behavior is provided
// in a virtual protected method:
virtual void addRRsetImpl(rrset) = 0;
};
I believe the features such as diff sorting or SOA update are also
backend independent and could be implemented that way (whether or not
we should include it in the updater class is a different question).
---
JINMEI, Tatuya
More information about the bind10-dev
mailing list