Skip to content

Commit

Permalink
documents and code improves
Browse files Browse the repository at this point in the history
  • Loading branch information
Xin Zheng committed Oct 16, 2024
1 parent bcc6f25 commit 1088679
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,10 @@ The following configuration values are available:
| rejectStorageWriteOnLowMemory | redis | false | When set to _true_, PUT requests with the x-importance-level header can be rejected when memory gets low |
| freeMemoryCheckIntervalMs | redis | 60000 | The interval in milliseconds to calculate the actual memory usage |
| redisReadyCheckIntervalMs | redis | -1 | The interval in milliseconds to calculate the "ready state" of redis. When value < 1, no "ready state" will be calculated |
| awsS3Region | aws-s3 | | The region of S3 server |
| awsS3BucketName | aws-s3 | | The S3 bucket name |
| awsS3AccessKeyId | aws-s3 | | The AWS access key Id, signup at https://docs.aws.amazon.com/SetUp/latest/UserGuide/setup-AWSsignup.html |
| awsS3SecretAccessKey | aws-s3 | | The AWS secret access key |

### Configuration util

Expand All @@ -249,11 +253,14 @@ JsonObject json = new ModuleConfiguration().asJsonObject();
```

## Storage types
Currently, there are two storage types supported. File system storage and redis storage.
Currently, there are thress storage types supported. File system storage, S3 File storage and redis storage.

### File System Storage
The data is stored hierarchically on the file system. This is the default storage type when not overridden in the configuration.

### S3 File storage
The data is stored in a S3 instance.

### Redis Storage
The data is stored in a redis database.
Caution: The redis storage implementation does not currently support streaming. Avoid transferring too big payloads since they will be entirely copied in memory.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,6 @@ public Future<Void> write(Buffer buffer) {
} catch (IOException e) {
if (exceptionHandler != null) {
exceptionHandler.handle(e);
} else {
throw new RuntimeException("Error writing to OutputStream", e);
}
promise.fail(e);
}
Expand Down Expand Up @@ -83,8 +81,6 @@ public Future<Void> end() {
} catch (IOException e) {
if (exceptionHandler != null) {
exceptionHandler.handle(e);
} else {
throw new RuntimeException("Error closing OutputStream", e);
}
promise.fail(e);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public S3FileSystemStorage(Vertx vertx, RestStorageExceptionFactory exceptionFac

@Override
public Optional<Float> getCurrentMemoryUsage() {
throw new UnsupportedOperationException("Method 'getCurrentMemoryUsage' is not yet implemented for the FileSystemStorage");
throw new UnsupportedOperationException("Method 'getCurrentMemoryUsage' not supported in S3FileSystemStorage");
}

@Override
Expand Down Expand Up @@ -314,7 +314,7 @@ public Path canonicalize(String path, boolean isDir) {

private void deleteRecursive(Path path, boolean recursive) throws IOException {
if (recursive) {
Files.walkFileTree(path, new SimpleFileVisitor<Path>() {
Files.walkFileTree(path, new SimpleFileVisitor<>() {
public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
Files.delete(file);
return FileVisitResult.CONTINUE;
Expand Down Expand Up @@ -350,6 +350,6 @@ public void cleanup(Handler<DocumentResource> handler, String cleanupResourcesAm

@Override
public void storageExpand(String path, String etag, List<String> subResources, Handler<Resource> handler) {
throw new UnsupportedOperationException("Method 'storageExpand' is not yet implemented for the FileSystemStorage");
throw new UnsupportedOperationException("Method 'storageExpand' not supported in S3FileSystemStorage");
}
}

0 comments on commit 1088679

Please sign in to comment.