diff --git a/bindings/java/src/main/java/org/apache/opendal/ServiceConfig.java b/bindings/java/src/main/java/org/apache/opendal/ServiceConfig.java index 0c56d9acc20a..c9ce3b507d55 100644 --- a/bindings/java/src/main/java/org/apache/opendal/ServiceConfig.java +++ b/bindings/java/src/main/java/org/apache/opendal/ServiceConfig.java @@ -23,6 +23,7 @@ import java.time.Duration; import java.util.HashMap; +import java.util.Map; import lombok.AccessLevel; import lombok.Builder; import lombok.Data; @@ -35,56 +36,59 @@ */ @SuppressWarnings("unused") // intended to be used by users public interface ServiceConfig { + /** + * The scheme of the service. + * + * @return the scheme + */ String scheme(); - HashMap configMap(); + /** + * Convert the structured config to a type erased config map. + * + * @return the config map + */ + Map configMap(); + /** + * Configuration for service aliyun_drive. + */ @Builder @Data @RequiredArgsConstructor(access = AccessLevel.PRIVATE) class AliyunDrive implements ServiceConfig { /** - * The drive_type of this backend. - *

- * All operations will happen under this type of drive. - *

- * Available values are `default`, `backup` and `resource`. - *

- * Fallback to default if not set or no other drives can be found. + *

The drive_type of this backend.

+ *

All operations will happen under this type of drive.

+ *

Available values are default, backup and resource.

+ *

Fallback to default if not set or no other drives can be found.

*/ private final @NonNull String driveType; /** - * The Root of this backend. - *

- * All operations will happen under this root. - *

- * Default to `/` if not set. + *

The Root of this backend.

+ *

All operations will happen under this root.

+ *

Default to / if not set.

*/ private final String root; /** - * The access_token of this backend. - *

- * Solution for client-only purpose. #4733 - *

- * Required if no client_id, client_secret and refresh_token are provided. + *

The access_token of this backend.

+ *

Solution for client-only purpose. #4733

+ *

Required if no client_id, client_secret and refresh_token are provided.

*/ private final String accessToken; /** - * The client_id of this backend. - *

- * Required if no access_token is provided. + *

The client_id of this backend.

+ *

Required if no access_token is provided.

*/ private final String clientId; /** - * The client_secret of this backend. - *

- * Required if no access_token is provided. + *

The client_secret of this backend.

+ *

Required if no access_token is provided.

*/ private final String clientSecret; /** - * The refresh_token of this backend. - *

- * Required if no access_token is provided. + *

The refresh_token of this backend.

+ *

Required if no access_token is provided.

*/ private final String refreshToken; @@ -94,7 +98,7 @@ public String scheme() { } @Override - public HashMap configMap() { + public Map configMap() { final HashMap map = new HashMap<>(); map.put("drive_type", driveType); if (root != null) { @@ -116,22 +120,22 @@ public HashMap configMap() { } } + /** + * Configuration for service alluxio. + */ @Builder @Data @RequiredArgsConstructor(access = AccessLevel.PRIVATE) class Alluxio implements ServiceConfig { /** - * root of this backend. - *

- * All operations will happen under this root. - *

- * default to `/` if not set. + *

root of this backend.

+ *

All operations will happen under this root.

+ *

default to / if not set.

*/ private final String root; /** - * endpoint of this backend. - *

- * Endpoint must be full uri, mostly like `http://127.0.0.1:39999`. + *

endpoint of this backend.

+ *

Endpoint must be full uri, mostly like http://127.0.0.1:39999.

*/ private final String endpoint; @@ -141,7 +145,7 @@ public String scheme() { } @Override - public HashMap configMap() { + public Map configMap() { final HashMap map = new HashMap<>(); if (root != null) { map.put("root", root); @@ -153,28 +157,31 @@ public HashMap configMap() { } } + /** + * Configuration for service atomicserver. + */ @Builder @Data @RequiredArgsConstructor(access = AccessLevel.PRIVATE) class Atomicserver implements ServiceConfig { /** - * work dir of this backend + *

work dir of this backend

*/ private final String root; /** - * endpoint of this backend + *

endpoint of this backend

*/ private final String endpoint; /** - * private_key of this backend + *

private_key of this backend

*/ private final String privateKey; /** - * public_key of this backend + *

public_key of this backend

*/ private final String publicKey; /** - * parent_resource_id of this backend + *

parent_resource_id of this backend

*/ private final String parentResourceId; @@ -184,7 +191,7 @@ public String scheme() { } @Override - public HashMap configMap() { + public Map configMap() { final HashMap map = new HashMap<>(); if (root != null) { map.put("root", root); @@ -205,55 +212,57 @@ public HashMap configMap() { } } + /** + * Configuration for service azblob. + */ @Builder @Data @RequiredArgsConstructor(access = AccessLevel.PRIVATE) class Azblob implements ServiceConfig { /** - * The container name of Azblob service backend. + *

The container name of Azblob service backend.

*/ private final @NonNull String container; /** - * The root of Azblob service backend. - *

- * All operations will happen under this root. + *

The root of Azblob service backend.

+ *

All operations will happen under this root.

*/ private final String root; /** - * The endpoint of Azblob service backend. - *

- * Endpoint must be full uri, e.g. - *

- * - Azblob: `https://accountname.blob.core.windows.net` - * - Azurite: `http://127.0.0.1:10000/devstoreaccount1` + *

The endpoint of Azblob service backend.

+ *

Endpoint must be full uri, e.g.

+ *
    + *
  • Azblob: https://accountname.blob.core.windows.net
  • + *
  • Azurite: http://127.0.0.1:10000/devstoreaccount1
  • + *
*/ private final String endpoint; /** - * The account name of Azblob service backend. + *

The account name of Azblob service backend.

*/ private final String accountName; /** - * The account key of Azblob service backend. + *

The account key of Azblob service backend.

*/ private final String accountKey; /** - * The encryption key of Azblob service backend. + *

The encryption key of Azblob service backend.

*/ private final String encryptionKey; /** - * The encryption key sha256 of Azblob service backend. + *

The encryption key sha256 of Azblob service backend.

*/ private final String encryptionKeySha256; /** - * The encryption algorithm of Azblob service backend. + *

The encryption algorithm of Azblob service backend.

*/ private final String encryptionAlgorithm; /** - * The sas token of Azblob service backend. + *

The sas token of Azblob service backend.

*/ private final String sasToken; /** - * The maximum batch operations of Azblob service backend. + *

The maximum batch operations of Azblob service backend.

*/ private final Long batchMaxOperations; @@ -263,7 +272,7 @@ public String scheme() { } @Override - public HashMap configMap() { + public Map configMap() { final HashMap map = new HashMap<>(); map.put("container", container); if (root != null) { @@ -297,28 +306,31 @@ public HashMap configMap() { } } + /** + * Configuration for service azdls. + */ @Builder @Data @RequiredArgsConstructor(access = AccessLevel.PRIVATE) class Azdls implements ServiceConfig { /** - * Filesystem name of this backend. + *

Filesystem name of this backend.

*/ private final @NonNull String filesystem; /** - * Root of this backend. + *

Root of this backend.

*/ private final String root; /** - * Endpoint of this backend. + *

Endpoint of this backend.

*/ private final String endpoint; /** - * Account name of this backend. + *

Account name of this backend.

*/ private final String accountName; /** - * Account key of this backend. + *

Account key of this backend.

*/ private final String accountKey; @@ -328,7 +340,7 @@ public String scheme() { } @Override - public HashMap configMap() { + public Map configMap() { final HashMap map = new HashMap<>(); map.put("filesystem", filesystem); if (root != null) { @@ -347,32 +359,35 @@ public HashMap configMap() { } } + /** + * Configuration for service azfile. + */ @Builder @Data @RequiredArgsConstructor(access = AccessLevel.PRIVATE) class Azfile implements ServiceConfig { /** - * The share name for azfile. + *

The share name for azfile.

*/ private final @NonNull String shareName; /** - * The root path for azfile. + *

The root path for azfile.

*/ private final String root; /** - * The endpoint for azfile. + *

The endpoint for azfile.

*/ private final String endpoint; /** - * The account name for azfile. + *

The account name for azfile.

*/ private final String accountName; /** - * The account key for azfile. + *

The account key for azfile.

*/ private final String accountKey; /** - * The sas token for azfile. + *

The sas token for azfile.

*/ private final String sasToken; @@ -382,7 +397,7 @@ public String scheme() { } @Override - public HashMap configMap() { + public Map configMap() { final HashMap map = new HashMap<>(); map.put("share_name", shareName); if (root != null) { @@ -404,40 +419,42 @@ public HashMap configMap() { } } + /** + * Configuration for service b2. + */ @Builder @Data @RequiredArgsConstructor(access = AccessLevel.PRIVATE) class B2 implements ServiceConfig { /** - * bucket of this backend. - *

- * required. + *

bucket of this backend.

+ *

required.

*/ private final @NonNull String bucket; /** - * bucket id of this backend. - *

- * required. + *

bucket id of this backend.

+ *

required.

*/ private final @NonNull String bucketId; /** - * root of this backend. - *

- * All operations will happen under this root. + *

root of this backend.

+ *

All operations will happen under this root.

*/ private final String root; /** - * keyID of this backend. - *

- * - If application_key_id is set, we will take user's input first. - * - If not, we will try to load it from environment. + *

keyID of this backend.

+ *
    + *
  • If application_key_id is set, we will take user's input first.
  • + *
  • If not, we will try to load it from environment.
  • + *
*/ private final String applicationKeyId; /** - * applicationKey of this backend. - *

- * - If application_key is set, we will take user's input first. - * - If not, we will try to load it from environment. + *

applicationKey of this backend.

+ *
    + *
  • If application_key is set, we will take user's input first.
  • + *
  • If not, we will try to load it from environment.
  • + *
*/ private final String applicationKey; @@ -447,7 +464,7 @@ public String scheme() { } @Override - public HashMap configMap() { + public Map configMap() { final HashMap map = new HashMap<>(); map.put("bucket", bucket); map.put("bucket_id", bucketId); @@ -464,12 +481,15 @@ public HashMap configMap() { } } + /** + * Configuration for service cacache. + */ @Builder @Data @RequiredArgsConstructor(access = AccessLevel.PRIVATE) class Cacache implements ServiceConfig { /** - * That path to the cacache data directory. + *

That path to the cacache data directory.

*/ private final String datadir; @@ -479,7 +499,7 @@ public String scheme() { } @Override - public HashMap configMap() { + public Map configMap() { final HashMap map = new HashMap<>(); if (datadir != null) { map.put("datadir", datadir); @@ -488,24 +508,25 @@ public HashMap configMap() { } } + /** + * Configuration for service chainsafe. + */ @Builder @Data @RequiredArgsConstructor(access = AccessLevel.PRIVATE) class Chainsafe implements ServiceConfig { /** - * bucket_id of this backend. - *

- * required. + *

bucket_id of this backend.

+ *

required.

*/ private final @NonNull String bucketId; /** - * root of this backend. - *

- * All operations will happen under this root. + *

root of this backend.

+ *

All operations will happen under this root.

*/ private final String root; /** - * api_key of this backend. + *

api_key of this backend.

*/ private final String apiKey; @@ -515,7 +536,7 @@ public String scheme() { } @Override - public HashMap configMap() { + public Map configMap() { final HashMap map = new HashMap<>(); map.put("bucket_id", bucketId); if (root != null) { @@ -528,24 +549,27 @@ public HashMap configMap() { } } + /** + * Configuration for service cloudflare_kv. + */ @Builder @Data @RequiredArgsConstructor(access = AccessLevel.PRIVATE) class CloudflareKv implements ServiceConfig { /** - * The token used to authenticate with CloudFlare. + *

The token used to authenticate with CloudFlare.

*/ private final String token; /** - * The account ID used to authenticate with CloudFlare. Used as URI path parameter. + *

The account ID used to authenticate with CloudFlare. Used as URI path parameter.

*/ private final String accountId; /** - * The namespace ID. Used as URI path parameter. + *

The namespace ID. Used as URI path parameter.

*/ private final String namespaceId; /** - * Root within this backend. + *

Root within this backend.

*/ private final String root; @@ -555,7 +579,7 @@ public String scheme() { } @Override - public HashMap configMap() { + public Map configMap() { final HashMap map = new HashMap<>(); if (token != null) { map.put("token", token); @@ -573,14 +597,16 @@ public HashMap configMap() { } } + /** + * Configuration for service compfs. + */ @Builder @Data @RequiredArgsConstructor(access = AccessLevel.PRIVATE) class Compfs implements ServiceConfig { /** - * root of this backend. - *

- * All operations will happen under this root. + *

root of this backend.

+ *

All operations will happen under this root.

*/ private final String root; @@ -590,7 +616,7 @@ public String scheme() { } @Override - public HashMap configMap() { + public Map configMap() { final HashMap map = new HashMap<>(); if (root != null) { map.put("root", root); @@ -599,32 +625,35 @@ public HashMap configMap() { } } + /** + * Configuration for service cos. + */ @Builder @Data @RequiredArgsConstructor(access = AccessLevel.PRIVATE) class Cos implements ServiceConfig { /** - * Root of this backend. + *

Root of this backend.

*/ private final String root; /** - * Endpoint of this backend. + *

Endpoint of this backend.

*/ private final String endpoint; /** - * Secret ID of this backend. + *

Secret ID of this backend.

*/ private final String secretId; /** - * Secret key of this backend. + *

Secret key of this backend.

*/ private final String secretKey; /** - * Bucket of this backend. + *

Bucket of this backend.

*/ private final String bucket; /** - * Disable config load so that opendal will not load config from + *

Disable config load so that opendal will not load config from

*/ private final Boolean disableConfigLoad; @@ -634,7 +663,7 @@ public String scheme() { } @Override - public HashMap configMap() { + public Map configMap() { final HashMap map = new HashMap<>(); if (root != null) { map.put("root", root); @@ -658,36 +687,39 @@ public HashMap configMap() { } } + /** + * Configuration for service d1. + */ @Builder @Data @RequiredArgsConstructor(access = AccessLevel.PRIVATE) class D1 implements ServiceConfig { /** - * Set the token of cloudflare api. + *

Set the token of cloudflare api.

*/ private final String token; /** - * Set the account id of cloudflare api. + *

Set the account id of cloudflare api.

*/ private final String accountId; /** - * Set the database id of cloudflare api. + *

Set the database id of cloudflare api.

*/ private final String databaseId; /** - * Set the working directory of OpenDAL. + *

Set the working directory of OpenDAL.

*/ private final String root; /** - * Set the table of D1 Database. + *

Set the table of D1 Database.

*/ private final String table; /** - * Set the key field of D1 Database. + *

Set the key field of D1 Database.

*/ private final String keyField; /** - * Set the value field of D1 Database. + *

Set the value field of D1 Database.

*/ private final String valueField; @@ -697,7 +729,7 @@ public String scheme() { } @Override - public HashMap configMap() { + public Map configMap() { final HashMap map = new HashMap<>(); if (token != null) { map.put("token", token); @@ -724,12 +756,15 @@ public HashMap configMap() { } } + /** + * Configuration for service dashmap. + */ @Builder @Data @RequiredArgsConstructor(access = AccessLevel.PRIVATE) class Dashmap implements ServiceConfig { /** - * The root path for dashmap. + *

The root path for dashmap.

*/ private final String root; @@ -739,7 +774,7 @@ public String scheme() { } @Override - public HashMap configMap() { + public Map configMap() { final HashMap map = new HashMap<>(); if (root != null) { map.put("root", root); @@ -748,20 +783,23 @@ public HashMap configMap() { } } + /** + * Configuration for service dbfs. + */ @Builder @Data @RequiredArgsConstructor(access = AccessLevel.PRIVATE) class Dbfs implements ServiceConfig { /** - * The root for dbfs. + *

The root for dbfs.

*/ private final String root; /** - * The endpoint for dbfs. + *

The endpoint for dbfs.

*/ private final String endpoint; /** - * The token for dbfs. + *

The token for dbfs.

*/ private final String token; @@ -771,7 +809,7 @@ public String scheme() { } @Override - public HashMap configMap() { + public Map configMap() { final HashMap map = new HashMap<>(); if (root != null) { map.put("root", root); @@ -786,28 +824,31 @@ public HashMap configMap() { } } + /** + * Configuration for service dropbox. + */ @Builder @Data @RequiredArgsConstructor(access = AccessLevel.PRIVATE) class Dropbox implements ServiceConfig { /** - * root path for dropbox. + *

root path for dropbox.

*/ private final String root; /** - * access token for dropbox. + *

access token for dropbox.

*/ private final String accessToken; /** - * refresh_token for dropbox. + *

refresh_token for dropbox.

*/ private final String refreshToken; /** - * client_id for dropbox. + *

client_id for dropbox.

*/ private final String clientId; /** - * client_secret for dropbox. + *

client_secret for dropbox.

*/ private final String clientSecret; @@ -817,7 +858,7 @@ public String scheme() { } @Override - public HashMap configMap() { + public Map configMap() { final HashMap map = new HashMap<>(); if (root != null) { map.put("root", root); @@ -838,52 +879,48 @@ public HashMap configMap() { } } + /** + * Configuration for service etcd. + */ @Builder @Data @RequiredArgsConstructor(access = AccessLevel.PRIVATE) class Etcd implements ServiceConfig { /** - * network address of the Etcd services. - * If use https, must set TLS options: `ca_path`, `cert_path`, `key_path`. - * e.g. "127.0.0.1:23790,127.0.0.1:23791,127.0.0.1:23792" or "http://127.0.0.1:23790,http://127.0.0.1:23791,http://127.0.0.1:23792" or "https://127.0.0.1:23790,https://127.0.0.1:23791,https://127.0.0.1:23792" - *

- * default is "http://127.0.0.1:2379" + *

network address of the Etcd services. + * If use https, must set TLS options: ca_path, cert_path, key_path. + * e.g. "127.0.0.1:23790,127.0.0.1:23791,127.0.0.1:23792" or "http://127.0.0.1:23790,http://127.0.0.1:23791,http://127.0.0.1:23792" or "https://127.0.0.1:23790,https://127.0.0.1:23791,https://127.0.0.1:23792"

+ *

default is "http://127.0.0.1:2379"

*/ private final String endpoints; /** - * the username to connect etcd service. - *

- * default is None + *

the username to connect etcd service.

+ *

default is None

*/ private final String username; /** - * the password for authentication - *

- * default is None + *

the password for authentication

+ *

default is None

*/ private final String password; /** - * the working directory of the etcd service. Can be "/path/to/dir" - *

- * default is "/" + *

the working directory of the etcd service. Can be "/path/to/dir"

+ *

default is "/"

*/ private final String root; /** - * certificate authority file path - *

- * default is None + *

certificate authority file path

+ *

default is None

*/ private final String caPath; /** - * cert path - *

- * default is None + *

cert path

+ *

default is None

*/ private final String certPath; /** - * key path - *

- * default is None + *

key path

+ *

default is None

*/ private final String keyPath; @@ -893,7 +930,7 @@ public String scheme() { } @Override - public HashMap configMap() { + public Map configMap() { final HashMap map = new HashMap<>(); if (endpoints != null) { map.put("endpoints", endpoints); @@ -920,16 +957,19 @@ public HashMap configMap() { } } + /** + * Configuration for service fs. + */ @Builder @Data @RequiredArgsConstructor(access = AccessLevel.PRIVATE) class Fs implements ServiceConfig { /** - * root dir for backend + *

root dir for backend

*/ private final String root; /** - * tmp dir for atomic write + *

tmp dir for atomic write

*/ private final String atomicWriteDir; @@ -939,7 +979,7 @@ public String scheme() { } @Override - public HashMap configMap() { + public Map configMap() { final HashMap map = new HashMap<>(); if (root != null) { map.put("root", root); @@ -951,65 +991,67 @@ public HashMap configMap() { } } + /** + * Configuration for service gcs. + */ @Builder @Data @RequiredArgsConstructor(access = AccessLevel.PRIVATE) class Gcs implements ServiceConfig { /** - * bucket name + *

bucket name

*/ private final @NonNull String bucket; /** - * root URI, all operations happens under `root` + *

root URI, all operations happens under root

*/ private final String root; /** - * endpoint URI of GCS service, - * default is `https://storage.googleapis.com` + *

endpoint URI of GCS service, + * default is https://storage.googleapis.com

*/ private final String endpoint; /** - * Scope for gcs. + *

Scope for gcs.

*/ private final String scope; /** - * Service Account for gcs. + *

Service Account for gcs.

*/ private final String serviceAccount; /** - * Credentials string for GCS service OAuth2 authentication. + *

Credentials string for GCS service OAuth2 authentication.

*/ private final String credential; /** - * Local path to credentials file for GCS service OAuth2 authentication. + *

Local path to credentials file for GCS service OAuth2 authentication.

*/ private final String credentialPath; /** - * The predefined acl for GCS. + *

The predefined acl for GCS.

*/ private final String predefinedAcl; /** - * The default storage class used by gcs. + *

The default storage class used by gcs.

*/ private final String defaultStorageClass; /** - * Allow opendal to send requests without signing when credentials are not - * loaded. + *

Allow opendal to send requests without signing when credentials are not + * loaded.

*/ private final Boolean allowAnonymous; /** - * Disable attempting to load credentials from the GCE metadata server when - * running within Google Cloud. + *

Disable attempting to load credentials from the GCE metadata server when + * running within Google Cloud.

*/ private final Boolean disableVmMetadata; /** - * Disable loading configuration from the environment. + *

Disable loading configuration from the environment.

*/ private final Boolean disableConfigLoad; /** - * A Google Cloud OAuth2 token. - *

- * Takes precedence over `credential` and `credential_path`. + *

A Google Cloud OAuth2 token.

+ *

Takes precedence over credential and credential_path.

*/ private final String token; @@ -1019,7 +1061,7 @@ public String scheme() { } @Override - public HashMap configMap() { + public Map configMap() { final HashMap map = new HashMap<>(); map.put("bucket", bucket); if (root != null) { @@ -1062,28 +1104,31 @@ public HashMap configMap() { } } + /** + * Configuration for service gdrive. + */ @Builder @Data @RequiredArgsConstructor(access = AccessLevel.PRIVATE) class Gdrive implements ServiceConfig { /** - * The root for gdrive + *

The root for gdrive

*/ private final String root; /** - * Access token for gdrive. + *

Access token for gdrive.

*/ private final String accessToken; /** - * Refresh token for gdrive. + *

Refresh token for gdrive.

*/ private final String refreshToken; /** - * Client id for gdrive. + *

Client id for gdrive.

*/ private final String clientId; /** - * Client secret for gdrive. + *

Client secret for gdrive.

*/ private final String clientSecret; @@ -1093,7 +1138,7 @@ public String scheme() { } @Override - public HashMap configMap() { + public Map configMap() { final HashMap map = new HashMap<>(); if (root != null) { map.put("root", root); @@ -1114,24 +1159,27 @@ public HashMap configMap() { } } + /** + * Configuration for service ghac. + */ @Builder @Data @RequiredArgsConstructor(access = AccessLevel.PRIVATE) class Ghac implements ServiceConfig { /** - * The root path for ghac. + *

The root path for ghac.

*/ private final String root; /** - * The version that used by cache. + *

The version that used by cache.

*/ private final String version; /** - * The endpoint for ghac service. + *

The endpoint for ghac service.

*/ private final String endpoint; /** - * The runtime token for ghac service. + *

The runtime token for ghac service.

*/ private final String runtimeToken; @@ -1141,7 +1189,7 @@ public String scheme() { } @Override - public HashMap configMap() { + public Map configMap() { final HashMap map = new HashMap<>(); if (root != null) { map.put("root", root); @@ -1159,34 +1207,33 @@ public HashMap configMap() { } } + /** + * Configuration for service github. + */ @Builder @Data @RequiredArgsConstructor(access = AccessLevel.PRIVATE) class Github implements ServiceConfig { /** - * GitHub repo owner. - *

- * required. + *

GitHub repo owner.

+ *

required.

*/ private final @NonNull String owner; /** - * GitHub repo name. - *

- * required. + *

GitHub repo name.

+ *

required.

*/ private final @NonNull String repo; /** - * root of this backend. - *

- * All operations will happen under this root. + *

root of this backend.

+ *

All operations will happen under this root.

*/ private final String root; /** - * GitHub access_token. - *

- * optional. + *

GitHub access_token.

+ *

optional. * If not provided, the backend will only support read operations for public repositories. - * And rate limit will be limited to 60 requests per hour. + * And rate limit will be limited to 60 requests per hour.

*/ private final String token; @@ -1196,7 +1243,7 @@ public String scheme() { } @Override - public HashMap configMap() { + public Map configMap() { final HashMap map = new HashMap<>(); map.put("owner", owner); map.put("repo", repo); @@ -1210,28 +1257,31 @@ public HashMap configMap() { } } + /** + * Configuration for service gridfs. + */ @Builder @Data @RequiredArgsConstructor(access = AccessLevel.PRIVATE) class Gridfs implements ServiceConfig { /** - * The connection string of the MongoDB service. + *

The connection string of the MongoDB service.

*/ private final String connectionString; /** - * The database name of the MongoDB GridFs service to read/write. + *

The database name of the MongoDB GridFs service to read/write.

*/ private final String database; /** - * The bucket name of the MongoDB GridFs service to read/write. + *

The bucket name of the MongoDB GridFs service to read/write.

*/ private final String bucket; /** - * The chunk size of the MongoDB GridFs service used to break the user file into chunks. + *

The chunk size of the MongoDB GridFs service used to break the user file into chunks.

*/ private final Integer chunkSize; /** - * The working directory, all operations will be performed under it. + *

The working directory, all operations will be performed under it.

*/ private final String root; @@ -1241,7 +1291,7 @@ public String scheme() { } @Override - public HashMap configMap() { + public Map configMap() { final HashMap map = new HashMap<>(); if (connectionString != null) { map.put("connection_string", connectionString); @@ -1262,20 +1312,23 @@ public HashMap configMap() { } } + /** + * Configuration for service hdfs_native. + */ @Builder @Data @RequiredArgsConstructor(access = AccessLevel.PRIVATE) class HdfsNative implements ServiceConfig { /** - * work dir of this backend + *

work dir of this backend

*/ private final String root; /** - * url of this backend + *

url of this backend

*/ private final String url; /** - * enable the append capacity + *

enable the append capacity

*/ private final Boolean enableAppend; @@ -1285,7 +1338,7 @@ public String scheme() { } @Override - public HashMap configMap() { + public Map configMap() { final HashMap map = new HashMap<>(); if (root != null) { map.put("root", root); @@ -1300,28 +1353,31 @@ public HashMap configMap() { } } + /** + * Configuration for service http. + */ @Builder @Data @RequiredArgsConstructor(access = AccessLevel.PRIVATE) class Http implements ServiceConfig { /** - * endpoint of this backend + *

endpoint of this backend

*/ private final String endpoint; /** - * username of this backend + *

username of this backend

*/ private final String username; /** - * password of this backend + *

password of this backend

*/ private final String password; /** - * token of this backend + *

token of this backend

*/ private final String token; /** - * root of this backend + *

root of this backend

*/ private final String root; @@ -1331,7 +1387,7 @@ public String scheme() { } @Override - public HashMap configMap() { + public Map configMap() { final HashMap map = new HashMap<>(); if (endpoint != null) { map.put("endpoint", endpoint); @@ -1352,40 +1408,40 @@ public HashMap configMap() { } } + /** + * Configuration for service huggingface. + */ @Builder @Data @RequiredArgsConstructor(access = AccessLevel.PRIVATE) class Huggingface implements ServiceConfig { /** - * Repo type of this backend. Default is model. - *

- * Available values: - * - model - * - dataset + *

Repo type of this backend. Default is model.

+ *

Available values:

+ *
    + *
  • model
  • + *
  • dataset
  • + *
*/ private final String repoType; /** - * Repo id of this backend. - *

- * This is required. + *

Repo id of this backend.

+ *

This is required.

*/ private final String repoId; /** - * Revision of this backend. - *

- * Default is main. + *

Revision of this backend.

+ *

Default is main.

*/ private final String revision; /** - * Root of this backend. Can be "/path/to/dir". - *

- * Default is "/". + *

Root of this backend. Can be "/path/to/dir".

+ *

Default is "/".

*/ private final String root; /** - * Token of this backend. - *

- * This is optional. + *

Token of this backend.

+ *

This is optional.

*/ private final String token; @@ -1395,7 +1451,7 @@ public String scheme() { } @Override - public HashMap configMap() { + public Map configMap() { final HashMap map = new HashMap<>(); if (repoType != null) { map.put("repo_type", repoType); @@ -1416,45 +1472,42 @@ public HashMap configMap() { } } + /** + * Configuration for service icloud. + */ @Builder @Data @RequiredArgsConstructor(access = AccessLevel.PRIVATE) class Icloud implements ServiceConfig { /** - * root of this backend. - *

- * All operations will happen under this root. - *

- * default to `/` if not set. + *

root of this backend.

+ *

All operations will happen under this root.

+ *

default to / if not set.

*/ private final String root; /** - * apple_id of this backend. - *

- * apple_id must be full, mostly like `example@gmail.com`. + *

apple_id of this backend.

+ *

apple_id must be full, mostly like example@gmail.com.

*/ private final String appleId; /** - * password of this backend. - *

- * password must be full. + *

password of this backend.

+ *

password must be full.

*/ private final String password; /** - * Session - *

- * token must be valid. + *

Session

+ *

token must be valid.

*/ private final String trustToken; /** - * ds_web_auth_token must be set in Session + *

ds_web_auth_token must be set in Session

*/ private final String dsWebAuthToken; /** - * enable the china origin - * China region `origin` Header needs to be set to "https://www.icloud.com.cn". - *

- * otherwise Apple server will return 302. + *

enable the china origin + * China region origin Header needs to be set to "https://www.icloud.com.cn".

+ *

otherwise Apple server will return 302.

*/ private final Boolean isChinaMainland; @@ -1464,7 +1517,7 @@ public String scheme() { } @Override - public HashMap configMap() { + public Map configMap() { final HashMap map = new HashMap<>(); if (root != null) { map.put("root", root); @@ -1488,16 +1541,19 @@ public HashMap configMap() { } } + /** + * Configuration for service ipfs. + */ @Builder @Data @RequiredArgsConstructor(access = AccessLevel.PRIVATE) class Ipfs implements ServiceConfig { /** - * IPFS gateway endpoint. + *

IPFS gateway endpoint.

*/ private final String endpoint; /** - * IPFS root. + *

IPFS root.

*/ private final String root; @@ -1507,7 +1563,7 @@ public String scheme() { } @Override - public HashMap configMap() { + public Map configMap() { final HashMap map = new HashMap<>(); if (endpoint != null) { map.put("endpoint", endpoint); @@ -1519,16 +1575,19 @@ public HashMap configMap() { } } + /** + * Configuration for service ipmfs. + */ @Builder @Data @RequiredArgsConstructor(access = AccessLevel.PRIVATE) class Ipmfs implements ServiceConfig { /** - * Root for ipfs. + *

Root for ipfs.

*/ private final String root; /** - * Endpoint for ipfs. + *

Endpoint for ipfs.

*/ private final String endpoint; @@ -1538,7 +1597,7 @@ public String scheme() { } @Override - public HashMap configMap() { + public Map configMap() { final HashMap map = new HashMap<>(); if (root != null) { map.put("root", root); @@ -1550,26 +1609,28 @@ public HashMap configMap() { } } + /** + * Configuration for service koofr. + */ @Builder @Data @RequiredArgsConstructor(access = AccessLevel.PRIVATE) class Koofr implements ServiceConfig { /** - * Koofr endpoint. + *

Koofr endpoint.

*/ private final @NonNull String endpoint; /** - * Koofr email. + *

Koofr email.

*/ private final @NonNull String email; /** - * root of this backend. - *

- * All operations will happen under this root. + *

root of this backend.

+ *

All operations will happen under this root.

*/ private final String root; /** - * password of this backend. (Must be the application password) + *

password of this backend. (Must be the application password)

*/ private final String password; @@ -1579,7 +1640,7 @@ public String scheme() { } @Override - public HashMap configMap() { + public Map configMap() { final HashMap map = new HashMap<>(); map.put("endpoint", endpoint); map.put("email", email); @@ -1593,44 +1654,41 @@ public HashMap configMap() { } } + /** + * Configuration for service lakefs. + */ @Builder @Data @RequiredArgsConstructor(access = AccessLevel.PRIVATE) class Lakefs implements ServiceConfig { /** - * Base url. - *

- * This is required. + *

Base url.

+ *

This is required.

*/ private final String endpoint; /** - * Username for Lakefs basic authentication. - *

- * This is required. + *

Username for Lakefs basic authentication.

+ *

This is required.

*/ private final String username; /** - * Password for Lakefs basic authentication. - *

- * This is required. + *

Password for Lakefs basic authentication.

+ *

This is required.

*/ private final String password; /** - * Root of this backend. Can be "/path/to/dir". - *

- * Default is "/". + *

Root of this backend. Can be "/path/to/dir".

+ *

Default is "/".

*/ private final String root; /** - * The repository name - *

- * This is required. + *

The repository name

+ *

This is required.

*/ private final String repository; /** - * Name of the branch or a commit ID. Default is main. - *

- * This is optional. + *

Name of the branch or a commit ID. Default is main.

+ *

This is optional.

*/ private final String branch; @@ -1640,7 +1698,7 @@ public String scheme() { } @Override - public HashMap configMap() { + public Map configMap() { final HashMap map = new HashMap<>(); if (endpoint != null) { map.put("endpoint", endpoint); @@ -1664,32 +1722,35 @@ public HashMap configMap() { } } + /** + * Configuration for service libsql. + */ @Builder @Data @RequiredArgsConstructor(access = AccessLevel.PRIVATE) class Libsql implements ServiceConfig { /** - * Connection string for libsql service. + *

Connection string for libsql service.

*/ private final String connectionString; /** - * Authentication token for libsql service. + *

Authentication token for libsql service.

*/ private final String authToken; /** - * Table name for libsql service. + *

Table name for libsql service.

*/ private final String table; /** - * Key field name for libsql service. + *

Key field name for libsql service.

*/ private final String keyField; /** - * Value field name for libsql service. + *

Value field name for libsql service.

*/ private final String valueField; /** - * Root for libsql service. + *

Root for libsql service.

*/ private final String root; @@ -1699,7 +1760,7 @@ public String scheme() { } @Override - public HashMap configMap() { + public Map configMap() { final HashMap map = new HashMap<>(); if (connectionString != null) { map.put("connection_string", connectionString); @@ -1723,32 +1784,33 @@ public HashMap configMap() { } } + /** + * Configuration for service memcached. + */ @Builder @Data @RequiredArgsConstructor(access = AccessLevel.PRIVATE) class Memcached implements ServiceConfig { /** - * network address of the memcached service. - *

- * For example: "tcp://localhost:11211" + *

network address of the memcached service.

+ *

For example: "tcp://localhost:11211"

*/ private final String endpoint; /** - * the working directory of the service. Can be "/path/to/dir" - *

- * default is "/" + *

the working directory of the service. Can be "/path/to/dir"

+ *

default is "/"

*/ private final String root; /** - * Memcached username, optional. + *

Memcached username, optional.

*/ private final String username; /** - * Memcached password, optional. + *

Memcached password, optional.

*/ private final String password; /** - * The default ttl for put operations. + *

The default ttl for put operations.

*/ private final Duration defaultTtl; @@ -1758,7 +1820,7 @@ public String scheme() { } @Override - public HashMap configMap() { + public Map configMap() { final HashMap map = new HashMap<>(); if (endpoint != null) { map.put("endpoint", endpoint); @@ -1779,12 +1841,15 @@ public HashMap configMap() { } } + /** + * Configuration for service memory. + */ @Builder @Data @RequiredArgsConstructor(access = AccessLevel.PRIVATE) class Memory implements ServiceConfig { /** - * root of the backend. + *

root of the backend.

*/ private final String root; @@ -1794,7 +1859,7 @@ public String scheme() { } @Override - public HashMap configMap() { + public Map configMap() { final HashMap map = new HashMap<>(); if (root != null) { map.put("root", root); @@ -1803,30 +1868,30 @@ public HashMap configMap() { } } + /** + * Configuration for service mini_moka. + */ @Builder @Data @RequiredArgsConstructor(access = AccessLevel.PRIVATE) class MiniMoka implements ServiceConfig { /** - * Sets the max capacity of the cache. - *

- * Refer to [`mini-moka::sync::CacheBuilder::max_capacity`](https://docs.rs/mini-moka/latest/mini_moka/sync/struct.CacheBuilder.html#method.max_capacity) + *

Sets the max capacity of the cache.

+ *

Refer to mini-moka::sync::CacheBuilder::max_capacity

*/ private final Long maxCapacity; /** - * Sets the time to live of the cache. - *

- * Refer to [`mini-moka::sync::CacheBuilder::time_to_live`](https://docs.rs/mini-moka/latest/mini_moka/sync/struct.CacheBuilder.html#method.time_to_live) + *

Sets the time to live of the cache.

+ *

Refer to mini-moka::sync::CacheBuilder::time_to_live

*/ private final Duration timeToLive; /** - * Sets the time to idle of the cache. - *

- * Refer to [`mini-moka::sync::CacheBuilder::time_to_idle`](https://docs.rs/mini-moka/latest/mini_moka/sync/struct.CacheBuilder.html#method.time_to_idle) + *

Sets the time to idle of the cache.

+ *

Refer to mini-moka::sync::CacheBuilder::time_to_idle

*/ private final Duration timeToIdle; /** - * root path of this backend + *

root path of this backend

*/ private final String root; @@ -1836,7 +1901,7 @@ public String scheme() { } @Override - public HashMap configMap() { + public Map configMap() { final HashMap map = new HashMap<>(); if (maxCapacity != null) { map.put("max_capacity", String.valueOf(maxCapacity)); @@ -1854,40 +1919,39 @@ public HashMap configMap() { } } + /** + * Configuration for service moka. + */ @Builder @Data @RequiredArgsConstructor(access = AccessLevel.PRIVATE) class Moka implements ServiceConfig { /** - * Name for this cache instance. + *

Name for this cache instance.

*/ private final String name; /** - * Sets the max capacity of the cache. - *

- * Refer to [`moka::sync::CacheBuilder::max_capacity`](https://docs.rs/moka/latest/moka/sync/struct.CacheBuilder.html#method.max_capacity) + *

Sets the max capacity of the cache.

+ *

Refer to moka::sync::CacheBuilder::max_capacity

*/ private final Long maxCapacity; /** - * Sets the time to live of the cache. - *

- * Refer to [`moka::sync::CacheBuilder::time_to_live`](https://docs.rs/moka/latest/moka/sync/struct.CacheBuilder.html#method.time_to_live) + *

Sets the time to live of the cache.

+ *

Refer to moka::sync::CacheBuilder::time_to_live

*/ private final Duration timeToLive; /** - * Sets the time to idle of the cache. - *

- * Refer to [`moka::sync::CacheBuilder::time_to_idle`](https://docs.rs/moka/latest/moka/sync/struct.CacheBuilder.html#method.time_to_idle) + *

Sets the time to idle of the cache.

+ *

Refer to moka::sync::CacheBuilder::time_to_idle

*/ private final Duration timeToIdle; /** - * Sets the segments number of the cache. - *

- * Refer to [`moka::sync::CacheBuilder::segments`](https://docs.rs/moka/latest/moka/sync/struct.CacheBuilder.html#method.segments) + *

Sets the segments number of the cache.

+ *

Refer to moka::sync::CacheBuilder::segments

*/ private final Long numSegments; /** - * root path of this backend + *

root path of this backend

*/ private final String root; @@ -1897,7 +1961,7 @@ public String scheme() { } @Override - public HashMap configMap() { + public Map configMap() { final HashMap map = new HashMap<>(); if (name != null) { map.put("name", name); @@ -1921,32 +1985,35 @@ public HashMap configMap() { } } + /** + * Configuration for service mongodb. + */ @Builder @Data @RequiredArgsConstructor(access = AccessLevel.PRIVATE) class Mongodb implements ServiceConfig { /** - * connection string of this backend + *

connection string of this backend

*/ private final String connectionString; /** - * database of this backend + *

database of this backend

*/ private final String database; /** - * collection of this backend + *

collection of this backend

*/ private final String collection; /** - * root of this backend + *

root of this backend

*/ private final String root; /** - * key field of this backend + *

key field of this backend

*/ private final String keyField; /** - * value field of this backend + *

value field of this backend

*/ private final String valueField; @@ -1956,7 +2023,7 @@ public String scheme() { } @Override - public HashMap configMap() { + public Map configMap() { final HashMap map = new HashMap<>(); if (connectionString != null) { map.put("connection_string", connectionString); @@ -1980,16 +2047,17 @@ public HashMap configMap() { } } + /** + * Configuration for service monoiofs. + */ @Builder @Data @RequiredArgsConstructor(access = AccessLevel.PRIVATE) class Monoiofs implements ServiceConfig { /** - * The Root of this backend. - *

- * All operations will happen under this root. - *

- * Builder::build will return error if not set. + *

The Root of this backend.

+ *

All operations will happen under this root.

+ *

Builder::build will return error if not set.

*/ private final String root; @@ -1999,7 +2067,7 @@ public String scheme() { } @Override - public HashMap configMap() { + public Map configMap() { final HashMap map = new HashMap<>(); if (root != null) { map.put("root", root); @@ -2008,39 +2076,40 @@ public HashMap configMap() { } } + /** + * Configuration for service mysql. + */ @Builder @Data @RequiredArgsConstructor(access = AccessLevel.PRIVATE) class Mysql implements ServiceConfig { /** - * This connection string is used to connect to the mysql service. There are url based formats: - *

- * ## Url - *

- * This format resembles the url format of the mysql client. The format is: `[scheme://][user[:[password]]@]host[:port][/schema][?attribute1=value1&attribute2=value2...` - *

- * - `mysql://user@localhost` - * - `mysql://user:password@localhost` - * - `mysql://user:password@localhost:3306` - * - `mysql://user:password@localhost:3306/db` - *

- * For more information, please refer to . + *

This connection string is used to connect to the mysql service. There are url based formats:

+ *

Url

+ *

This format resembles the url format of the mysql client. The format is: [scheme://][user[:[password]]@]host[:port][/schema][?attribute1=value1&attribute2=value2...

+ *
    + *
  • mysql://user@localhost
  • + *
  • mysql://user:password@localhost
  • + *
  • mysql://user:password@localhost:3306
  • + *
  • mysql://user:password@localhost:3306/db
  • + *
+ *

For more information, please refer to https://docs.rs/sqlx/latest/sqlx/mysql/struct.MySqlConnectOptions.html.

*/ private final String connectionString; /** - * The table name for mysql. + *

The table name for mysql.

*/ private final String table; /** - * The key field name for mysql. + *

The key field name for mysql.

*/ private final String keyField; /** - * The value field name for mysql. + *

The value field name for mysql.

*/ private final String valueField; /** - * The root for mysql. + *

The root for mysql.

*/ private final String root; @@ -2050,7 +2119,7 @@ public String scheme() { } @Override - public HashMap configMap() { + public Map configMap() { final HashMap map = new HashMap<>(); if (connectionString != null) { map.put("connection_string", connectionString); @@ -2071,44 +2140,47 @@ public HashMap configMap() { } } + /** + * Configuration for service nebula_graph. + */ @Builder @Data @RequiredArgsConstructor(access = AccessLevel.PRIVATE) class NebulaGraph implements ServiceConfig { /** - * The host addr of nebulagraph's graphd server + *

The host addr of nebulagraph's graphd server

*/ private final String host; /** - * The host port of nebulagraph's graphd server + *

The host port of nebulagraph's graphd server

*/ private final Integer port; /** - * The username of nebulagraph's graphd server + *

The username of nebulagraph's graphd server

*/ private final String username; /** - * The password of nebulagraph's graphd server + *

The password of nebulagraph's graphd server

*/ private final String password; /** - * The space name of nebulagraph's graphd server + *

The space name of nebulagraph's graphd server

*/ private final String space; /** - * The tag name of nebulagraph's graphd server + *

The tag name of nebulagraph's graphd server

*/ private final String tag; /** - * The key field name of the NebulaGraph service to read/write. + *

The key field name of the NebulaGraph service to read/write.

*/ private final String keyField; /** - * The value field name of the NebulaGraph service to read/write. + *

The value field name of the NebulaGraph service to read/write.

*/ private final String valueField; /** - * The root for NebulaGraph + *

The root for NebulaGraph

*/ private final String root; @@ -2118,7 +2190,7 @@ public String scheme() { } @Override - public HashMap configMap() { + public Map configMap() { final HashMap map = new HashMap<>(); if (host != null) { map.put("host", host); @@ -2151,28 +2223,31 @@ public HashMap configMap() { } } + /** + * Configuration for service obs. + */ @Builder @Data @RequiredArgsConstructor(access = AccessLevel.PRIVATE) class Obs implements ServiceConfig { /** - * Root for obs. + *

Root for obs.

*/ private final String root; /** - * Endpoint for obs. + *

Endpoint for obs.

*/ private final String endpoint; /** - * Access key id for obs. + *

Access key id for obs.

*/ private final String accessKeyId; /** - * Secret access key for obs. + *

Secret access key for obs.

*/ private final String secretAccessKey; /** - * Bucket for obs. + *

Bucket for obs.

*/ private final String bucket; @@ -2182,7 +2257,7 @@ public String scheme() { } @Override - public HashMap configMap() { + public Map configMap() { final HashMap map = new HashMap<>(); if (root != null) { map.put("root", root); @@ -2203,16 +2278,19 @@ public HashMap configMap() { } } + /** + * Configuration for service onedrive. + */ @Builder @Data @RequiredArgsConstructor(access = AccessLevel.PRIVATE) class Onedrive implements ServiceConfig { /** - * bearer access token for OneDrive + *

bearer access token for OneDrive

*/ private final String accessToken; /** - * root path of OneDrive folder. + *

root path of OneDrive folder.

*/ private final String root; @@ -2222,7 +2300,7 @@ public String scheme() { } @Override - public HashMap configMap() { + public Map configMap() { final HashMap map = new HashMap<>(); if (accessToken != null) { map.put("access_token", accessToken); @@ -2234,84 +2312,90 @@ public HashMap configMap() { } } + /** + * Configuration for service oss. + */ @Builder @Data @RequiredArgsConstructor(access = AccessLevel.PRIVATE) class Oss implements ServiceConfig { /** - * Bucket for oss. + *

Bucket for oss.

*/ private final @NonNull String bucket; /** - * Root for oss. + *

Root for oss.

*/ private final String root; /** - * Endpoint for oss. + *

Endpoint for oss.

*/ private final String endpoint; /** - * Presign endpoint for oss. + *

Presign endpoint for oss.

*/ private final String presignEndpoint; /** - * Server side encryption for oss. + *

Server side encryption for oss.

*/ private final String serverSideEncryption; /** - * Server side encryption key id for oss. + *

Server side encryption key id for oss.

*/ private final String serverSideEncryptionKeyId; /** - * Allow anonymous for oss. + *

Allow anonymous for oss.

*/ private final Boolean allowAnonymous; /** - * Access key id for oss. + *

Access key id for oss.

*/ private final String accessKeyId; /** - * Access key secret for oss. + *

Access key secret for oss.

*/ private final String accessKeySecret; /** - * The size of max batch operations. + *

The size of max batch operations.

* * @deprecated Please use `delete_max_size` instead of `batch_max_operations` */ private final Long batchMaxOperations; /** - * The size of max delete operations. + *

The size of max delete operations.

*/ private final Long deleteMaxSize; /** - * If `role_arn` is set, we will use already known config as source - * credential to assume role with `role_arn`. + *

If role_arn is set, we will use already known config as source + * credential to assume role with role_arn.

*/ private final String roleArn; /** - * role_session_name for this backend. + *

role_session_name for this backend.

*/ private final String roleSessionName; /** - * `oidc_provider_arn` will be loaded from - *

- * - this field if it's `is_some` - * - env value: [`ALIBABA_CLOUD_OIDC_PROVIDER_ARN`] + *

oidc_provider_arn will be loaded from

+ *
    + *
  • this field if it's is_some
  • + *
  • env value: [ALIBABA_CLOUD_OIDC_PROVIDER_ARN]
  • + *
*/ private final String oidcProviderArn; /** - * `oidc_token_file` will be loaded from - *

- * - this field if it's `is_some` - * - env value: [`ALIBABA_CLOUD_OIDC_TOKEN_FILE`] + *

oidc_token_file will be loaded from

+ *
    + *
  • this field if it's is_some
  • + *
  • env value: [ALIBABA_CLOUD_OIDC_TOKEN_FILE]
  • + *
*/ private final String oidcTokenFile; /** - * `sts_endpoint` will be loaded from - *

- * - this field if it's `is_some` - * - env value: [`ALIBABA_CLOUD_STS_ENDPOINT`] + *

sts_endpoint will be loaded from

+ *
    + *
  • this field if it's is_some
  • + *
  • env value: [ALIBABA_CLOUD_STS_ENDPOINT]
  • + *
*/ private final String stsEndpoint; @@ -2321,7 +2405,7 @@ public String scheme() { } @Override - public HashMap configMap() { + public Map configMap() { final HashMap map = new HashMap<>(); map.put("bucket", bucket); if (root != null) { @@ -2373,26 +2457,28 @@ public HashMap configMap() { } } + /** + * Configuration for service pcloud. + */ @Builder @Data @RequiredArgsConstructor(access = AccessLevel.PRIVATE) class Pcloud implements ServiceConfig { /** - * pCloud endpoint address. + *

pCloud endpoint address.

*/ private final @NonNull String endpoint; /** - * root of this backend. - *

- * All operations will happen under this root. + *

root of this backend.

+ *

All operations will happen under this root.

*/ private final String root; /** - * pCloud username. + *

pCloud username.

*/ private final String username; /** - * pCloud password. + *

pCloud password.

*/ private final String password; @@ -2402,7 +2488,7 @@ public String scheme() { } @Override - public HashMap configMap() { + public Map configMap() { final HashMap map = new HashMap<>(); map.put("endpoint", endpoint); if (root != null) { @@ -2418,20 +2504,23 @@ public HashMap configMap() { } } + /** + * Configuration for service persy. + */ @Builder @Data @RequiredArgsConstructor(access = AccessLevel.PRIVATE) class Persy implements ServiceConfig { /** - * That path to the persy data file. The directory in the path must already exist. + *

That path to the persy data file. The directory in the path must already exist.

*/ private final String datafile; /** - * That name of the persy segment. + *

That name of the persy segment.

*/ private final String segment; /** - * That name of the persy index. + *

That name of the persy index.

*/ private final String index; @@ -2441,7 +2530,7 @@ public String scheme() { } @Override - public HashMap configMap() { + public Map configMap() { final HashMap map = new HashMap<>(); if (datafile != null) { map.put("datafile", datafile); @@ -2456,39 +2545,40 @@ public HashMap configMap() { } } + /** + * Configuration for service postgresql. + */ @Builder @Data @RequiredArgsConstructor(access = AccessLevel.PRIVATE) class Postgresql implements ServiceConfig { /** - * Root of this backend. - *

- * All operations will happen under this root. - *

- * Default to `/` if not set. + *

Root of this backend.

+ *

All operations will happen under this root.

+ *

Default to / if not set.

*/ private final String root; /** - * The URL should be with a scheme of either `postgres://` or `postgresql://`. - *

- * - `postgresql://user@localhost` - * - `postgresql://user:password@%2Fvar%2Flib%2Fpostgresql/mydb?connect_timeout=10` - * - `postgresql://user@host1:1234,host2,host3:5678?target_session_attrs=read-write` - * - `postgresql:///mydb?user=user&host=/var/lib/postgresql` - *

- * For more information, please visit . + *

The URL should be with a scheme of either postgres:// or postgresql://.

+ *
    + *
  • postgresql://user@localhost
  • + *
  • postgresql://user:password@%2Fvar%2Flib%2Fpostgresql/mydb?connect_timeout=10
  • + *
  • postgresql://user@host1:1234,host2,host3:5678?target_session_attrs=read-write
  • + *
  • postgresql:///mydb?user=user&host=/var/lib/postgresql
  • + *
+ *

For more information, please visit https://docs.rs/sqlx/latest/sqlx/postgres/struct.PgConnectOptions.html.

*/ private final String connectionString; /** - * the table of postgresql + *

the table of postgresql

*/ private final String table; /** - * the key field of postgresql + *

the key field of postgresql

*/ private final String keyField; /** - * the value field of postgresql + *

the value field of postgresql

*/ private final String valueField; @@ -2498,7 +2588,7 @@ public String scheme() { } @Override - public HashMap configMap() { + public Map configMap() { final HashMap map = new HashMap<>(); if (root != null) { map.put("root", root); @@ -2519,20 +2609,23 @@ public HashMap configMap() { } } + /** + * Configuration for service redb. + */ @Builder @Data @RequiredArgsConstructor(access = AccessLevel.PRIVATE) class Redb implements ServiceConfig { /** - * path to the redb data directory. + *

path to the redb data directory.

*/ private final String datadir; /** - * The root for redb. + *

The root for redb.

*/ private final String root; /** - * The table name for redb. + *

The table name for redb.

*/ private final String table; @@ -2542,7 +2635,7 @@ public String scheme() { } @Override - public HashMap configMap() { + public Map configMap() { final HashMap map = new HashMap<>(); if (datadir != null) { map.put("datadir", datadir); @@ -2557,48 +2650,45 @@ public HashMap configMap() { } } + /** + * Configuration for service redis. + */ @Builder @Data @RequiredArgsConstructor(access = AccessLevel.PRIVATE) class Redis implements ServiceConfig { /** - * the number of DBs redis can take is unlimited - *

- * default is db 0 + *

the number of DBs redis can take is unlimited

+ *

default is db 0

*/ private final long db; /** - * network address of the Redis service. Can be "tcp://127.0.0.1:6379", e.g. - *

- * default is "tcp://127.0.0.1:6379" + *

network address of the Redis service. Can be "tcp://127.0.0.1:6379", e.g.

+ *

default is "tcp://127.0.0.1:6379"

*/ private final String endpoint; /** - * network address of the Redis cluster service. Can be "tcp://127.0.0.1:6379,tcp://127.0.0.1:6380,tcp://127.0.0.1:6381", e.g. - *

- * default is None + *

network address of the Redis cluster service. Can be "tcp://127.0.0.1:6379,tcp://127.0.0.1:6380,tcp://127.0.0.1:6381", e.g.

+ *

default is None

*/ private final String clusterEndpoints; /** - * the username to connect redis service. - *

- * default is None + *

the username to connect redis service.

+ *

default is None

*/ private final String username; /** - * the password for authentication - *

- * default is None + *

the password for authentication

+ *

default is None

*/ private final String password; /** - * the working directory of the Redis service. Can be "/path/to/dir" - *

- * default is "/" + *

the working directory of the Redis service. Can be "/path/to/dir"

+ *

default is "/"

*/ private final String root; /** - * The default ttl for put operations. + *

The default ttl for put operations.

*/ private final Duration defaultTtl; @@ -2608,7 +2698,7 @@ public String scheme() { } @Override - public HashMap configMap() { + public Map configMap() { final HashMap map = new HashMap<>(); map.put("db", String.valueOf(db)); if (endpoint != null) { @@ -2633,219 +2723,210 @@ public HashMap configMap() { } } + /** + * Configuration for service s3. + */ @Builder @Data @RequiredArgsConstructor(access = AccessLevel.PRIVATE) class S3 implements ServiceConfig { /** - * bucket name of this backend. - *

- * required. + *

bucket name of this backend.

+ *

required.

*/ private final @NonNull String bucket; /** - * root of this backend. - *

- * All operations will happen under this root. - *

- * default to `/` if not set. + *

root of this backend.

+ *

All operations will happen under this root.

+ *

default to / if not set.

*/ private final String root; /** - * is bucket versioning enabled for this bucket + *

is bucket versioning enabled for this bucket

*/ private final Boolean enableVersioning; /** - * endpoint of this backend. - *

- * Endpoint must be full uri, e.g. - *

- * - AWS S3: `https://s3.amazonaws.com` or `https://s3.{region}.amazonaws.com` - * - Cloudflare R2: `https://.r2.cloudflarestorage.com` - * - Aliyun OSS: `https://{region}.aliyuncs.com` - * - Tencent COS: `https://cos.{region}.myqcloud.com` - * - Minio: `http://127.0.0.1:9000` - *

- * If user inputs endpoint without scheme like "s3.amazonaws.com", we - * will prepend "https://" before it. - *

- * - If endpoint is set, we will take user's input first. - * - If not, we will try to load it from environment. - * - If still not set, default to `https://s3.amazonaws.com`. + *

endpoint of this backend.

+ *

Endpoint must be full uri, e.g.

+ *
    + *
  • AWS S3: https://s3.amazonaws.com or https://s3.{region}.amazonaws.com
  • + *
  • Cloudflare R2: https://<ACCOUNT_ID>.r2.cloudflarestorage.com
  • + *
  • Aliyun OSS: https://{region}.aliyuncs.com
  • + *
  • Tencent COS: https://cos.{region}.myqcloud.com
  • + *
  • Minio: http://127.0.0.1:9000
  • + *
+ *

If user inputs endpoint without scheme like "s3.amazonaws.com", we + * will prepend "https://" before it.

+ *
    + *
  • If endpoint is set, we will take user's input first.
  • + *
  • If not, we will try to load it from environment.
  • + *
  • If still not set, default to https://s3.amazonaws.com.
  • + *
*/ private final String endpoint; /** - * Region represent the signing region of this endpoint. This is required - * if you are using the default AWS S3 endpoint. - *

- * If using a custom endpoint, - * - If region is set, we will take user's input first. - * - If not, we will try to load it from environment. + *

Region represent the signing region of this endpoint. This is required + * if you are using the default AWS S3 endpoint.

+ *

If using a custom endpoint,

+ *
    + *
  • If region is set, we will take user's input first.
  • + *
  • If not, we will try to load it from environment.
  • + *
*/ private final String region; /** - * access_key_id of this backend. - *

- * - If access_key_id is set, we will take user's input first. - * - If not, we will try to load it from environment. + *

access_key_id of this backend.

+ *
    + *
  • If access_key_id is set, we will take user's input first.
  • + *
  • If not, we will try to load it from environment.
  • + *
*/ private final String accessKeyId; /** - * secret_access_key of this backend. - *

- * - If secret_access_key is set, we will take user's input first. - * - If not, we will try to load it from environment. + *

secret_access_key of this backend.

+ *
    + *
  • If secret_access_key is set, we will take user's input first.
  • + *
  • If not, we will try to load it from environment.
  • + *
*/ private final String secretAccessKey; /** - * session_token (aka, security token) of this backend. - *

- * This token will expire after sometime, it's recommended to set session_token - * by hand. + *

session_token (aka, security token) of this backend.

+ *

This token will expire after sometime, it's recommended to set session_token + * by hand.

*/ private final String sessionToken; /** - * role_arn for this backend. - *

- * If `role_arn` is set, we will use already known config as source - * credential to assume role with `role_arn`. + *

role_arn for this backend.

+ *

If role_arn is set, we will use already known config as source + * credential to assume role with role_arn.

*/ private final String roleArn; /** - * external_id for this backend. + *

external_id for this backend.

*/ private final String externalId; /** - * role_session_name for this backend. + *

role_session_name for this backend.

*/ private final String roleSessionName; /** - * Disable config load so that opendal will not load config from - * environment. - *

- * For examples: - *

- * - envs like `AWS_ACCESS_KEY_ID` - * - files like `~/.aws/config` + *

Disable config load so that opendal will not load config from + * environment.

+ *

For examples:

+ *
    + *
  • envs like AWS_ACCESS_KEY_ID
  • + *
  • files like ~/.aws/config
  • + *
*/ private final Boolean disableConfigLoad; /** - * Disable load credential from ec2 metadata. - *

- * This option is used to disable the default behavior of opendal - * to load credential from ec2 metadata, a.k.a, IMDSv2 + *

Disable load credential from ec2 metadata.

+ *

This option is used to disable the default behavior of opendal + * to load credential from ec2 metadata, a.k.a, IMDSv2

*/ private final Boolean disableEc2Metadata; /** - * Allow anonymous will allow opendal to send request without signing - * when credential is not loaded. + *

Allow anonymous will allow opendal to send request without signing + * when credential is not loaded.

*/ private final Boolean allowAnonymous; /** - * server_side_encryption for this backend. - *

- * Available values: `AES256`, `aws:kms`. + *

server_side_encryption for this backend.

+ *

Available values: AES256, aws:kms.

*/ private final String serverSideEncryption; /** - * server_side_encryption_aws_kms_key_id for this backend - *

- * - If `server_side_encryption` set to `aws:kms`, and `server_side_encryption_aws_kms_key_id` - * is not set, S3 will use aws managed kms key to encrypt data. - * - If `server_side_encryption` set to `aws:kms`, and `server_side_encryption_aws_kms_key_id` - * is a valid kms key id, S3 will use the provided kms key to encrypt data. - * - If the `server_side_encryption_aws_kms_key_id` is invalid or not found, an error will be - * returned. - * - If `server_side_encryption` is not `aws:kms`, setting `server_side_encryption_aws_kms_key_id` - * is a noop. + *

server_side_encryption_aws_kms_key_id for this backend

+ *
    + *
  • If server_side_encryption set to aws:kms, and server_side_encryption_aws_kms_key_id + * is not set, S3 will use aws managed kms key to encrypt data.
  • + *
  • If server_side_encryption set to aws:kms, and server_side_encryption_aws_kms_key_id + * is a valid kms key id, S3 will use the provided kms key to encrypt data.
  • + *
  • If the server_side_encryption_aws_kms_key_id is invalid or not found, an error will be + * returned.
  • + *
  • If server_side_encryption is not aws:kms, setting server_side_encryption_aws_kms_key_id + * is a noop.
  • + *
*/ private final String serverSideEncryptionAwsKmsKeyId; /** - * server_side_encryption_customer_algorithm for this backend. - *

- * Available values: `AES256`. + *

server_side_encryption_customer_algorithm for this backend.

+ *

Available values: AES256.

*/ private final String serverSideEncryptionCustomerAlgorithm; /** - * server_side_encryption_customer_key for this backend. - *

- * # Value - *

- * base64 encoded key that matches algorithm specified in - * `server_side_encryption_customer_algorithm`. + *

server_side_encryption_customer_key for this backend.

+ *

Value

+ *

base64 encoded key that matches algorithm specified in + * server_side_encryption_customer_algorithm.

*/ private final String serverSideEncryptionCustomerKey; /** - * Set server_side_encryption_customer_key_md5 for this backend. - *

- * # Value - *

- * MD5 digest of key specified in `server_side_encryption_customer_key`. + *

Set server_side_encryption_customer_key_md5 for this backend.

+ *

Value

+ *

MD5 digest of key specified in server_side_encryption_customer_key.

*/ private final String serverSideEncryptionCustomerKeyMd5; /** - * default storage_class for this backend. - *

- * Available values: - * - `DEEP_ARCHIVE` - * - `GLACIER` - * - `GLACIER_IR` - * - `INTELLIGENT_TIERING` - * - `ONEZONE_IA` - * - `OUTPOSTS` - * - `REDUCED_REDUNDANCY` - * - `STANDARD` - * - `STANDARD_IA` - *

- * S3 compatible services don't support all of them + *

default storage_class for this backend.

+ *

Available values:

+ *
    + *
  • DEEP_ARCHIVE
  • + *
  • GLACIER
  • + *
  • GLACIER_IR
  • + *
  • INTELLIGENT_TIERING
  • + *
  • ONEZONE_IA
  • + *
  • OUTPOSTS
  • + *
  • REDUCED_REDUNDANCY
  • + *
  • STANDARD
  • + *
  • STANDARD_IA
  • + *
+ *

S3 compatible services don't support all of them

*/ private final String defaultStorageClass; /** - * Enable virtual host style so that opendal will send API requests - * in virtual host style instead of path style. - *

- * - By default, opendal will send API to `https://s3.us-east-1.amazonaws.com/bucket_name` - * - Enabled, opendal will send API to `https://bucket_name.s3.us-east-1.amazonaws.com` + *

Enable virtual host style so that opendal will send API requests + * in virtual host style instead of path style.

+ *
    + *
  • By default, opendal will send API to https://s3.us-east-1.amazonaws.com/bucket_name
  • + *
  • Enabled, opendal will send API to https://bucket_name.s3.us-east-1.amazonaws.com
  • + *
*/ private final Boolean enableVirtualHostStyle; /** - * Set maximum batch operations of this backend. - *

- * Some compatible services have a limit on the number of operations in a batch request. - * For example, R2 could return `Internal Error` while batch delete 1000 files. - *

- * Please tune this value based on services' document. + *

Set maximum batch operations of this backend.

+ *

Some compatible services have a limit on the number of operations in a batch request. + * For example, R2 could return Internal Error while batch delete 1000 files.

+ *

Please tune this value based on services' document.

* * @deprecated Please use `delete_max_size` instead of `batch_max_operations` */ private final Long batchMaxOperations; /** - * Set the maximum delete size of this backend. - *

- * Some compatible services have a limit on the number of operations in a batch request. - * For example, R2 could return `Internal Error` while batch delete 1000 files. - *

- * Please tune this value based on services' document. + *

Set the maximum delete size of this backend.

+ *

Some compatible services have a limit on the number of operations in a batch request. + * For example, R2 could return Internal Error while batch delete 1000 files.

+ *

Please tune this value based on services' document.

*/ private final Long deleteMaxSize; /** - * Disable stat with override so that opendal will not send stat request with override queries. - *

- * For example, R2 doesn't support stat with `response_content_type` query. + *

Disable stat with override so that opendal will not send stat request with override queries.

+ *

For example, R2 doesn't support stat with response_content_type query.

*/ private final Boolean disableStatWithOverride; /** - * Checksum Algorithm to use when sending checksums in HTTP headers. - * This is necessary when writing to AWS S3 Buckets with Object Lock enabled for example. - *

- * Available options: - * - "crc32c" + *

Checksum Algorithm to use when sending checksums in HTTP headers. + * This is necessary when writing to AWS S3 Buckets with Object Lock enabled for example.

+ *

Available options:

+ *
    + *
  • "crc32c"
  • + *
*/ private final String checksumAlgorithm; /** - * Disable write with if match so that opendal will not send write request with if match headers. - *

- * For example, Ceph RADOS S3 doesn't support write with if match. + *

Disable write with if match so that opendal will not send write request with if match headers.

+ *

For example, Ceph RADOS S3 doesn't support write with if match.

*/ private final Boolean disableWriteWithIfMatch; @@ -2855,7 +2936,7 @@ public String scheme() { } @Override - public HashMap configMap() { + public Map configMap() { final HashMap map = new HashMap<>(); map.put("bucket", bucket); if (root != null) { @@ -2937,32 +3018,33 @@ public HashMap configMap() { } } + /** + * Configuration for service seafile. + */ @Builder @Data @RequiredArgsConstructor(access = AccessLevel.PRIVATE) class Seafile implements ServiceConfig { /** - * repo_name of this backend. - *

- * required. + *

repo_name of this backend.

+ *

required.

*/ private final @NonNull String repoName; /** - * root of this backend. - *

- * All operations will happen under this root. + *

root of this backend.

+ *

All operations will happen under this root.

*/ private final String root; /** - * endpoint address of this backend. + *

endpoint address of this backend.

*/ private final String endpoint; /** - * username of this backend. + *

username of this backend.

*/ private final String username; /** - * password of this backend. + *

password of this backend.

*/ private final String password; @@ -2972,7 +3054,7 @@ public String scheme() { } @Override - public HashMap configMap() { + public Map configMap() { final HashMap map = new HashMap<>(); map.put("repo_name", repoName); if (root != null) { @@ -2991,32 +3073,35 @@ public HashMap configMap() { } } + /** + * Configuration for service sftp. + */ @Builder @Data @RequiredArgsConstructor(access = AccessLevel.PRIVATE) class Sftp implements ServiceConfig { /** - * endpoint of this backend + *

endpoint of this backend

*/ private final String endpoint; /** - * root of this backend + *

root of this backend

*/ private final String root; /** - * user of this backend + *

user of this backend

*/ private final String user; /** - * key of this backend + *

key of this backend

*/ private final String key; /** - * known_hosts_strategy of this backend + *

known_hosts_strategy of this backend

*/ private final String knownHostsStrategy; /** - * enable_copy of this backend + *

enable_copy of this backend

*/ private final Boolean enableCopy; @@ -3026,7 +3111,7 @@ public String scheme() { } @Override - public HashMap configMap() { + public Map configMap() { final HashMap map = new HashMap<>(); if (endpoint != null) { map.put("endpoint", endpoint); @@ -3050,20 +3135,23 @@ public HashMap configMap() { } } + /** + * Configuration for service sled. + */ @Builder @Data @RequiredArgsConstructor(access = AccessLevel.PRIVATE) class Sled implements ServiceConfig { /** - * That path to the sled data directory. + *

That path to the sled data directory.

*/ private final String datadir; /** - * The root for sled. + *

The root for sled.

*/ private final String root; /** - * The tree for sled. + *

The tree for sled.

*/ private final String tree; @@ -3073,7 +3161,7 @@ public String scheme() { } @Override - public HashMap configMap() { + public Map configMap() { final HashMap map = new HashMap<>(); if (datadir != null) { map.put("datadir", datadir); @@ -3088,46 +3176,43 @@ public HashMap configMap() { } } + /** + * Configuration for service sqlite. + */ @Builder @Data @RequiredArgsConstructor(access = AccessLevel.PRIVATE) class Sqlite implements ServiceConfig { /** - * Set the connection_string of the sqlite service. - *

- * This connection string is used to connect to the sqlite service. There are url based formats: - *

- * ## Url - *

- * This format resembles the url format of the sqlite client: - *

- * - `sqlite::memory:` - * - `sqlite:data.db` - * - `sqlite://data.db` - *

- * For more information, please visit . + *

Set the connection_string of the sqlite service.

+ *

This connection string is used to connect to the sqlite service. There are url based formats:

+ *

Url

+ *

This format resembles the url format of the sqlite client:

+ *
    + *
  • sqlite::memory:
  • + *
  • sqlite:data.db
  • + *
  • sqlite://data.db
  • + *
+ *

For more information, please visit https://docs.rs/sqlx/latest/sqlx/sqlite/struct.SqliteConnectOptions.html.

*/ private final String connectionString; /** - * Set the table name of the sqlite service to read/write. + *

Set the table name of the sqlite service to read/write.

*/ private final String table; /** - * Set the key field name of the sqlite service to read/write. - *

- * Default to `key` if not specified. + *

Set the key field name of the sqlite service to read/write.

+ *

Default to key if not specified.

*/ private final String keyField; /** - * Set the value field name of the sqlite service to read/write. - *

- * Default to `value` if not specified. + *

Set the value field name of the sqlite service to read/write.

+ *

Default to value if not specified.

*/ private final String valueField; /** - * set the working directory, all operations will be performed under it. - *

- * default: "/" + *

set the working directory, all operations will be performed under it.

+ *

default: "/"

*/ private final String root; @@ -3137,7 +3222,7 @@ public String scheme() { } @Override - public HashMap configMap() { + public Map configMap() { final HashMap map = new HashMap<>(); if (connectionString != null) { map.put("connection_string", connectionString); @@ -3158,24 +3243,27 @@ public HashMap configMap() { } } + /** + * Configuration for service supabase. + */ @Builder @Data @RequiredArgsConstructor(access = AccessLevel.PRIVATE) class Supabase implements ServiceConfig { /** - * The bucket for supabase service. + *

The bucket for supabase service.

*/ private final @NonNull String bucket; /** - * The root for supabase service. + *

The root for supabase service.

*/ private final String root; /** - * The endpoint for supabase service. + *

The endpoint for supabase service.

*/ private final String endpoint; /** - * The key for supabase service. + *

The key for supabase service.

*/ private final String key; @@ -3185,7 +3273,7 @@ public String scheme() { } @Override - public HashMap configMap() { + public Map configMap() { final HashMap map = new HashMap<>(); map.put("bucket", bucket); if (root != null) { @@ -3201,44 +3289,47 @@ public HashMap configMap() { } } + /** + * Configuration for service surrealdb. + */ @Builder @Data @RequiredArgsConstructor(access = AccessLevel.PRIVATE) class Surrealdb implements ServiceConfig { /** - * The connection string for surrealdb. + *

The connection string for surrealdb.

*/ private final String connectionString; /** - * The username for surrealdb. + *

The username for surrealdb.

*/ private final String username; /** - * The password for surrealdb. + *

The password for surrealdb.

*/ private final String password; /** - * The namespace for surrealdb. + *

The namespace for surrealdb.

*/ private final String namespace; /** - * The database for surrealdb. + *

The database for surrealdb.

*/ private final String database; /** - * The table for surrealdb. + *

The table for surrealdb.

*/ private final String table; /** - * The key field for surrealdb. + *

The key field for surrealdb.

*/ private final String keyField; /** - * The value field for surrealdb. + *

The value field for surrealdb.

*/ private final String valueField; /** - * The root for surrealdb. + *

The root for surrealdb.

*/ private final String root; @@ -3248,7 +3339,7 @@ public String scheme() { } @Override - public HashMap configMap() { + public Map configMap() { final HashMap map = new HashMap<>(); if (connectionString != null) { map.put("connection_string", connectionString); @@ -3281,24 +3372,27 @@ public HashMap configMap() { } } + /** + * Configuration for service swift. + */ @Builder @Data @RequiredArgsConstructor(access = AccessLevel.PRIVATE) class Swift implements ServiceConfig { /** - * The endpoint for Swift. + *

The endpoint for Swift.

*/ private final String endpoint; /** - * The container for Swift. + *

The container for Swift.

*/ private final String container; /** - * The root for Swift. + *

The root for Swift.

*/ private final String root; /** - * The token for Swift. + *

The token for Swift.

*/ private final String token; @@ -3308,7 +3402,7 @@ public String scheme() { } @Override - public HashMap configMap() { + public Map configMap() { final HashMap map = new HashMap<>(); if (endpoint != null) { map.put("endpoint", endpoint); @@ -3326,26 +3420,28 @@ public HashMap configMap() { } } + /** + * Configuration for service upyun. + */ @Builder @Data @RequiredArgsConstructor(access = AccessLevel.PRIVATE) class Upyun implements ServiceConfig { /** - * bucket address of this backend. + *

bucket address of this backend.

*/ private final @NonNull String bucket; /** - * root of this backend. - *

- * All operations will happen under this root. + *

root of this backend.

+ *

All operations will happen under this root.

*/ private final String root; /** - * username of this backend. + *

username of this backend.

*/ private final String operator; /** - * password of this backend. + *

password of this backend.

*/ private final String password; @@ -3355,7 +3451,7 @@ public String scheme() { } @Override - public HashMap configMap() { + public Map configMap() { final HashMap map = new HashMap<>(); map.put("bucket", bucket); if (root != null) { @@ -3371,12 +3467,15 @@ public HashMap configMap() { } } + /** + * Configuration for service vercel_artifacts. + */ @Builder @Data @RequiredArgsConstructor(access = AccessLevel.PRIVATE) class VercelArtifacts implements ServiceConfig { /** - * The access token for Vercel. + *

The access token for Vercel.

*/ private final String accessToken; @@ -3386,7 +3485,7 @@ public String scheme() { } @Override - public HashMap configMap() { + public Map configMap() { final HashMap map = new HashMap<>(); if (accessToken != null) { map.put("access_token", accessToken); @@ -3395,18 +3494,20 @@ public HashMap configMap() { } } + /** + * Configuration for service vercel_blob. + */ @Builder @Data @RequiredArgsConstructor(access = AccessLevel.PRIVATE) class VercelBlob implements ServiceConfig { /** - * root of this backend. - *

- * All operations will happen under this root. + *

root of this backend.

+ *

All operations will happen under this root.

*/ private final String root; /** - * vercel blob token. + *

vercel blob token.

*/ private final String token; @@ -3416,7 +3517,7 @@ public String scheme() { } @Override - public HashMap configMap() { + public Map configMap() { final HashMap map = new HashMap<>(); if (root != null) { map.put("root", root); @@ -3428,32 +3529,35 @@ public HashMap configMap() { } } + /** + * Configuration for service webdav. + */ @Builder @Data @RequiredArgsConstructor(access = AccessLevel.PRIVATE) class Webdav implements ServiceConfig { /** - * endpoint of this backend + *

endpoint of this backend

*/ private final String endpoint; /** - * username of this backend + *

username of this backend

*/ private final String username; /** - * password of this backend + *

password of this backend

*/ private final String password; /** - * token of this backend + *

token of this backend

*/ private final String token; /** - * root of this backend + *

root of this backend

*/ private final String root; /** - * WebDAV Service doesn't support copy. + *

WebDAV Service doesn't support copy.

*/ private final Boolean disableCopy; @@ -3463,7 +3567,7 @@ public String scheme() { } @Override - public HashMap configMap() { + public Map configMap() { final HashMap map = new HashMap<>(); if (endpoint != null) { map.put("endpoint", endpoint); @@ -3487,28 +3591,31 @@ public HashMap configMap() { } } + /** + * Configuration for service webhdfs. + */ @Builder @Data @RequiredArgsConstructor(access = AccessLevel.PRIVATE) class Webhdfs implements ServiceConfig { /** - * Root for webhdfs. + *

Root for webhdfs.

*/ private final String root; /** - * Endpoint for webhdfs. + *

Endpoint for webhdfs.

*/ private final String endpoint; /** - * Delegation token for webhdfs. + *

Delegation token for webhdfs.

*/ private final String delegation; /** - * Disable batch listing + *

Disable batch listing

*/ private final Boolean disableListBatch; /** - * atomic_write_dir of this backend + *

atomic_write_dir of this backend

*/ private final String atomicWriteDir; @@ -3518,7 +3625,7 @@ public String scheme() { } @Override - public HashMap configMap() { + public Map configMap() { final HashMap map = new HashMap<>(); if (root != null) { map.put("root", root); @@ -3539,18 +3646,20 @@ public HashMap configMap() { } } + /** + * Configuration for service yandex_disk. + */ @Builder @Data @RequiredArgsConstructor(access = AccessLevel.PRIVATE) class YandexDisk implements ServiceConfig { /** - * yandex disk oauth access_token. + *

yandex disk oauth access_token.

*/ private final @NonNull String accessToken; /** - * root of this backend. - *

- * All operations will happen under this root. + *

root of this backend.

+ *

All operations will happen under this root.

*/ private final String root; @@ -3560,7 +3669,7 @@ public String scheme() { } @Override - public HashMap configMap() { + public Map configMap() { final HashMap map = new HashMap<>(); map.put("access_token", accessToken); if (root != null) { diff --git a/dev/Cargo.lock b/dev/Cargo.lock index ec2ffb62d9b4..350142ba8707 100644 --- a/dev/Cargo.lock +++ b/dev/Cargo.lock @@ -165,6 +165,15 @@ version = "0.4.22" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" +[[package]] +name = "markdown" +version = "1.0.0-alpha.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a6491e6c702bf7e3b24e769d800746d5f2c06a6c6a2db7992612e0f429029e81" +dependencies = [ + "unicode-id", +] + [[package]] name = "memchr" version = "2.7.4" @@ -189,6 +198,7 @@ dependencies = [ "env_logger", "heck", "log", + "markdown", "minijinja", "pretty_assertions", "serde", @@ -289,6 +299,12 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "unicode-id" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "10103c57044730945224467c09f71a4db0071c123a0648cc3e818913bde6b561" + [[package]] name = "unicode-ident" version = "1.0.14" diff --git a/dev/Cargo.toml b/dev/Cargo.toml index 1ff7ab62b77c..6c7c3026dda9 100644 --- a/dev/Cargo.toml +++ b/dev/Cargo.toml @@ -33,6 +33,7 @@ clap = { version = "4.5.23", features = ["derive"] } env_logger = { version = "0.11.5" } log = { version = "0.4.22" } heck = { version = "0.5.0" } +markdown = { version = "1.0.0-alpha.21" } minijinja = { version = "2.5.0" } serde = { version = "1.0.216", features = ["derive"] } syn = { version = "2.0.91", features = ["visit", "full", "extra-traits"] } diff --git a/dev/src/generate/java.j2 b/dev/src/generate/java.j2 index 7c98469a26b0..fc741d85b154 100644 --- a/dev/src/generate/java.j2 +++ b/dev/src/generate/java.j2 @@ -23,6 +23,7 @@ package org.apache.opendal; import java.time.Duration; import java.util.HashMap; +import java.util.Map; import lombok.AccessLevel; import lombok.Builder; import lombok.Data; @@ -35,23 +36,29 @@ import lombok.RequiredArgsConstructor; */ @SuppressWarnings("unused") // intended to be used by users public interface ServiceConfig { + /** + * The scheme of the service. + * + * @return the scheme + */ String scheme(); - HashMap configMap(); - - {% for srv in srvs %} + /** + * Convert the structured config to a type erased config map. + * + * @return the config map + */ + Map configMap(); +{% for srv in srvs %} + /** + * Configuration for service {{srv}}. + */ @Builder @Data @RequiredArgsConstructor(access = AccessLevel.PRIVATE) class {{srv | case_java_class_name}} implements ServiceConfig { {%- for field in srvs[srv].config %} - /** - * {{field.comments}} - {%- if field.deprecated %} - * @deprecated {{field.deprecated["note"]}} - {%- endif %} - */ - {{make_field(field)}} + {{make_field(field) | indent(8)}} {%- endfor %} @Override @@ -60,13 +67,13 @@ public interface ServiceConfig { } @Override - public HashMap configMap() { + public Map configMap() { final HashMap map = new HashMap<>(); {% for field in srvs[srv].config -%} - {{make_populate_map(field)}} + {{make_populate_map(field) | indent(12)}} {% endfor -%} return map; } } - {% endfor %} +{% endfor -%} } diff --git a/dev/src/generate/java.rs b/dev/src/generate/java.rs index 2abd51760a1b..5dfdb898224c 100644 --- a/dev/src/generate/java.rs +++ b/dev/src/generate/java.rs @@ -41,19 +41,38 @@ pub fn generate(workspace_dir: PathBuf, services: Services) -> Result<()> { let output = workspace_dir.join("bindings/java/src/main/java/org/apache/opendal/ServiceConfig.java"); - fs::write(output, tmpl.render(context! { srvs => srvs })?)?; + let rendered = tmpl.render(context! { srvs => srvs })?; + fs::write(output, format!("{rendered}\n"))?; Ok(()) } -fn case_java_class_name(s: String) -> String { +fn case_java_class_name(s: &str) -> String { heck::AsUpperCamelCase(s).to_string() } -fn case_java_field_name(s: String) -> String { +fn case_java_field_name(s: &str) -> String { heck::AsLowerCamelCase(s).to_string() } fn make_field(field: ViaDeserialize) -> Result { + use std::fmt::Write; + + let mut result = String::new(); + let w = &mut result; + + // write comment + let html = markdown::to_html(&field.comments); + writeln!(w, "/**")?; + for line in html.lines() { + writeln!(w, " * {}", line)?; + } + if let Some(deprecated) = &field.deprecated { + writeln!(w, " *")?; + writeln!(w, " * @deprecated {}", deprecated.note)?; + } + writeln!(w, " */")?; + + // write field definition let field_type = if field.optional { match field.value { ConfigType::Bool => "Boolean", @@ -74,14 +93,21 @@ fn make_field(field: ViaDeserialize) -> Result } }; - Ok(format!( + writeln!( + w, "private final {} {};", field_type, - case_java_field_name(field.name.clone()) - )) + case_java_field_name(&field.name) + )?; + Ok(result) } fn make_populate_map(field: ViaDeserialize) -> Result { + use std::fmt::Write; + + let mut result = String::new(); + let w = &mut result; + let populate = match field.value { ConfigType::Usize | ConfigType::U64 @@ -91,32 +117,32 @@ fn make_populate_map(field: ViaDeserialize) -> Result format!( "map.put(\"{}\", String.valueOf({}));", field.name, - case_java_field_name(field.name.clone()) + case_java_field_name(&field.name) ), ConfigType::String => format!( "map.put(\"{}\", {});", field.name, - case_java_field_name(field.name.clone()) + case_java_field_name(&field.name) ), ConfigType::Duration => format!( "map.put(\"{}\", {}.toString());", field.name, - case_java_field_name(field.name.clone()) + case_java_field_name(&field.name) ), ConfigType::Vec => format!( "map.put(\"{}\", String.join(\",\", {}));", field.name, - case_java_field_name(field.name.clone()) + case_java_field_name(&field.name) ), }; if field.optional { - Ok(format!( - "if ({} != null) {{\n {}\n}}", - case_java_field_name(field.name.clone()), - populate - )) + writeln!(w, "if ({} != null) {{", case_java_field_name(&field.name))?; + writeln!(w, " {}", populate)?; + writeln!(w, "}}")?; } else { - Ok(populate) + writeln!(w, "{}", populate)?; } + + Ok(result) } diff --git a/dev/src/generate/parser.rs b/dev/src/generate/parser.rs index ee4bc4d4c9c4..715e1ce7dfdb 100644 --- a/dev/src/generate/parser.rs +++ b/dev/src/generate/parser.rs @@ -362,8 +362,8 @@ impl ServiceParser { #[cfg(test)] mod tests { use super::*; + use crate::workspace_dir; use pretty_assertions::assert_eq; - use std::path::PathBuf; use syn::ItemStruct; #[test] @@ -680,9 +680,8 @@ For example, Ceph RADOS S3 doesn't support write with if match.".to_string(), #[test] fn test_parse() { - let manifest_dir = PathBuf::from(env!("CARGO_MANIFEST_DIR")); - let path = manifest_dir - .join("../core/src/services") + let path = workspace_dir() + .join("core/src/services") .canonicalize() .unwrap();