Github user jpeach commented on the pull request:

    https://github.com/apache/trafficserver/pull/359#issuecomment-165326498
  
    > Note that FindParent() used to take a ParentConfigParams. Since the 
lookup policy is now spread
    > over the ParentRecord and the the config_params structures, it would be 
cleaner to condense all
    > this into a ParentSelectionPolicy object that is passed into FindParent. 
I think this would help you
    > separate the ParentSelectionStrategy from owning a ParentRecord pointer 
too, since state that the
    > strategy looks at would now be passed in.
    
    Basically this boils down to
    
    1. rename ``config_params`` to ``ParentSelectionPolicy``.
    2. The ownership of the ``ParentSelectionPolicy`` is ambiguous since all 
``ParentSelectionStrategy`` object have a pointer to it, but it is actually 
only owned by the ``ParentConfigParams``. So keep it in ``ParentConfigParams`` 
(it doesn't need to me malloc'd), and pass it to ``ParentSelectionStrategy`` 
methods as an argument. ``ParentConfigParams `` now won't implement the 
``ParentSelectionStrategy`1 interface, but it doesn't need to.
    
    ```
        class ParentConfigParams : public ConfigInfo
        {
              // implementation of functions from ParentSelectionStrategy.
             void selectParent(bool firstCall, ParentResult *result, 
RequestData *rdata) {
                return result->rec->selection_strategy->selectParent(policy, 
firstCall, result, rdata);
             }
    
        private:
          ParentSelectionPolicy policy;
        };
    ```



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to