libknot refactoring
RRSet refactoring
Add a possibility to use custom allocators⌛ Rewrite unittests-
Refactor functionsThefree
functions need a bit of work (i.e. get rid of the 1,0 parameters)
- Remove, in this order:
rrset->rrsigs
- This bloats the code big time, and is a source of endless stream of bugs. Hopefully, performance drop will be negligible. Amount of work to do this: a lot.-
Do not storerrset->owner
inknot_rrset_t
structure, or create a new structureknot_node_rr_t
without theowner
field.I'd like to seenode = (owner, meta, rdataset_t)
andrrset = (owner, rdataset_t)
we can use rrsets when we parse packets and then take only therdataset_t
part if you want to keep libknot tidy by usingrrset_t
as it is now. @mvavrusa
-
Get rid of RDATA helper fields, store RDATA indices intoend with '\0' - this gets rid ofrrset->rdata
field,rrset->rdata_count
, since we usually (but not always, e.g. when deleting particular RR) want to access all RRs in RRSet.
-
moverrset-dump is used in knot utils!rrset-dump.c
fromlibknot
toknot
- it is used only by the server @jkadlec : I think this is a neat functionality to have in the library, if nothing else, our future resolver will use it (if we're talking about actual text dump, if we're talking about a debug function, that one can be deleted without looking back twice) -
MoveThe field is still there, but the actual information is stored elsewhere, the field is only used for passing the information. Should still drop if we want clean libknot.rrset->additionals
out of libknot (be it node or the refactored structure)
Node refactoring
- Add a possibility to use custom allocators
Rewrite unittests-
Remove:-
node->wildcard_child
, store it as a flag.@lslovak: I don't really get how this could be stored as a flag. The reference to the wildcard child is used in several places. Or this should be replaced by searching in zone for * ancestor of the node? Then even the flag is not necessary.Will drop the reference. The flag will mark a node whose wildcard child exists, thus should be searched for. This reduces the amount of searches to minimum (only in case there actually is a wildcard child). That's reasonable. (see issue #216 (closed)) -
Due to alignment issues this will not reduce memory footprint.node->rrset_count
-node->rrset_tree
will be ended by NULL pointer, iterations will need to change. @lslovak OK, sounds reasonable. It seems that only values which are ever checked are 0, 1 and > 0, and all would be easily checked also after this change.- On the other hand, if the
rrset_tree
is ordered by type and we know the count, we could search it using binary search if that is of any help. @lslovak: IMHO not very useful, there aren't many types of RRSets in each node.
- On the other hand, if the
-
node->parent
+node->children_count
- this is questionable, but it might be possible.- I wouldn't bother with this so much, you can use refcounting for this purpose and a
refcount > 1 => has children
@lslovak: I don't get it. References may be anywhere in the code, so > 1 doesn't necessarily mean that besides reference from zone tree there is also a reference from child. I don't see an easy way to get rid of these two fields.
- I wouldn't bother with this so much, you can use refcounting for this purpose and a
-
Zone refactoring
-
Remove791d0da8 @jkadlec:zone->contents->zone->contents
...💌 -
Following stuff only valid if we remove zones from libknot:
✅ -
andflags
field not needed in zone contents. Some relicts from XFR are stored there,ANY on/off - can be extracted from config.a067337d - Remove
zone->name
, stored in config.Remove!158 (merged)zone->data
and destructor,zonedata_t
can be a direct part of the structure.
-
- Zone lookup provides too much data and too many functions
- Zone should have NO concept of encloser or previous authoritative, as they are needed only for denial of existence proofs
- Zone should find an exact match or canonical/lexicographical previous node (this is what every answer needs)
- Proof function should look up encloser or previous authoritative, should it be needed (this is what some answers need)
- Merge
zone_t
andcontents_t
- but only after new zone API is done.