Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature: support for Kodo #2363

Merged
merged 2 commits into from
Jul 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions config/openim-rpc-third.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,12 @@ object:
accessKeyID: ''
accessKeySecret: ''
sessionToken: ''
publicRead: false
kodo:
endpoint: "http://s3.cn-south-1.qiniucs.com"
bucket: "kodo-bucket-test"
bucketURL: "http://kodo-bucket-test-oetobfb.qiniudns.com"
accessKeyID: ''
accessKeySecret: ''
sessionToken: ''
publicRead: false
19 changes: 19 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,24 @@ require (
cloud.google.com/go/longrunning v0.5.4 // indirect
cloud.google.com/go/storage v1.36.0 // indirect
github.com/aliyun/aliyun-oss-go-sdk v3.0.2+incompatible // indirect
github.com/aws/aws-sdk-go-v2 v1.23.1 // indirect
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.5.1 // indirect
github.com/aws/aws-sdk-go-v2/config v1.25.4 // indirect
github.com/aws/aws-sdk-go-v2/credentials v1.16.3 // indirect
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.14.5 // indirect
github.com/aws/aws-sdk-go-v2/internal/configsources v1.2.4 // indirect
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.5.4 // indirect
github.com/aws/aws-sdk-go-v2/internal/ini v1.7.1 // indirect
github.com/aws/aws-sdk-go-v2/internal/v4a v1.2.4 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.10.1 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.2.4 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.10.4 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.16.4 // indirect
github.com/aws/aws-sdk-go-v2/service/s3 v1.43.1 // indirect
github.com/aws/aws-sdk-go-v2/service/sso v1.17.3 // indirect
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.20.1 // indirect
github.com/aws/aws-sdk-go-v2/service/sts v1.25.4 // indirect
github.com/aws/smithy-go v1.17.0 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/bytedance/sonic v1.9.1 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
Expand Down Expand Up @@ -119,6 +137,7 @@ require (
github.com/prometheus/client_model v0.5.0 // indirect
github.com/prometheus/common v0.45.0 // indirect
github.com/prometheus/procfs v0.12.0 // indirect
github.com/qiniu/go-sdk/v7 v7.18.2 // indirect
github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect
github.com/rs/xid v1.5.0 // indirect
github.com/sagikazarmark/locafero v0.4.0 // indirect
Expand Down
3 changes: 3 additions & 0 deletions internal/rpc/third/third.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import (
"github.com/openimsdk/tools/s3/cos"
"github.com/openimsdk/tools/s3/minio"
"github.com/openimsdk/tools/s3/oss"
"github.com/openimsdk/tools/s3/kodo"
"google.golang.org/grpc"
)

Expand Down Expand Up @@ -81,6 +82,8 @@ func Start(ctx context.Context, config *Config, client discovery.SvcDiscoveryReg
o, err = cos.NewCos(*config.RpcConfig.Object.Cos.Build())
case "oss":
o, err = oss.NewOSS(*config.RpcConfig.Object.Oss.Build())
case "kodo":
o, err = kodo.NewKodo(*config.RpcConfig.Object.Kodo.Build())
default:
err = fmt.Errorf("invalid object enable: %s", enable)
}
Expand Down
33 changes: 24 additions & 9 deletions pkg/common/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"github.com/openimsdk/tools/s3/cos"
"github.com/openimsdk/tools/s3/minio"
"github.com/openimsdk/tools/s3/oss"
"github.com/openimsdk/tools/s3/kodo"

Check failure on line 24 in pkg/common/config/config.go

View workflow job for this annotation

GitHub Actions / Execute OpenIM Script On Linux (arm64)

no required module provides package github.com/openimsdk/tools/s3/kodo; to add it:

Check failure on line 24 in pkg/common/config/config.go

View workflow job for this annotation

GitHub Actions / Execute OpenIM Script On Linux (arm64)

no required module provides package github.com/openimsdk/tools/s3/kodo; to add it:

Check failure on line 24 in pkg/common/config/config.go

View workflow job for this annotation

GitHub Actions / Execute OpenIM Script On Linux (arm64)

no required module provides package github.com/openimsdk/tools/s3/kodo; to add it:

Check failure on line 24 in pkg/common/config/config.go

View workflow job for this annotation

GitHub Actions / Execute OpenIM Script On Linux (arm64)

no required module provides package github.com/openimsdk/tools/s3/kodo; to add it:

Check failure on line 24 in pkg/common/config/config.go

View workflow job for this annotation

GitHub Actions / Execute OpenIM Script On Linux (armv7)

no required module provides package github.com/openimsdk/tools/s3/kodo; to add it:

Check failure on line 24 in pkg/common/config/config.go

View workflow job for this annotation

GitHub Actions / Execute OpenIM Script On Linux (armv7)

no required module provides package github.com/openimsdk/tools/s3/kodo; to add it:

Check failure on line 24 in pkg/common/config/config.go

View workflow job for this annotation

GitHub Actions / Execute OpenIM Script On Linux (armv7)

no required module provides package github.com/openimsdk/tools/s3/kodo; to add it:

Check failure on line 24 in pkg/common/config/config.go

View workflow job for this annotation

GitHub Actions / Execute OpenIM Script On Linux (armv7)

no required module provides package github.com/openimsdk/tools/s3/kodo; to add it:

Check failure on line 24 in pkg/common/config/config.go

View workflow job for this annotation

GitHub Actions / Execute OpenIM Script On Linux (amd64)

no required module provides package github.com/openimsdk/tools/s3/kodo; to add it:

Check failure on line 24 in pkg/common/config/config.go

View workflow job for this annotation

GitHub Actions / Execute OpenIM Script On Linux (amd64)

no required module provides package github.com/openimsdk/tools/s3/kodo; to add it:

Check failure on line 24 in pkg/common/config/config.go

View workflow job for this annotation

GitHub Actions / Execute OpenIM Script On Linux (amd64)

no required module provides package github.com/openimsdk/tools/s3/kodo; to add it:

Check failure on line 24 in pkg/common/config/config.go

View workflow job for this annotation

GitHub Actions / Execute OpenIM Script On Linux (amd64)

no required module provides package github.com/openimsdk/tools/s3/kodo; to add it:
"strings"
"time"
)
Expand Down Expand Up @@ -278,15 +279,7 @@
Enable string `mapstructure:"enable"`
Cos Cos `mapstructure:"cos"`
Oss Oss `mapstructure:"oss"`
Kodo struct {
Endpoint string `mapstructure:"endpoint"`
Bucket string `mapstructure:"bucket"`
BucketURL string `mapstructure:"bucketURL"`
AccessKeyID string `mapstructure:"accessKeyID"`
AccessKeySecret string `mapstructure:"accessKeySecret"`
SessionToken string `mapstructure:"sessionToken"`
PublicRead bool `mapstructure:"publicRead"`
} `mapstructure:"kodo"`
Kodo Kodo `mapstructure:"kodo"`
Aws struct {
Endpoint string `mapstructure:"endpoint"`
Region string `mapstructure:"region"`
Expand Down Expand Up @@ -314,6 +307,16 @@
PublicRead bool `mapstructure:"publicRead"`
}

type Kodo struct {
Endpoint string `mapstructure:"endpoint"`
Bucket string `mapstructure:"bucket"`
BucketURL string `mapstructure:"bucketURL"`
AccessKeyID string `mapstructure:"accessKeyID"`
AccessKeySecret string `mapstructure:"accessKeySecret"`
SessionToken string `mapstructure:"sessionToken"`
PublicRead bool `mapstructure:"publicRead"`
}

type User struct {
RPC struct {
RegisterIP string `mapstructure:"registerIP"`
Expand Down Expand Up @@ -524,6 +527,18 @@
}
}

func (o *Kodo) Build() *kodo.Config {
return &kodo.Config{
Endpoint: o.Endpoint,
Bucket: o.Bucket,
BucketURL: o.BucketURL,
AccessKeyID: o.AccessKeyID,
AccessKeySecret: o.AccessKeySecret,
SessionToken: o.SessionToken,
PublicRead: o.PublicRead,
}
}

func (l *CacheConfig) Failed() time.Duration {
return time.Second * time.Duration(l.FailedExpire)
}
Expand Down
Loading