From a2f008efc0aa45ae9b5c16e8628f6de91b6b5dbe Mon Sep 17 00:00:00 2001 From: tangyoupeng Date: Fri, 15 Mar 2024 13:54:47 +0800 Subject: [PATCH] fix build --- .../io/juicefs/utils/AclTransformation.java | 92 ------------------- 1 file changed, 92 deletions(-) diff --git a/sdk/java/src/main/java/io/juicefs/utils/AclTransformation.java b/sdk/java/src/main/java/io/juicefs/utils/AclTransformation.java index 6e47f2e0a23c1..f6b02fd7bfd93 100644 --- a/sdk/java/src/main/java/io/juicefs/utils/AclTransformation.java +++ b/sdk/java/src/main/java/io/juicefs/utils/AclTransformation.java @@ -50,19 +50,6 @@ public final class AclTransformation { private static final int MAX_ENTRIES = 32; - /** - * Filters (discards) any existing ACL entries that have the same scope, type - * and name of any entry in the ACL spec. If necessary, recalculates the mask - * entries. If necessary, default entries may be inferred by copying the - * permissions of the corresponding access entries. It is invalid to request - * removal of the mask entry from an ACL that would otherwise require a mask - * entry, due to existing named entries or an unnamed group entry. - * - * @param existingAcl List existing ACL - * @param inAclSpec List ACL spec describing entries to filter - * @return List new ACL - * @throws AclException if validation fails - */ public static List filterAclEntriesByAclSpec(List existingAcl, List inAclSpec) throws AclException { ValidatedAclSpec aclSpec = new ValidatedAclSpec(inAclSpec); ArrayList aclBuilder = Lists.newArrayListWithCapacity(MAX_ENTRIES); @@ -88,16 +75,6 @@ public static List filterAclEntriesByAclSpec(List existingAc return buildAndValidateAcl(aclBuilder); } - /** - * Merges the entries of the ACL spec into the existing ACL. If necessary, - * recalculates the mask entries. If necessary, default entries may be - * inferred by copying the permissions of the corresponding access entries. - * - * @param existingAcl List existing ACL - * @param inAclSpec List ACL spec containing entries to merge - * @return List new ACL - * @throws AclException if validation fails - */ public static List mergeAclEntries(List existingAcl, List inAclSpec) throws AclException { ValidatedAclSpec aclSpec = new ValidatedAclSpec(inAclSpec); ArrayList aclBuilder = Lists.newArrayListWithCapacity(MAX_ENTRIES); @@ -141,21 +118,6 @@ public static List mergeAclEntries(List existingAcl, List existing ACL - * @param inAclSpec List ACL spec containing replacement entries - * @return List new ACL - * @throws AclException if validation fails - */ public static List replaceAclEntries(List existingAcl, List inAclSpec) throws AclException { ValidatedAclSpec aclSpec = new ValidatedAclSpec(inAclSpec); ArrayList aclBuilder = Lists.newArrayListWithCapacity(MAX_ENTRIES); @@ -187,22 +149,9 @@ public static List replaceAclEntries(List existingAcl, List< return buildAndValidateAcl(aclBuilder); } - /** - * There is no reason to instantiate this class. - */ private AclTransformation() { } - /** - * Comparator that enforces required ordering for entries within an ACL: - * -owner entry (unnamed user) - * -all named user entries (internal ordering undefined) - * -owning group entry (unnamed group) - * -all named group entries (internal ordering undefined) - * -mask entry - * -other entry - * All access ACL entries sort ahead of all default ACL entries. - */ public static final Comparator ACL_ENTRY_COMPARATOR = new Comparator() { @Override public int compare(AclEntry entry1, AclEntry entry2) { @@ -210,14 +159,6 @@ public int compare(AclEntry entry1, AclEntry entry2) { } }; - /** - * Builds the final list of ACL entries to return by trimming, sorting and - * validating the ACL entries that have been added. - * - * @param aclBuilder ArrayList containing entries to build - * @return List unmodifiable, sorted list of ACL entries - * @throws AclException if validation fails - */ public static List buildAndValidateAcl(ArrayList aclBuilder) throws AclException { aclBuilder.trimToSize(); Collections.sort(aclBuilder, ACL_ENTRY_COMPARATOR); @@ -253,8 +194,6 @@ public static List buildAndValidateAcl(ArrayList aclBuilder) return Collections.unmodifiableList(aclBuilder); } - // Check the max entries separately on access and default entries - // HDFS-7582 private static void checkMaxEntries(ScopedAclEntries scopedEntries) throws AclException { List accessEntries = scopedEntries.getAccessEntries(); List defaultEntries = scopedEntries.getDefaultEntries(); @@ -266,28 +205,6 @@ private static void checkMaxEntries(ScopedAclEntries scopedEntries) throws AclEx } } - /** - * Calculates mask entries required for the ACL. Mask calculation is performed - * separately for each scope: access and default. This method is responsible - * for handling the following cases of mask calculation: - * 1. Throws an exception if the caller attempts to remove the mask entry of an - * existing ACL that requires it. If the ACL has any named entries, then a - * mask entry is required. - * 2. If the caller supplied a mask in the ACL spec, use it. - * 3. If the caller did not supply a mask, but there are ACL entry changes in - * this scope, then automatically calculate a new mask. The permissions of - * the new mask are the union of the permissions on the group entry and all - * named entries. - * - * @param aclBuilder ArrayList containing entries to build - * @param providedMask EnumMap mapping each scope to - * the mask entry that was provided for that scope (if provided) - * @param maskDirty EnumSet which contains a scope if the mask - * entry is dirty (added or deleted) in that scope - * @param scopeDirty EnumSet which contains a scope if any entry - * is dirty (added or deleted) in that scope - * @throws AclException if validation fails - */ private static void calculateMasks(List aclBuilder, EnumMap providedMask, EnumSet maskDirty, EnumSet scopeDirty) throws AclException { EnumSet scopeFound = EnumSet.noneOf(AclEntryScope.class); EnumMap unionPerms = Maps.newEnumMap(AclEntryScope.class); @@ -324,12 +241,6 @@ private static void calculateMasks(List aclBuilder, EnumMap containing entries to build - */ private static void copyDefaultsIfNeeded(List aclBuilder) { Collections.sort(aclBuilder, ACL_ENTRY_COMPARATOR); ScopedAclEntries scopedEntries = new ScopedAclEntries(aclBuilder); @@ -354,9 +265,6 @@ private static void copyDefaultsIfNeeded(List aclBuilder) { } } - /** - * An ACL spec that has been pre-validated and sorted. - */ private static final class ValidatedAclSpec implements Iterable { private final List aclSpec;