chibenwa commented on code in PR #2542:
URL: https://github.com/apache/james-project/pull/2542#discussion_r1867108308


##########
server/blob/blob-storage-strategy/src/main/java/org/apache/james/server/blob/deduplication/MinIOGenerationAwareBlobId.java:
##########
@@ -109,7 +119,18 @@ public String asString() {
         if (family == NO_FAMILY) {
             return delegate.asString();
         }
-        return family + "/" + generation + "/" + delegate.asString();
+
+        String blobIdPartAsString = delegate.asString();
+        if (blobIdPartAsString.length() < PATH_DELIMITED_NUMBER) {
+            return family + PATH_DELIMITER_CHARACTER + generation + 
PATH_DELIMITER_CHARACTER + blobIdPartAsString;
+        }
+
+        return family + PATH_DELIMITER_CHARACTER + generation + 
PATH_DELIMITER_CHARACTER +
+            blobIdPartAsString.charAt(0) + PATH_DELIMITER_CHARACTER +
+            blobIdPartAsString.charAt(1) + PATH_DELIMITER_CHARACTER +
+            blobIdPartAsString.charAt(2) + PATH_DELIMITER_CHARACTER +
+            blobIdPartAsString.charAt(3) + PATH_DELIMITER_CHARACTER +
+            blobIdPartAsString.substring(4);

Review Comment:
   No it was intended NOT to be in asString in prder to preserve 
blobId::asString stability.
   
   With your code:
   
   ```
   MinIOGenerationAwareBlobId blobId;
   
   ```
   blobId.asString 
   
   != blobIdFactory.parse(blobId.asString).asString
   ```



##########
server/blob/blob-storage-strategy/src/main/java/org/apache/james/server/blob/deduplication/MinIOGenerationAwareBlobId.java:
##########
@@ -109,7 +119,18 @@ public String asString() {
         if (family == NO_FAMILY) {
             return delegate.asString();
         }
-        return family + "/" + generation + "/" + delegate.asString();
+
+        String blobIdPartAsString = delegate.asString();
+        if (blobIdPartAsString.length() < PATH_DELIMITED_NUMBER) {
+            return family + PATH_DELIMITER_CHARACTER + generation + 
PATH_DELIMITER_CHARACTER + blobIdPartAsString;
+        }
+
+        return family + PATH_DELIMITER_CHARACTER + generation + 
PATH_DELIMITER_CHARACTER +
+            blobIdPartAsString.charAt(0) + PATH_DELIMITER_CHARACTER +
+            blobIdPartAsString.charAt(1) + PATH_DELIMITER_CHARACTER +
+            blobIdPartAsString.charAt(2) + PATH_DELIMITER_CHARACTER +
+            blobIdPartAsString.charAt(3) + PATH_DELIMITER_CHARACTER +
+            blobIdPartAsString.substring(4);

Review Comment:
   No it was intended NOT to be in asString in prder to preserve 
blobId::asString stability.
   
   With your code:
   
   ```
   MinIOGenerationAwareBlobId blobId;
   
   ```
   blobId.asString 
   
   != blobIdFactory.parse(blobId.asString).asString
   ```



##########
server/blob/blob-storage-strategy/src/main/java/org/apache/james/server/blob/deduplication/MinIOGenerationAwareBlobId.java:
##########
@@ -64,23 +68,29 @@ public BlobId parse(String id) {
                 int family = Integer.parseInt(id.substring(0, 
separatorIndex1));
                 int generation = Integer.parseInt(id.substring(separatorIndex1 
+ 1, separatorIndex2));
                 String blobIdPart = id.substring(separatorIndex2 + 1);
-                BlobId wrapped = delegate.parse(blobIdPart.charAt(0) + "/" +
-                    blobIdPart.charAt(1) + "/" +
-                    blobIdPart.charAt(2) + "/" +
-                    blobIdPart.charAt(3) + "/" +
-                    blobIdPart.substring(4));

Review Comment:
   Sorry I should have had put this in `of`. Not in parse.
   
   I will update base PR



##########
server/blob/blob-storage-strategy/src/main/java/org/apache/james/server/blob/deduplication/MinIOGenerationAwareBlobId.java:
##########
@@ -64,23 +68,29 @@ public BlobId parse(String id) {
                 int family = Integer.parseInt(id.substring(0, 
separatorIndex1));
                 int generation = Integer.parseInt(id.substring(separatorIndex1 
+ 1, separatorIndex2));
                 String blobIdPart = id.substring(separatorIndex2 + 1);
-                BlobId wrapped = delegate.parse(blobIdPart.charAt(0) + "/" +
-                    blobIdPart.charAt(1) + "/" +
-                    blobIdPart.charAt(2) + "/" +
-                    blobIdPart.charAt(3) + "/" +
-                    blobIdPart.substring(4));

Review Comment:
   Sorry I should have had put this in `of`. Not in parse.
   
   I will update base PR



-- 
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.

To unsubscribe, e-mail: [email protected]

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