-
Notifications
You must be signed in to change notification settings - Fork 11
Add RemoteS3ConnectionProvider plugin implementations #191
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
bc398e6
to
801e9a1
Compare
00c4af6
to
abd2f9d
Compare
2dc5219
to
7c495ea
Compare
801e9a1
to
c4ec16b
Compare
c4ec16b
to
6547f3a
Compare
6547f3a
to
85a33f4
Compare
private String accessKey; | ||
private String secretKey; | ||
|
||
@NotNull |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The annotations can be moved to the fields
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In all other Airlift conflig classes we use the annotations on getters
...io/trino/aws/proxy/server/remote/provider/config/ConfigRemoteS3ConnectionProviderModule.java
Outdated
Show resolved
Hide resolved
this.requestQueryFields = config.getRequestFields(); | ||
this.objectMapper = requireNonNull(objectMapper, "objectMapper is null"); | ||
if (config.getCacheSize() > 0) { | ||
this.cache = Optional.of(newBuilder() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this.cache = Optional.of(newBuilder() | |
this.cache = config.getCacheSize() > 0 ? ..... : Optional.empty(); |
We can use a ternary op
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That line is already pretty long, I think a ternary would make it more complex. I would like to avoid it
...main/java/io/trino/aws/proxy/server/remote/provider/http/HttpRemoteS3ConnectionProvider.java
Outdated
Show resolved
Hide resolved
prepareGet().setUri(uriBuilder.build()).build(), | ||
createFullJsonResponseHandler(responseCodec)); | ||
HttpStatus statusCode = HttpStatus.fromStatusCode(response.getStatusCode()); | ||
if (statusCode.family() != HttpStatus.Family.SUCCESSFUL) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since the only valid response is when the both HttpStatus.Family.SUCCESSFUL
and response.hasValue()
are true, we can check for this first and then go into invalid scenarios.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a bit of personal preference, but i like function logic to go like
if (badCase) {
....
}
return goodCase
{ | ||
this.httpClient = requireNonNull(httpClient, "httpClient is null"); | ||
this.responseCodec = requireNonNull(responseCodec, "responseCodec is null"); | ||
this.endpoint = config.getEndpoint(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this.endpoint = config.getEndpoint(); | |
this.endpoint = requireNotNull(config.getEndpoint()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This field cannot be null since its in a config class and its annotated @NotNull
We usually trust the config validation and don't re-do it.
this.httpClient = requireNonNull(httpClient, "httpClient is null"); | ||
this.responseCodec = requireNonNull(responseCodec, "responseCodec is null"); | ||
this.endpoint = config.getEndpoint(); | ||
this.requestQueryFields = config.getRequestFields(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this.requestQueryFields = config.getRequestFields(); | |
this.requestQueryFields = requireNonNull(config.getRequestFields()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above
...io/trino/aws/proxy/server/remote/provider/config/ConfigRemoteS3ConnectionProviderConfig.java
Outdated
Show resolved
Hide resolved
Added generic implementations for the RemoteS3ConnectionProvider interface: static, file and http. Added a README for the file and http ones as those are a bit more complex. Added more tests to dynamic RemoteS3Facade creation
85a33f4
to
a662e45
Compare
Add generic implementations for the RemoteS3ConnectionProvider interface.
config, file and http
Added a README for the file and http ones as those are a bit more complex