BIND 10 #2105: introduce node deleter of new RBTree

BIND 10 Development do-not-reply at isc.org
Wed Aug 1 09:21:14 UTC 2012


#2105: introduce node deleter of new RBTree
-------------------------------------+-------------------------------------
                   Reporter:         |                 Owner:  muks
  jinmei                             |                Status:  reviewing
                       Type:  task   |             Milestone:
                   Priority:         |  Sprint-20120807
  medium                             |            Resolution:
                  Component:  data   |             Sensitive:  0
  source                             |           Sub-Project:  DNS
                   Keywords:         |  Estimated Difficulty:  4
            Defect Severity:  N/A    |           Total Hours:  0
Feature Depending on Ticket:         |
  scalable inmemory                  |
        Add Hours to Ticket:  0      |
                  Internal?:  0      |
-------------------------------------+-------------------------------------
Changes (by vorner):

 * owner:  vorner => muks


Comment:

 Hello

 Replying to [comment:11 muks]:
 > > - I suspect we need to pass a `MemorySegment` to the deleter's
 > >   operator() (or whatever actually deletes the data).  We'll use a
 > >   segment when we actually use it for `RdataSet`.
 >
 > Reading both this and vorner's later reply to this comment, I think it's
 best we leave it to whoever uses `DomainTree` to change the argument list
 when it's actually used. There's no interface enforced for `DeleterType`
 anyway.

 Well, it is kind of enforced, by the code calling it. If you look at this:
 {{{#!c++
 template <typename T, typename DT>
 void
 DomainTree<T, DT>::deleteAllNodes(util::MemorySegment& mem_sgmt) {
     const DT deleter;
     deleteHelper(mem_sgmt, root_.get(), deleter);
     root_ = NULL;
 }
 }}}

 Then there's no way the deleter could know which `mem_sgmt` it should use.
 It can't be a template argument, since that would make it fixed for all
 the trees. And, as the one and currently only goal of this deleter is to
 use the memory segment, I the code should be changed to:

 {{{#!c++
 template <typename T, typename DT>
 void
 DomainTree<T, DT>::deleteAllNodes(util::MemorySegment& mem_sgmt) {
     const DT deleter(mem_sgmt); // <- This is where it knows now
     deleteHelper(mem_sgmt, root_.get(), deleter);
     root_ = NULL;
 }
 }}}

 (And similar changes to other places it is used)

 > Replying to [comment:10 vorner]:
 > > But, that being said, I think we need a way to take the data out
 somehow without destruction ‒ some kind of release method.
 >
 > This can be added trivially, but do we have a use-case when it has to be
 released (and not deleted during overwrite)?

 I don't know. We probably don't. But it depends on if the header should be
 for our use inside in-memory only, or if it would be of general public
 use. In the second case, the interface would be incomplete and as the
 release would be simple, it would make no sense to create a new ticket for
 it. But I have no idea what is the direction about public interfaces at
 all.

-- 
Ticket URL: <http://bind10.isc.org/ticket/2105#comment:13>
BIND 10 Development <http://bind10.isc.org>
BIND 10 Development


More information about the bind10-tickets mailing list