@@ -18,9 +18,8 @@ import (
18
18
19
19
// Implements Storage interface using AWS S3
20
20
type S3 struct {
21
- Client * storage.Client
22
- Config config.S3Config
23
- supportsChecksumSha256 bool
21
+ Client * storage.Client
22
+ Config config.S3Config
24
23
}
25
24
26
25
// New creates a new AWS S3 client
@@ -32,16 +31,11 @@ func New(config config.S3Config) *S3 {
32
31
client := storage .NewFromConfig (sdkConfig , func (o * storage.Options ) {
33
32
o .UsePathStyle = config .UsePathStyle
34
33
})
35
- s3Client := & S3 {
36
- Config : config ,
37
- Client : client ,
38
- supportsChecksumSha256 : false ,
39
- }
40
-
41
- // Check for checksum support during initialization
42
- s3Client .IsChecksumSha256Supported ()
43
34
44
- return s3Client
35
+ return & S3 {
36
+ Config : config ,
37
+ Client : client ,
38
+ }
45
39
}
46
40
47
41
func (a * S3 ) Get (key string ) ([]byte , error ) {
@@ -110,10 +104,6 @@ func (a *S3) Set(key string, data []byte, ttl int) error {
110
104
Body : bytes .NewReader (data ),
111
105
}
112
106
113
- if a .supportsChecksumSha256 {
114
- input .ChecksumAlgorithm = types .ChecksumAlgorithmSha256
115
- }
116
-
117
107
_ , err := a .Client .PutObject (context .TODO (), input )
118
108
if err != nil {
119
109
return err
@@ -162,32 +152,3 @@ func (a *S3) List(prefix string) ([]string, error) {
162
152
163
153
return keys , nil
164
154
}
165
-
166
- func (a * S3 ) IsChecksumSha256Supported () bool {
167
- // Create a test input with SHA256 checksum algorithm
168
- testInput := & storage.PutObjectInput {
169
- Bucket : & a .Config .Bucket ,
170
- Key : aws .String ("_test_checksum_support" ),
171
- Body : bytes .NewReader ([]byte ("test" )),
172
- ChecksumAlgorithm : types .ChecksumAlgorithmSha256 ,
173
- }
174
-
175
- // Try to put an object with checksum algorithm
176
- _ , err := a .Client .PutObject (context .TODO (), testInput )
177
-
178
- // Clean up the test object regardless of the result
179
- // Ignore any error from deletion as it's just a cleanup operation
180
- deleteInput := & storage.DeleteObjectInput {
181
- Bucket : & a .Config .Bucket ,
182
- Key : aws .String ("_test_checksum_support" ),
183
- }
184
- a .Client .DeleteObject (context .TODO (), deleteInput )
185
-
186
- if err != nil {
187
- a .supportsChecksumSha256 = false
188
- return false
189
- }
190
-
191
- a .supportsChecksumSha256 = true
192
- return true
193
- }
0 commit comments