Skip to content

Commit

Permalink
Added comment
Browse files Browse the repository at this point in the history
Signed-off-by: Nils Bandener <nils.bandener@eliatra.com>
  • Loading branch information
nibix committed Oct 30, 2024
1 parent c474bf7 commit de14c67
Showing 1 changed file with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -927,6 +927,16 @@ static class StatefulIndexPrivileges {
CompactMapGroupBuilder<String, DeduplicatingCompactSubSetBuilder.SubSetBuilder<String>> indexMapBuilder =
new CompactMapGroupBuilder<>(indices.keySet(), (k2) -> roleSetBuilder.createSubSetBuilder());

// We iterate here through the present RoleV7 instances and nested through their "index_permissions" sections.
// During the loop, the actionToIndexToRoles map is being built.
// For that, action patterns from the role will be matched against the "well-known actions" to build
// a concrete action map and index patterns from the role will be matched against the present indices
// to build a concrete index map.
//
// The complexity of this loop is O(n*m) where n is dependent on the structure of the roles configuration
// and m is the number of matched indices. This formula does not take the loop through matchedActions in
// account, as this is bound by a constant number and thus does not need to be considered in the O() notation.

top: for (Map.Entry<String, RoleV7> entry : roles.getCEntries().entrySet()) {
try {
String roleName = entry.getKey();
Expand All @@ -939,6 +949,7 @@ static class StatefulIndexPrivileges {

if (indexPermissions.getIndex_patterns().contains("*")) {
// Wildcard index patterns are handled in the static IndexPermissions object.
// This avoids having to build huge data structures - when a very easy shortcut is available.
continue;
}

Expand Down

0 comments on commit de14c67

Please sign in to comment.