@@ -15,8 +15,10 @@ import (
15
15
objstoretracing "github.com/thanos-io/objstore/tracing/opentracing"
16
16
17
17
"github.com/grafana/loki/v3/pkg/storage/bucket/azure"
18
+ "github.com/grafana/loki/v3/pkg/storage/bucket/bos"
18
19
"github.com/grafana/loki/v3/pkg/storage/bucket/filesystem"
19
20
"github.com/grafana/loki/v3/pkg/storage/bucket/gcs"
21
+ "github.com/grafana/loki/v3/pkg/storage/bucket/oss"
20
22
"github.com/grafana/loki/v3/pkg/storage/bucket/s3"
21
23
"github.com/grafana/loki/v3/pkg/storage/bucket/swift"
22
24
)
@@ -37,12 +39,18 @@ const (
37
39
// Filesystem is the value for the filesystem storage backend.
38
40
Filesystem = "filesystem"
39
41
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
+
40
48
// validPrefixCharactersRegex allows only alphanumeric characters to prevent subtle bugs and simplify validation
41
49
validPrefixCharactersRegex = `^[\da-zA-Z]+$`
42
50
)
43
51
44
52
var (
45
- SupportedBackends = []string {S3 , GCS , Azure , Swift , Filesystem }
53
+ SupportedBackends = []string {S3 , GCS , Azure , Swift , Filesystem , Alibaba , BOS }
46
54
47
55
ErrUnsupportedStorageBackend = errors .New ("unsupported storage backend" )
48
56
ErrInvalidCharactersInStoragePrefix = errors .New ("storage prefix contains invalid characters, it may only contain digits and English alphabet letters" )
@@ -73,6 +81,8 @@ type StorageBackendConfig struct {
73
81
Azure azure.Config `yaml:"azure"`
74
82
Swift swift.Config `yaml:"swift"`
75
83
Filesystem filesystem.Config `yaml:"filesystem"`
84
+ Alibaba oss.Config `yaml:"alibaba"`
85
+ BOS bos.Config `yaml:"bos"`
76
86
77
87
// Used to inject additional backends into the config. Allows for this config to
78
88
// be embedded in multiple contexts and support non-object storage based backends.
@@ -95,6 +105,8 @@ func (cfg *StorageBackendConfig) RegisterFlagsWithPrefixAndDefaultDirectory(pref
95
105
cfg .Azure .RegisterFlagsWithPrefix (prefix , f )
96
106
cfg .Swift .RegisterFlagsWithPrefix (prefix , f )
97
107
cfg .Filesystem .RegisterFlagsWithPrefixAndDefaultDirectory (prefix , dir , f )
108
+ cfg .Alibaba .RegisterFlagsWithPrefix (prefix , f )
109
+ cfg .BOS .RegisterFlagsWithPrefix (prefix , f )
98
110
}
99
111
100
112
func (cfg * StorageBackendConfig ) RegisterFlagsWithPrefix (prefix string , f * flag.FlagSet ) {
@@ -154,7 +166,7 @@ func (cfg *Config) disableRetries(backend string) error {
154
166
cfg .Azure .MaxRetries = 1
155
167
case Swift :
156
168
cfg .Swift .MaxRetries = 1
157
- case Filesystem :
169
+ case Filesystem , Alibaba , BOS :
158
170
// do nothing
159
171
default :
160
172
return fmt .Errorf ("cannot disable retries for backend: %s" , backend )
@@ -173,7 +185,7 @@ func (cfg *Config) configureTransport(backend string, rt http.RoundTripper) erro
173
185
cfg .Azure .Transport = rt
174
186
case Swift :
175
187
cfg .Swift .Transport = rt
176
- case Filesystem :
188
+ case Filesystem , Alibaba , BOS :
177
189
// do nothing
178
190
default :
179
191
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
201
213
client , err = swift .NewBucketClient (cfg .Swift , name , logger , instrumentTransport ())
202
214
case Filesystem :
203
215
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 )
204
220
default :
205
221
return nil , ErrUnsupportedStorageBackend
206
222
}
0 commit comments