Skip to content

Adopt Azure sdk for Objectstore#1781

Open
Yavor16 wants to merge 1 commit intomasterfrom
adopt-azure-sdk
Open

Adopt Azure sdk for Objectstore#1781
Yavor16 wants to merge 1 commit intomasterfrom
adopt-azure-sdk

Conversation

@Yavor16
Copy link
Contributor

@Yavor16 Yavor16 commented Feb 19, 2026

No description provided.

@Yavor16 Yavor16 force-pushed the adopt-azure-sdk branch 2 times, most recently from 3d7bc44 to 8abfeec Compare February 20, 2026 13:39
@sonarqubecloud
Copy link

Comment on lines +179 to +194
private int removeBlobsByFilter(Predicate<? super BlobItem> filter) {
Set<String> blobNames = getEntryNames(filter);
List<Boolean> deletedBlobsResults = new ArrayList<>();

if (blobNames.isEmpty()) {
return 0;
}
for (String blobName : blobNames) {
BlobClient blobClient = containerClient.getBlobClient(blobName);
deletedBlobsResults.add(blobClient.deleteIfExists());
}

deletedBlobsResults.removeIf(Boolean.FALSE::equals);

return deletedBlobsResults.size();
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we do it with a simple int counter and since deleteIfExists() returns true or false based on if the Blob was deleted, we would just increment the counter if true was returned and then we will return the counter at the end of the method?
Instead of creating a list of boolean objects and removing those which are false and then returning its size.

.build();
}

private static ObjectStoreServiceInfo buildGcoObjectStoreServiceInfo() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo in buildGcoObjectStoreServiceInfo. Gco -> Gcp

Comment on lines +229 to +230
int deletedFiles = fileStorage.deleteFilesModifiedBefore(LocalDateTime.ofInstant(Instant.ofEpochMilli(currentMillis - oldFilesTtl),
ZoneId.systemDefault()));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since ZoneId.systemDefault() relies on the OS timezone, this test may behave differently across operating systems. Could that cause inconsistencies?

ObjectStoreServiceInfo objectStoreServiceInfo = objectStoreServiceInfoOptional.get();
return tryToCreateObjectStore(objectStoreServiceInfo, exceptions);
}
return Optional.empty();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it make sense to add a log when the Optional is empty?

Comment on lines +197 to +200
ListBlobsOptions listBlobsOptions = new ListBlobsOptions();
BlobListDetails blobListDetails = new BlobListDetails();
blobListDetails.setRetrieveMetadata(true);
listBlobsOptions.setDetails(blobListDetails);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The listBlobOptions creation could be simplified by inlining like this:
ListBlobsOptions options = new ListBlobsOptions().setDetails(blobListDetails);

Comment on lines +156 to +166
public String getContainerUriEndpoint(Map<String, Object> credentials) {
if (!credentials.containsKey(CONTAINER_URI)) {
return null;
}
try {
URL containerUri = new URL((String) credentials.get(CONTAINER_URI));
return new URL(containerUri.getProtocol(), containerUri.getHost(), containerUri.getPort(), "").toString();
} catch (MalformedURLException e) {
throw new IllegalStateException(Messages.CANNOT_PARSE_CONTAINER_URI_OF_OBJECT_STORE, e);
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like this method is only referenced by a protected method within the same class. Should we consider reducing its visibility from public to protected?

Comment on lines +61 to +72
private ObjectStoreServiceInfo createServiceInfoForAzure(Map<String, Object> credentials) {
return ImmutableObjectStoreServiceInfo.builder()
.provider(Constants.AZUREBLOB)
.credentials(credentials)
.build();
}

private ObjectStoreServiceInfo createServiceInfoForGcp(Map<String, Object> credentials) {
return ImmutableObjectStoreServiceInfo.builder()
.provider(Constants.GOOGLE_CLOUD_STORAGE)
.credentials(credentials)
.build();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a note:
Since we’re adopting different SDKs across environments, we could extract the shared Immutable builder logic into a helper method, as only the provider and credentials are parsed, and future SDK implementations may follow the same pattern.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants