Skip to content

Commit

Permalink
🎨 s3 client core format
Browse files Browse the repository at this point in the history
  • Loading branch information
simonhir committed Aug 12, 2024
1 parent 7896b38 commit 9982561
Show file tree
Hide file tree
Showing 3 changed files with 69 additions and 42 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,14 @@ public interface DocumentStorageFileRepository {
/**
* Gets the file specified in the parameter from the document storage.
*
* @param pathToFile defines the path to the file.
* @param pathToFile defines the path to the file.
* @param expireInMinutes the expiration time of the presignedURL in minutes.
* @return the file.
* @throws DocumentStorageClientErrorException if the problem is with the client.
* @throws DocumentStorageServerErrorException if the problem is with the S3 storage or document storage.
* @throws DocumentStorageException if the problem cannot be assigned to either the client or the S3 storage or the document storage.
* @throws DocumentStorageServerErrorException if the problem is with the S3 storage or document
* storage.
* @throws DocumentStorageException if the problem cannot be assigned to either the client or the S3
* storage or the document storage.
*/
byte[] getFile(String pathToFile, int expireInMinutes)
throws DocumentStorageException, DocumentStorageClientErrorException, DocumentStorageServerErrorException;
Expand All @@ -26,85 +28,99 @@ byte[] getFile(String pathToFile, int expireInMinutes)
* @param pathToFile defines the path to the file.
* @return the file size.
* @throws DocumentStorageClientErrorException if the problem is with the client.
* @throws DocumentStorageServerErrorException if the problem is with the S3 storage or document storage.
* @throws DocumentStorageException if the problem cannot be assigned to either the client or the S3 storage or the document storage.
* @throws DocumentStorageServerErrorException if the problem is with the S3 storage or document
* storage.
* @throws DocumentStorageException if the problem cannot be assigned to either the client or the S3
* storage or the document storage.
*/
Mono<Long> getFileSize(String pathToFile)
throws DocumentStorageClientErrorException, DocumentStorageServerErrorException, DocumentStorageException;

/**
* Gets an InputStream for the file specified in the parameter from the document storage.
*
* @param pathToFile defines the path to the file.
* @param pathToFile defines the path to the file.
* @param expireInMinutes the expiration time of the presignedURL in minutes.
* @return the InputStream for the file.
* @throws DocumentStorageClientErrorException if the problem is with the client.
* @throws DocumentStorageServerErrorException if the problem is with the S3 storage or document storage.
* @throws DocumentStorageException if the problem cannot be assigned to either the client or the S3 storage or the document storage.
* @throws DocumentStorageServerErrorException if the problem is with the S3 storage or document
* storage.
* @throws DocumentStorageException if the problem cannot be assigned to either the client or the S3
* storage or the document storage.
*/
InputStream getFileInputStream(String pathToFile, int expireInMinutes)
throws DocumentStorageException, DocumentStorageClientErrorException, DocumentStorageServerErrorException;

/**
* Saves the file specified in the parameter to the document storage.
*
* @param pathToFile defines the path to the file.
* @param file to save.
* @param pathToFile defines the path to the file.
* @param file to save.
* @param expireInMinutes the expiration time of the presignedURL in minutes.
* @throws DocumentStorageClientErrorException if the problem is with the client.
* @throws DocumentStorageServerErrorException if the problem is with the S3 storage or document storage.
* @throws DocumentStorageException if the problem cannot be assigned to either the client or the S3 storage or the document storage.
* @throws DocumentStorageServerErrorException if the problem is with the S3 storage or document
* storage.
* @throws DocumentStorageException if the problem cannot be assigned to either the client or the S3
* storage or the document storage.
*/
void saveFile(String pathToFile, byte[] file, int expireInMinutes)
throws DocumentStorageException, DocumentStorageClientErrorException, DocumentStorageServerErrorException;

/**
* Saves the file specified in the parameter to the document storage.
*
* @param pathToFile defines the path to the file.
* @param file to save.
* @param pathToFile defines the path to the file.
* @param file to save.
* @param expireInMinutes the expiration time of the presignedURL in minutes.
* @throws DocumentStorageClientErrorException if the problem is with the client.
* @throws DocumentStorageServerErrorException if the problem is with the S3 storage or document storage.
* @throws DocumentStorageException if the problem cannot be assigned to either the client or the S3 storage or the document storage.
* @throws DocumentStorageServerErrorException if the problem is with the S3 storage or document
* storage.
* @throws DocumentStorageException if the problem cannot be assigned to either the client or the S3
* storage or the document storage.
*/
void saveFileInputStream(String pathToFile, InputStream file, int expireInMinutes)
throws DocumentStorageException, DocumentStorageClientErrorException, DocumentStorageServerErrorException;

/**
* Updates the file specified in the parameter to the document storage.
*
* @param pathToFile defines the path to the file.
* @param file which overwrites the file in the document storage.
* @param pathToFile defines the path to the file.
* @param file which overwrites the file in the document storage.
* @param expireInMinutes the expiration time of the presignedURL in minutes.
* @throws DocumentStorageClientErrorException if the problem is with the client.
* @throws DocumentStorageServerErrorException if the problem is with the S3 storage or document storage.
* @throws DocumentStorageException if the problem cannot be assigned to either the client or the S3 storage or the document storage.
* @throws DocumentStorageServerErrorException if the problem is with the S3 storage or document
* storage.
* @throws DocumentStorageException if the problem cannot be assigned to either the client or the S3
* storage or the document storage.
*/
void updateFile(String pathToFile, byte[] file, int expireInMinutes)
throws DocumentStorageException, DocumentStorageClientErrorException, DocumentStorageServerErrorException;

/**
* Updates the file specified in the parameter withinq the document storage.
*
* @param pathToFile defines the path to the file.
* @param file which overwrites the file in the document storage.
* @param pathToFile defines the path to the file.
* @param file which overwrites the file in the document storage.
* @param expireInMinutes the expiration time of the presignedURL in minutes.
* @throws DocumentStorageClientErrorException if the problem is with the client.
* @throws DocumentStorageServerErrorException if the problem is with the S3 storage or document storage.
* @throws DocumentStorageException if the problem cannot be assigned to either the client or the S3 storage or the document storage.
* @throws DocumentStorageServerErrorException if the problem is with the S3 storage or document
* storage.
* @throws DocumentStorageException if the problem cannot be assigned to either the client or the S3
* storage or the document storage.
*/
void updateFileInputStream(String pathToFile, InputStream file, int expireInMinutes)
throws DocumentStorageException, DocumentStorageClientErrorException, DocumentStorageServerErrorException;

/**
* Deletes the file specified in the parameter from the document storage.
*
* @param pathToFile defines the path to the file.
* @param pathToFile defines the path to the file.
* @param expireInMinutes the expiration time of the presignedURL in minutes.
* @throws DocumentStorageClientErrorException if the problem is with the client.
* @throws DocumentStorageServerErrorException if the problem is with the S3 storage or document storage.
* @throws DocumentStorageException if the problem cannot be assigned to either the client or the S3 storage or the document storage.
* @throws DocumentStorageServerErrorException if the problem is with the S3 storage or document
* storage.
* @throws DocumentStorageException if the problem cannot be assigned to either the client or the S3
* storage or the document storage.
*/
void deleteFile(String pathToFile, int expireInMinutes)
throws DocumentStorageException, DocumentStorageClientErrorException, DocumentStorageServerErrorException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ public interface DocumentStorageFolderRepository {
* @param pathToFolder which defines the folder in the document storage.
* @throws DocumentStorageClientErrorException if the problem is with the client.
* @throws DocumentStorageServerErrorException if the problem is with the document storage.
* @throws DocumentStorageException if the problem cannot be assigned directly to the document storage.
* @throws DocumentStorageException if the problem cannot be assigned directly to the document
* storage.
*/
void deleteFolder(String pathToFolder)
throws DocumentStorageClientErrorException, DocumentStorageServerErrorException, DocumentStorageException;
Expand All @@ -25,7 +26,8 @@ void deleteFolder(String pathToFolder)
* @param pathToFolder which defines the folder in the document storage.
* @throws DocumentStorageClientErrorException if the problem is with the client.
* @throws DocumentStorageServerErrorException if the problem is with the document storage.
* @throws DocumentStorageException if the problem cannot be assigned directly to the document storage.
* @throws DocumentStorageException if the problem cannot be assigned directly to the document
* storage.
*/
Mono<Set<String>> getAllFilesInFolderRecursively(String pathToFolder)
throws DocumentStorageClientErrorException, DocumentStorageServerErrorException, DocumentStorageException;
Expand All @@ -37,7 +39,8 @@ Mono<Set<String>> getAllFilesInFolderRecursively(String pathToFolder)
* @return file paths with their file sizes.
* @throws DocumentStorageClientErrorException if the problem is with the client.
* @throws DocumentStorageServerErrorException if the problem is with the document storage.
* @throws DocumentStorageException if the problem cannot be assigned directly to the document storage.
* @throws DocumentStorageException if the problem cannot be assigned directly to the document
* storage.
*/
Mono<Map<String, Long>> getAllFileSizesInFolderRecursively(String pathToFolder)
throws DocumentStorageClientErrorException, DocumentStorageServerErrorException, DocumentStorageException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,53 +8,61 @@
public interface PresignedUrlRepository {

/**
* Fetches a presignedURL for the file named in the parameter to get a file from the document storage.
* Fetches a presignedURL for the file named in the parameter to get a file from the document
* storage.
*
* @param pathToFile defines the path to the file.
* @param pathToFile defines the path to the file.
* @param expireInMinutes the expiration time of the presignedURL in minutes.
* @return the presignedURL.
* @throws DocumentStorageClientErrorException if the problem is with the client.
* @throws DocumentStorageServerErrorException if the problem is with the document storage.
* @throws DocumentStorageException if the problem cannot be assigned to either the client or the document storage.
* @throws DocumentStorageException if the problem cannot be assigned to either the client or the
* document storage.
*/
Mono<String> getPresignedUrlGetFile(String pathToFile, int expireInMinutes)
throws DocumentStorageClientErrorException, DocumentStorageServerErrorException, DocumentStorageException;

/**
* Fetches a presignedURL for the file named in the parameter to store a file in the document storage.
* Fetches a presignedURL for the file named in the parameter to store a file in the document
* storage.
*
* @param pathToFile defines the path to the file.
* @param pathToFile defines the path to the file.
* @param expireInMinutes the expiration time of the presignedURL in minutes.
* @return the presignedURL.
* @throws DocumentStorageClientErrorException if the problem is with the client.
* @throws DocumentStorageServerErrorException if the problem is with the document storage.
* @throws DocumentStorageException if the problem cannot be assigned to either the client or the document storage.
* @throws DocumentStorageException if the problem cannot be assigned to either the client or the
* document storage.
*/
String getPresignedUrlSaveFile(String pathToFile, int expireInMinutes)
throws DocumentStorageClientErrorException, DocumentStorageServerErrorException, DocumentStorageException;

/**
* Fetches a presignedURL for the file named in the parameter to update a file in the document storage.
* Fetches a presignedURL for the file named in the parameter to update a file in the document
* storage.
*
* @param pathToFile defines the path to the file.
* @param pathToFile defines the path to the file.
* @param expireInMinutes the expiration time of the presignedURL in minutes.
* @return the presignedURL.
* @throws DocumentStorageClientErrorException if the problem is with the client.
* @throws DocumentStorageServerErrorException if the problem is with the document storage.
* @throws DocumentStorageException if the problem cannot be assigned to either the client or the document storage.
* @throws DocumentStorageException if the problem cannot be assigned to either the client or the
* document storage.
*/
String getPresignedUrlUpdateFile(String pathToFile, int expireInMinutes)
throws DocumentStorageClientErrorException, DocumentStorageServerErrorException, DocumentStorageException;

/**
* Fetches a presignedURL for the file named in the parameter to delete a file from the document storage.
* Fetches a presignedURL for the file named in the parameter to delete a file from the document
* storage.
*
* @param pathToFile defines the path to the file.
* @param pathToFile defines the path to the file.
* @param expireInMinutes the expiration time of the presignedURL in minutes.
* @return the presignedURL.
* @throws DocumentStorageClientErrorException if the problem is with the client.
* @throws DocumentStorageServerErrorException if the problem is with the document storage.
* @throws DocumentStorageException if the problem cannot be assigned to either the client or the document storage.
* @throws DocumentStorageException if the problem cannot be assigned to either the client or the
* document storage.
*/
String getPresignedUrlDeleteFile(String pathToFile, int expireInMinutes)
throws DocumentStorageClientErrorException, DocumentStorageServerErrorException, DocumentStorageException;
Expand Down

0 comments on commit 9982561

Please sign in to comment.