-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
iter branch #4
Comments
I think we need to leave this up to the caller and supply Key() and Children() methods so that a caller can create their own iterator... |
Just so I understand what Iter() is doing: it returns a channel where all the children of the caller node arrive at? why a channel? How about just a function As to the 'full key' problem: add A combination of both should work for you, right? Edit: Oh I just realized: we already have such a |
I've commited some more stuff to this branch. I think I "cracked" it. About adding a parent pointer, yes you can do that, but the beauty of radix trees is that they are memory efficient, so keeping *Radix small is worth while. |
Yep that were my thoughts when writing it in the first place :). I'm starting to think that for your use case it would be a lot easier to just have the fields Value, Key and Children exported. Also, right now |
renamed find to Find. Get() sound too much like the Getter/Setter stuff from Java... I like Find() better :-) Shall I merge branch iter with master? |
yup looks good |
ok, done |
Hi,
I've created an Iter() function, which I need in code using this radix tree, i.e I want to be able to "walk the tree" and do something with each node. See https://github.com/miekg/dns/blob/dev/zone.go for instance.
The problem I have now is that Iter() works and return *Radix, but each *Radix.key is only partial (that's the beauty of radix tree), but I need the full key... Any bright ideas on how to proceed? May a func (r *Radix) FullKey() function or something?
If this works, we can drop FindKey and let Find return an *Radix. Value needs to be exported again, so callers can see/modify it.
The text was updated successfully, but these errors were encountered: