yuqi1129 commented on PR #5974:
URL: https://github.com/apache/gravitino/pull/5974#issuecomment-2579115587
> There're two options, I prefer Option2. @yuqi1129 @jerryshao WDYT?
>
> Option1 using a helper class to translate the configuration.
>
> ```java
> totalProperty.putAll(getCredentialConfigs(fileset))
> return provider.getFileSystem(filePath, totalProperty);
>
>
> Map<String, String> getCredentialConfigs(Fileset fileset) {
> Credential[] credentials =
fileset.supportsCredentials().getCredentials();
> if (credentials.length == 0) {
> return ImmutableMap.of();
> }
>
> Map<String, String> maps = Maps.newHashMap();
> // common configurations for credential vending
> maps.put(xx, xx);
>
> // specific configurations
> Arrays.stream(credentials).forEach(
> credential -> {
> if (credential instanceof ADLSTokenCredential) {
> // add azure token credential configurations
> } else if (credential instanceof AzureAccountCredential) {
> // add azure account configurations
> }
> }
> );
> return maps;
> }
> ```
>
> Option2 add an new `SupportsCredentialVending` interface to translate the
configuration.
>
> ```
> if (provider instanceOf SupportsCredentialVending) {
> Credential[] credentials = fileset.getCredentials()
> totalProperty.putAll(provider.getCredentialConfig(credentials))
> }
>
> return provider.getFileSystem(filePath, totalProperty);
>
>
> interface SupportsCredentialVending {
> default Map<String, String> getCredentialConfig(Credential[]
credentials) {
> // common logic
> }
> }
>
> AzureFileSystemProvider implements SupportsCredentials {
> Map<String, String> getCredentialConfig(Credential[] credentials) {
> // specific logic
> }
> }
> ```
For Option1, we need to determine the detailed credentials types in GVFS,
which should be free from specific FileSystem implementations. Cloud storage
related credentail should be handle in their own module.
In Option 2, If I'm not mistaken.
1. We should an interface name SupportsCredentialVending for
`FileSystemProvider`
2. Compared to option 1, the structure is relatively clear. The biggest
problem is changing all file system providers.
If I had to pick one, I would prefer the latter but I doubt the ROI of this
change.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]