Conversation
8abfeec to
0f289a1
Compare
|
.../org/cloudfoundry/multiapps/controller/persistence/services/AzureObjectStoreFileStorage.java
Show resolved
Hide resolved
...oundry/multiapps/controller/web/configuration/service/ObjectStoreServiceInfoCreatorTest.java
Outdated
Show resolved
Hide resolved
.../cloudfoundry/multiapps/controller/persistence/services/AzureObjectStoreFileStorageTest.java
Outdated
Show resolved
Hide resolved
...y/multiapps/controller/web/configuration/bean/factory/ObjectStoreFileStorageFactoryBean.java
Show resolved
Hide resolved
.../org/cloudfoundry/multiapps/controller/persistence/services/AzureObjectStoreFileStorage.java
Outdated
Show resolved
Hide resolved
| 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); | ||
| } | ||
| } |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
I made it public so I can test it better using unit tests.
...oudfoundry/multiapps/controller/web/configuration/service/ObjectStoreServiceInfoCreator.java
Show resolved
Hide resolved
.../org/cloudfoundry/multiapps/controller/persistence/services/AzureObjectStoreFileStorage.java
Outdated
Show resolved
Hide resolved
| public void addFile(FileEntry fileEntry, InputStream content) throws FileStorageException { | ||
| BlobClient blobClient = containerClient.getBlobClient(fileEntry.getId()); | ||
| try { | ||
| BlobParallelUploadOptions blobParallelUploadOptions = new BlobParallelUploadOptions(content); |
There was a problem hiding this comment.
is this method blocking? What is the purpose of parallel here?
There was a problem hiding this comment.
Yes, the method is blocking. It is parallel because uploadWithResponse works only with parrallel upload options. The reason I use uploadWithResponse instead of simple upload() is because the basic upload method doesn't upload metadata during the upload of the file. The metadata can be set after the file has been uploaded. That means there is a very low chanse that our cleaner can remove the file because it doesn't have metadata. uploadWithResponse sets the metadata during the upload
| BlobParallelUploadOptions blobParallelUploadOptions = new BlobParallelUploadOptions(content); | ||
| blobParallelUploadOptions.setMetadata(ObjectStoreMapper.createFileEntryMetadata(fileEntry)); | ||
|
|
||
| blobClient.uploadWithResponse(blobParallelUploadOptions, ObjectStoreConstants.OBJECT_STORE_TOTAL_TIMEOUT_CONFIG_IN_MINUTES, |
There was a problem hiding this comment.
is this method failing or just returning some http status code? It returns Response which has method getStatusCode
There was a problem hiding this comment.
yes, but from I've read in the documentation it will throw exception, if is responce is different from 2**(link)
| } | ||
|
|
||
| public Set<String> getAllEntriesNames() { | ||
| return containerClient.listBlobs() |
There was a problem hiding this comment.
timeout here?
| <google-cloud.version>2.62.1</google-cloud.version> | ||
| <google-cloud-nio.version>0.128.11</google-cloud-nio.version> | ||
| <azure-storage-blob.version>12.33.1</azure-storage-blob.version> | ||
| <azure-core-http-okhttp.version>1.13.3</azure-core-http-okhttp.version> |
There was a problem hiding this comment.
why okhttp was chosen over netty?
There was a problem hiding this comment.
I was using the netty by default and we were having constantly crashed due to OOM. I decided to try the Azure Http Client and the crashed stopped and everything was fine
0f289a1 to
eb3c751
Compare



No description provided.