BIND 10 #2906: define and implement (generic) ZoneTable class

BIND 10 Development do-not-reply at isc.org
Thu Apr 11 00:36:29 UTC 2013


#2906: define and implement (generic) ZoneTable class
-------------------------------------+-------------------------------------
                   Reporter:         |                 Owner:
  jinmei                             |                Status:  new
                       Type:  task   |             Milestone:  Next-Sprint-
                   Priority:         |  Proposed
  medium                             |              Keywords:
                  Component:  data   |             Sensitive:  0
  source                             |           Sub-Project:  DNS
               CVSS Scoring:         |  Estimated Difficulty:  0
            Defect Severity:  N/A    |           Total Hours:  0
Feature Depending on Ticket:         |
        Add Hours to Ticket:  0      |
                  Internal?:  0      |
-------------------------------------+-------------------------------------
 This is primarily a subtask of #2830, and specifically to be used
 in #2856, but is also intended to be used for generic zone management
 in data sources in future.  Better to be done after #2834.

 This is an abstraction of set of zones maintained in a data source
 or an in-memory cache of a data source.  For the scope of this task,
 this class only has one simple feature: iterating over the zones:

 {{{#!cpp
 // value type of ZoneTable::Iter::operator*
 struct ZoneSpec {
     // a unique index in the table for that particular zone.  at the
 moment
     // set it to 0.  it'll be eventually useful as a lightweight ID of
 zone
     uint32_t index;

     // The zone name.
     dns::Name name;
 };

 /// This is an abstract base class.  Database-based data source would
 /// have its own derived class, in-memory cache has its own, etc.
 class ZoneTable {
 protected:
     /// Each derived class implements this protected class so we can
     /// provide unified iterator interface.
     class Iter;
     typedef boost::shared_ptr<Iter> IterPtr;
     class Iter {
     public:
         // used for implementing operator-> and operator*
         virtual const ZoneSpec& getValue() = 0;

         // used for implementing operator++
         virtual IterPtr getNext() = 0;

         // used for implementing operator==
         virtual bool equals(Iter& other) = 0;
     };

 public:
     // return a forward iterator, pointing to the beginning of the
     // (conceptual) list of zones in the table.  this is a const iterator.
     virtual IterPtr begin() = 0;

     // return a forward iterator, pointing to the end of the list.
     // this is a const iterator.
     virtual IterPtr end() = 0;
 };
 }}}

 In this task, we define the base class and implement the in-memory
 cache version (and we'll use that version for the moment).

 Note: the in-memory cache version refers to the *configuration* of the
 cache (the `CacheConfig` class), not `memory::ZoneTable`.  In fact,
 we'll use this table to build `memory::ZoneTable`.

-- 
Ticket URL: <http://bind10.isc.org/ticket/2906>
BIND 10 Development <http://bind10.isc.org>
BIND 10 Development


More information about the bind10-tickets mailing list