> On Aug. 12, 2024, 6:32 a.m., Vyom Tiwari wrote:
> > agents-common/src/main/java/org/apache/ranger/plugin/policyengine/RangerResourceTrie.java
> > Lines 1346 (patched)
> > <https://reviews.apache.org/r/75151/diff/5/?file=2292658#file2292658line1442>
> >
> >     We can simplyfy the EvalCollector<T> class as follows
> >     .It took me a while to figure it out how it is working as expected.
> >     
> >     static class EvalCollector<T>  {
> >             private Set<T>  result;
> >     
> >             public EvalCollector() {
> >                 this.result = null;
> >             }
> >     
> >             public Set<T> getResult() {
> >                 return result;
> >             }
> >     
> >             public boolean process(Set<T> evaluators) {
> >                 if (evaluators != null && !evaluators.isEmpty()) {
> >                     if (result == null) {
> >                         result = new HashSet<>(evaluators);
> >                     } else {
> >                         result.addAll(evaluators);
> >                     }
> >                 }
> >     
> >                 return false; // continue traverse
> >             }
> >         }

Often, process() is called only once per traversal. In such cases, copying of 
evaluators into results can be avoided to eliminate the overhead. Hence the 
current approach of copying only on subsequent calls to process().


- Madhan


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/75151/#review226813
-----------------------------------------------------------


On Aug. 8, 2024, 7:46 p.m., Madhan Neethiraj wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/75151/
> -----------------------------------------------------------
> 
> (Updated Aug. 8, 2024, 7:46 p.m.)
> 
> 
> Review request for ranger, Abhishek Patil, Abhishek  Kumar, Asit Vadhavkar, 
> Fateh Singh, Kishor Gollapalliwar, Abhay Kulkarni, Mehul Parikh, Pradeep 
> Agrawal, Ramesh Mani, Sailaja Polavarapu, Subhrat Chaudhary, Velmurugan 
> Periasamy, and Vyom Tiwari.
> 
> 
> Bugs: RANGER-4893
>     https://issues.apache.org/jira/browse/RANGER-4893
> 
> 
> Repository: ranger
> 
> 
> Description
> -------
> 
> - enhanced RangerResourceTrie to support handlers for matches found during 
> traversal
> - custom handlers are used to get count of matchers, collect all matchers, 
> collect matchers within a given subset
> - above enhancements are used to efficiently retrieve evaluators for 
> multi-level resources - like database/table/column
> 
> 
> Diffs
> -----
> 
>   
> agents-common/src/main/java/org/apache/ranger/plugin/policyengine/RangerResourceTrie.java
>  773a02609 
>   
> agents-common/src/main/java/org/apache/ranger/plugin/policyengine/gds/GdsDataShareEvaluator.java
>  95f06209d 
>   
> agents-common/src/main/java/org/apache/ranger/plugin/util/RangerResourceEvaluatorsRetriever.java
>  2ba8135b1 
> 
> 
> Diff: https://reviews.apache.org/r/75151/diff/5/
> 
> 
> Testing
> -------
> 
> - verified build with unit tests pass successfully
> 
> 
> Thanks,
> 
> Madhan Neethiraj
> 
>

Reply via email to