Skip to content

Commit 0551678

Browse files
fix: revert partially padok-team#588
Signed-off-by: Michael Todorovic <[email protected]>
1 parent 3321cda commit 0551678

File tree

1 file changed

+4
-42
lines changed
  • internal/datastore/storage/s3

1 file changed

+4
-42
lines changed

internal/datastore/storage/s3/s3.go

Lines changed: 4 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,8 @@ import (
1818

1919
// Implements Storage interface using AWS S3
2020
type S3 struct {
21-
Client *storage.Client
22-
Config config.S3Config
23-
supportsChecksumSha256 bool
21+
Client *storage.Client
22+
Config config.S3Config
2423
}
2524

2625
// New creates a new AWS S3 client
@@ -33,14 +32,10 @@ func New(config config.S3Config) *S3 {
3332
o.UsePathStyle = config.UsePathStyle
3433
})
3534
s3Client := &S3{
36-
Config: config,
37-
Client: client,
38-
supportsChecksumSha256: false,
35+
Config: config,
36+
Client: client,
3937
}
4038

41-
// Check for checksum support during initialization
42-
s3Client.IsChecksumSha256Supported()
43-
4439
return s3Client
4540
}
4641

@@ -110,10 +105,6 @@ func (a *S3) Set(key string, data []byte, ttl int) error {
110105
Body: bytes.NewReader(data),
111106
}
112107

113-
if a.supportsChecksumSha256 {
114-
input.ChecksumAlgorithm = types.ChecksumAlgorithmSha256
115-
}
116-
117108
_, err := a.Client.PutObject(context.TODO(), input)
118109
if err != nil {
119110
return err
@@ -162,32 +153,3 @@ func (a *S3) List(prefix string) ([]string, error) {
162153

163154
return keys, nil
164155
}
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

Comments
 (0)