Skip to content

Commit

Permalink
bulkWriter support localMinio (#871)
Browse files Browse the repository at this point in the history
Signed-off-by: lentitude2tk <xushuang.hu@zilliz.com>
  • Loading branch information
lentitude2tk authored Apr 19, 2024
1 parent 6a920df commit 1ea5782
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
10 changes: 7 additions & 3 deletions examples/main/java/io/milvus/BulkWriterExample.java
Original file line number Diff line number Diff line change
Expand Up @@ -78,16 +78,20 @@ public class BulkWriterExample {
* you need to configure it accordingly; Otherwise, you can ignore it.
*/
public static class StorageConsts {
public static final CloudStorage cloudStorage = CloudStorage.AWS;
public static final CloudStorage cloudStorage = CloudStorage.MINIO;

/**
* If using remote storage such as AWS S3, GCP GCS, Aliyun OSS, Tencent Cloud TOS,
* If using remote storage such as AWS S3, GCP GCS, Aliyun OSS, Tencent Cloud TOS, Minio
* please configure the following parameters.
*/
public static final String STORAGE_ENDPOINT = cloudStorage.getEndpoint();
public static final String STORAGE_ENDPOINT = cloudStorage.getEndpoint("http://127.0.0.1:9000");
public static final String STORAGE_BUCKET = "storage.bucket";
public static final String STORAGE_ACCESS_KEY = "storage.access.key";
public static final String STORAGE_SECRET_KEY = "storage.secret.key";
/**
* if using local storage such as Minio
* Please set this parameter to empty.
*/
public static final String STORAGE_REGION = "storage.region";

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import org.apache.commons.lang3.StringUtils;

public enum CloudStorage {
MINIO("%s", "minioAddress"),
AWS("s3.amazonaws.com", null),
GCP("storage.googleapis.com", null),
AZURE("%s.blob.core.windows.net", "accountName"),
Expand Down Expand Up @@ -60,14 +61,14 @@ public String getS3ObjectUrl(String bucketName, String commonPrefix, String regi
case ALI:
return String.format("https://%s.oss-%s.aliyuncs.com/%s", bucketName, region, commonPrefix);
default:
throw new ParamException("no support others storage address");
throw new ParamException("no support others remote storage address");
}
}

public String getAzureObjectUrl(String accountName, String containerName, String commonPrefix) {
if (this == CloudStorage.AZURE) {
return String.format("https://%s.blob.core.windows.net/%s/%s", accountName, containerName, commonPrefix);
}
throw new ParamException("no support others storage address");
throw new ParamException("no support others remote storage address");
}
}

0 comments on commit 1ea5782

Please sign in to comment.