gerlowskija commented on pull request #81:
URL: https://github.com/apache/solr/pull/81#issuecomment-854319415


   I've tentatively pushed a fix for the api-overwriting problem I described in 
my last comment.  The fix I ended up using is as follows:
   
   1. Add a method to PathTrie, `attachValueToNode`, to encapsulate storing an 
object at a given node.  As written in PathTrie this storage uses the same 
"overwriting" semantics that PathTrie has had up to this point.  But having 
this abstracted in a method allows subclasses of PathTrie to modify this 
behavior as needed.
   2. Create a PathTrie subclass within ApiBag called 
`CommandAggregatingPathTrie`.  This subclass overrides `attachValueToNode` to 
combine AnnotatedApi instances together instead of overwriting previously 
registered values.
   3. The actual "combination" logic lives in a class 
`CommandAggregatingAnnotatedApi extends AnnotatedApi`.
   
   I decided on this approach because it maintains some of the abstractions 
that seemed important.  e.g. PathTrie is saved from needing to know anything 
about Apis or how to combine them.  Combining logic is largely handled by 
ApiBag, which makes some sense since it's responsible for the registration and 
storage in the first place. etc.
   
   That said, this was a "best guess" solution, and I'm not especially attached 
to it.  Very open to feedback here.
   
   With this blocker taken care of I'm hoping to split out the Api classes in 
the next day or two, and then this should be ready to go.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to