@@ -15,8 +15,10 @@ import (
1515 objstoretracing "github.com/thanos-io/objstore/tracing/opentracing"
1616
1717 "github.com/grafana/loki/v3/pkg/storage/bucket/azure"
18+ "github.com/grafana/loki/v3/pkg/storage/bucket/bos"
1819 "github.com/grafana/loki/v3/pkg/storage/bucket/filesystem"
1920 "github.com/grafana/loki/v3/pkg/storage/bucket/gcs"
21+ "github.com/grafana/loki/v3/pkg/storage/bucket/oss"
2022 "github.com/grafana/loki/v3/pkg/storage/bucket/s3"
2123 "github.com/grafana/loki/v3/pkg/storage/bucket/swift"
2224)
@@ -37,12 +39,18 @@ const (
3739 // Filesystem is the value for the filesystem storage backend.
3840 Filesystem = "filesystem"
3941
42+ // Alibaba is the value for the Alibaba Cloud OSS storage backend
43+ Alibaba = "alibabacloud"
44+
45+ // BOS is the value for the Baidu Cloud BOS storage backend
46+ BOS = "bos"
47+
4048 // validPrefixCharactersRegex allows only alphanumeric characters to prevent subtle bugs and simplify validation
4149 validPrefixCharactersRegex = `^[\da-zA-Z]+$`
4250)
4351
4452var (
45- SupportedBackends = []string {S3 , GCS , Azure , Swift , Filesystem }
53+ SupportedBackends = []string {S3 , GCS , Azure , Swift , Filesystem , Alibaba , BOS }
4654
4755 ErrUnsupportedStorageBackend = errors .New ("unsupported storage backend" )
4856 ErrInvalidCharactersInStoragePrefix = errors .New ("storage prefix contains invalid characters, it may only contain digits and English alphabet letters" )
@@ -73,6 +81,8 @@ type StorageBackendConfig struct {
7381 Azure azure.Config `yaml:"azure"`
7482 Swift swift.Config `yaml:"swift"`
7583 Filesystem filesystem.Config `yaml:"filesystem"`
84+ Alibaba oss.Config `yaml:"alibaba"`
85+ BOS bos.Config `yaml:"bos"`
7686
7787 // Used to inject additional backends into the config. Allows for this config to
7888 // be embedded in multiple contexts and support non-object storage based backends.
@@ -95,6 +105,8 @@ func (cfg *StorageBackendConfig) RegisterFlagsWithPrefixAndDefaultDirectory(pref
95105 cfg .Azure .RegisterFlagsWithPrefix (prefix , f )
96106 cfg .Swift .RegisterFlagsWithPrefix (prefix , f )
97107 cfg .Filesystem .RegisterFlagsWithPrefixAndDefaultDirectory (prefix , dir , f )
108+ cfg .Alibaba .RegisterFlagsWithPrefix (prefix , f )
109+ cfg .BOS .RegisterFlagsWithPrefix (prefix , f )
98110}
99111
100112func (cfg * StorageBackendConfig ) RegisterFlagsWithPrefix (prefix string , f * flag.FlagSet ) {
@@ -154,7 +166,7 @@ func (cfg *Config) disableRetries(backend string) error {
154166 cfg .Azure .MaxRetries = 1
155167 case Swift :
156168 cfg .Swift .MaxRetries = 1
157- case Filesystem :
169+ case Filesystem , Alibaba , BOS :
158170 // do nothing
159171 default :
160172 return fmt .Errorf ("cannot disable retries for backend: %s" , backend )
@@ -173,7 +185,7 @@ func (cfg *Config) configureTransport(backend string, rt http.RoundTripper) erro
173185 cfg .Azure .Transport = rt
174186 case Swift :
175187 cfg .Swift .Transport = rt
176- case Filesystem :
188+ case Filesystem , Alibaba , BOS :
177189 // do nothing
178190 default :
179191 return fmt .Errorf ("cannot configure transport for backend: %s" , backend )
@@ -201,6 +213,10 @@ func NewClient(ctx context.Context, backend string, cfg Config, name string, log
201213 client , err = swift .NewBucketClient (cfg .Swift , name , logger , instrumentTransport ())
202214 case Filesystem :
203215 client , err = filesystem .NewBucketClient (cfg .Filesystem )
216+ case Alibaba :
217+ client , err = oss .NewBucketClient (cfg .Alibaba , name , logger )
218+ case BOS :
219+ client , err = bos .NewBucketClient (cfg .BOS , name , logger )
204220 default :
205221 return nil , ErrUnsupportedStorageBackend
206222 }
0 commit comments