mirror of
https://gitee.com/milvus-io/milvus.git
synced 2024-11-30 02:48:45 +08:00
a05a37a583
Native support for Google cloud storage using the Google Cloud Storage libraries. Authentication is performed using GCS service account credentials JSON. Currently, Milvus supports Google Cloud Storage using S3-compatible APIs via the AWS SDK. This approach has the following limitations: 1. Overhead: Translating requests between S3-compatible APIs and GCS can introduce additional overhead. 2. Compatibility Limitations: Some features of the original S3 API may not fully translate or work as expected with GCS. To address these limitations, This enhancement is needed. Related Issue: #36212
119 lines
2.2 KiB
Go
119 lines
2.2 KiB
Go
package storage
|
|
|
|
// Option for setting params used by chunk manager client.
|
|
type config struct {
|
|
address string
|
|
bucketName string
|
|
accessKeyID string
|
|
secretAccessKeyID string
|
|
useSSL bool
|
|
sslCACert string
|
|
createBucket bool
|
|
rootPath string
|
|
useIAM bool
|
|
cloudProvider string
|
|
iamEndpoint string
|
|
useVirtualHost bool
|
|
region string
|
|
requestTimeoutMs int64
|
|
gcpCredentialJSON string
|
|
gcpNativeWithoutAuth bool // used for Unit Testing
|
|
}
|
|
|
|
func newDefaultConfig() *config {
|
|
return &config{}
|
|
}
|
|
|
|
// Option is used to config the retry function.
|
|
type Option func(*config)
|
|
|
|
func Address(addr string) Option {
|
|
return func(c *config) {
|
|
c.address = addr
|
|
}
|
|
}
|
|
|
|
func BucketName(bucketName string) Option {
|
|
return func(c *config) {
|
|
c.bucketName = bucketName
|
|
}
|
|
}
|
|
|
|
func AccessKeyID(accessKeyID string) Option {
|
|
return func(c *config) {
|
|
c.accessKeyID = accessKeyID
|
|
}
|
|
}
|
|
|
|
func SecretAccessKeyID(secretAccessKeyID string) Option {
|
|
return func(c *config) {
|
|
c.secretAccessKeyID = secretAccessKeyID
|
|
}
|
|
}
|
|
|
|
func UseSSL(useSSL bool) Option {
|
|
return func(c *config) {
|
|
c.useSSL = useSSL
|
|
}
|
|
}
|
|
|
|
func SslCACert(sslCACert string) Option {
|
|
return func(c *config) {
|
|
c.sslCACert = sslCACert
|
|
}
|
|
}
|
|
|
|
func CreateBucket(createBucket bool) Option {
|
|
return func(c *config) {
|
|
c.createBucket = createBucket
|
|
}
|
|
}
|
|
|
|
func RootPath(rootPath string) Option {
|
|
return func(c *config) {
|
|
c.rootPath = rootPath
|
|
}
|
|
}
|
|
|
|
func UseIAM(useIAM bool) Option {
|
|
return func(c *config) {
|
|
c.useIAM = useIAM
|
|
}
|
|
}
|
|
|
|
func CloudProvider(cloudProvider string) Option {
|
|
return func(c *config) {
|
|
c.cloudProvider = cloudProvider
|
|
}
|
|
}
|
|
|
|
func IAMEndpoint(iamEndpoint string) Option {
|
|
return func(c *config) {
|
|
c.iamEndpoint = iamEndpoint
|
|
}
|
|
}
|
|
|
|
func UseVirtualHost(useVirtualHost bool) Option {
|
|
return func(c *config) {
|
|
c.useVirtualHost = useVirtualHost
|
|
}
|
|
}
|
|
|
|
func Region(region string) Option {
|
|
return func(c *config) {
|
|
c.region = region
|
|
}
|
|
}
|
|
|
|
func RequestTimeout(requestTimeoutMs int64) Option {
|
|
return func(c *config) {
|
|
c.requestTimeoutMs = requestTimeoutMs
|
|
}
|
|
}
|
|
|
|
func GcpCredentialJSON(gcpCredentialJSON string) Option {
|
|
return func(c *config) {
|
|
c.gcpCredentialJSON = gcpCredentialJSON
|
|
}
|
|
}
|