Skip to content

Commit

Permalink
fix: Integer field changes for aws-sdk-go-v2
Browse files Browse the repository at this point in the history
Signed-off-by: jay-dee7 <[email protected]>
  • Loading branch information
jay-dee7 committed Nov 24, 2023
1 parent 1190cb8 commit f14ed42
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 15 deletions.
12 changes: 6 additions & 6 deletions dfs/filebase/filebase.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,9 @@ func (fb *filebase) UploadPart(
Bucket: &fb.bucket,
ChecksumAlgorithm: s3types.ChecksumAlgorithmSha256,
ChecksumSHA256: aws.String(digest),
ContentLength: contentLength,
ContentLength: &contentLength,
Key: &layerKey,
PartNumber: int32(partNumber),
PartNumber: aws.Int32(int32(partNumber)),
UploadId: &uploadId,
}

Expand All @@ -89,7 +89,7 @@ func (fb *filebase) UploadPart(
return s3types.CompletedPart{
ChecksumSHA256: &digest,
ETag: resp.ETag,
PartNumber: int32(partNumber),
PartNumber: aws.Int32(int32(partNumber)),
}, nil
}

Expand Down Expand Up @@ -163,7 +163,7 @@ func (fb *filebase) Upload(ctx context.Context, namespace, digest string, conten
Body: bytes.NewBuffer(content),
ChecksumAlgorithm: s3types.ChecksumAlgorithmSha256,
ChecksumSHA256: &digest,
ContentLength: int64(len(content)),
ContentLength: aws.Int64(int64(len(content))),
StorageClass: s3types.StorageClassStandard,
}
if fb.env == config.CI {
Expand Down Expand Up @@ -251,7 +251,7 @@ func (fb *filebase) Metadata(identifier string) (*types.ObjectMetadata, error) {
ContentType: *resp.ContentType,
Etag: *resp.ETag,
DFSLink: cid,
ContentLength: int(resp.ContentLength),
ContentLength: int(*resp.ContentLength),
}, nil
}

Expand All @@ -267,7 +267,7 @@ func (fb *filebase) GetUploadProgress(identifier, uploadID string) (*types.Objec

var uploadedSize int64
for _, p := range partsResp.Parts {
uploadedSize += p.Size
uploadedSize += *p.Size
}

return &types.ObjectMetadata{
Expand Down
3 changes: 2 additions & 1 deletion dfs/mock/mockFileSystem.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"os"
"strings"

"github.com/aws/aws-sdk-go-v2/aws"
s3types "github.com/aws/aws-sdk-go-v2/service/s3/types"
"github.com/containerish/OpenRegistry/config"
"github.com/containerish/OpenRegistry/dfs"
Expand Down Expand Up @@ -89,7 +90,7 @@ func (ms *fileBasedMockStorage) UploadPart(
return s3types.CompletedPart{
ChecksumCRC32: &digest,
ChecksumCRC32C: &layerKey,
PartNumber: int32(partNumber),
PartNumber: aws.Int32(int32(partNumber)),
}, nil
}

Expand Down
3 changes: 2 additions & 1 deletion dfs/mock/storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"os"
"strings"

"github.com/aws/aws-sdk-go-v2/aws"
s3types "github.com/aws/aws-sdk-go-v2/service/s3/types"
"github.com/containerish/OpenRegistry/config"
"github.com/containerish/OpenRegistry/dfs"
Expand Down Expand Up @@ -83,7 +84,7 @@ func (ms *memMappedMockStorage) UploadPart(
return s3types.CompletedPart{
ChecksumCRC32: &digest,
ChecksumCRC32C: &layerKey,
PartNumber: int32(partNumber),
PartNumber: aws.Int32(int32(partNumber)),
}, nil
}

Expand Down
12 changes: 6 additions & 6 deletions dfs/storj/storj.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,9 @@ func (sj *storj) UploadPart(
Bucket: &sj.bucket,
ChecksumAlgorithm: s3types.ChecksumAlgorithmSha256,
ChecksumSHA256: aws.String(digest),
ContentLength: contentLength,
ContentLength: &contentLength,
Key: &layerKey,
PartNumber: int32(partNumber),
PartNumber: aws.Int32(int32(partNumber)),
UploadId: &uploadId,
}

Expand All @@ -87,7 +87,7 @@ func (sj *storj) UploadPart(
return s3types.CompletedPart{
ChecksumSHA256: &digest,
ETag: resp.ETag,
PartNumber: int32(partNumber),
PartNumber: aws.Int32(int32(partNumber)),
}, nil
}

Expand Down Expand Up @@ -142,7 +142,7 @@ func (sj *storj) Upload(ctx context.Context, identifier, digest string, content
Body: bytes.NewBuffer(content),
ChecksumAlgorithm: s3types.ChecksumAlgorithmSha256,
ChecksumSHA256: &digest,
ContentLength: int64(len(content)),
ContentLength: aws.Int64(int64(len(content))),
StorageClass: s3types.StorageClassStandard,
}
if sj.env == config.CI {
Expand Down Expand Up @@ -225,7 +225,7 @@ func (sj *storj) Metadata(identifier string) (*types.ObjectMetadata, error) {
ContentType: *resp.ContentType,
Etag: *resp.ETag,
DFSLink: identifier,
ContentLength: int(resp.ContentLength),
ContentLength: int(*resp.ContentLength),
}, nil
}

Expand All @@ -241,7 +241,7 @@ func (sj *storj) GetUploadProgress(identifier, uploadID string) (*types.ObjectMe

var uploadedSize int64
for _, p := range partsResp.Parts {
uploadedSize += p.Size
uploadedSize += *p.Size
}

return &types.ObjectMetadata{
Expand Down
3 changes: 2 additions & 1 deletion dfs/storj/uplink/uplink.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"log"
"time"

"github.com/aws/aws-sdk-go-v2/aws"
s3types "github.com/aws/aws-sdk-go-v2/service/s3/types"
"github.com/containerish/OpenRegistry/config"
"github.com/containerish/OpenRegistry/dfs"
Expand Down Expand Up @@ -100,7 +101,7 @@ func (u *storjUplink) UploadPart(

return s3types.CompletedPart{
ETag: &digest,
PartNumber: int32(partNumber),
PartNumber: aws.Int32(int32(partNumber)),
}, nil
}

Expand Down

0 comments on commit f14ed42

Please sign in to comment.