Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add StorageID to ObjectPointer #8522

Merged
merged 34 commits into from
Jan 22, 2025
Merged
Show file tree
Hide file tree
Changes from 33 commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
c1d3587
Add StorageID to Repository entity
itaigilo Jan 15, 2025
4e51981
Bug fixes
itaigilo Jan 15, 2025
30b3849
Remove API changes
itaigilo Jan 15, 2025
b45d428
Add StorageID to Repo endpoints
itaigilo Jan 15, 2025
02e4404
Almost empty commit
itaigilo Jan 15, 2025
74e2202
Revert almso empty commit
itaigilo Jan 15, 2025
222b126
Remove from API
itaigilo Jan 15, 2025
32b273f
Merge branch 'feature/add-storage-id-to-repo' into feature/add-storag…
itaigilo Jan 15, 2025
65974c0
Add param to Creation
itaigilo Jan 15, 2025
af9476e
Fix PR comments
itaigilo Jan 16, 2025
4e8e423
Fix tests
itaigilo Jan 16, 2025
5eebff2
Merge branch 'feature/add-storage-id-to-repo' into feature/add-storag…
itaigilo Jan 16, 2025
478d498
Add basic unit-tests
itaigilo Jan 16, 2025
13a771e
Fix param
itaigilo Jan 16, 2025
989a388
Update tests
itaigilo Jan 17, 2025
298bc0d
Allow only empty StorageID
itaigilo Jan 17, 2025
299c292
Revert "Allow only empty StorageID"
itaigilo Jan 17, 2025
b81eff3
Revert "Revert "Allow only empty StorageID""
itaigilo Jan 17, 2025
acb70e8
Change validation
itaigilo Jan 17, 2025
3dbd9d1
Remove StorageID in a test
itaigilo Jan 17, 2025
aa8180a
Merge branch 'feature/add-storage-id-to-repo' into feature/add-storag…
itaigilo Jan 17, 2025
cecce8d
Update tests
itaigilo Jan 17, 2025
1ced59b
Merge branch 'master' into feature/add-storage-id-to-repo
itaigilo Jan 17, 2025
858812c
Merge branch 'feature/add-storage-id-to-repo' into feature/add-storag…
itaigilo Jan 17, 2025
df0b2af
Add StorageID to ObjectPointer inits
itaigilo Jan 20, 2025
920cd0f
Add StorageID to WriteBlob
itaigilo Jan 20, 2025
7386b7e
Add StorageID to uploadFile
itaigilo Jan 20, 2025
6f8d83a
Add log fields
itaigilo Jan 20, 2025
b361b34
Add comments
itaigilo Jan 20, 2025
428f57a
Merge branch 'master' into feature/add-storage-id-to-obj-ptr-part-1
itaigilo Jan 20, 2025
3221718
Merge branch 'master' into feature/add-storage-id-to-obj-ptr-part-1
itaigilo Jan 21, 2025
a66dba0
Remove go.work.sum
itaigilo Jan 21, 2025
789033d
Fix PR comments
itaigilo Jan 22, 2025
b0a76ba
Merge branch 'master' into feature/add-storage-id-to-obj-ptr-part-1
itaigilo Jan 22, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 31 additions & 4 deletions pkg/api/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@ func (c *Controller) CreatePresignMultipartUpload(w http.ResponseWriter, r *http

// create a new multipart upload
mpuResp, err := c.BlockAdapter.CreateMultiPartUpload(ctx, block.ObjectPointer{
StorageID: repo.StorageID,
StorageNamespace: repo.StorageNamespace,
IdentifierType: block.IdentifierTypeRelative,
Identifier: address,
Expand All @@ -229,6 +230,7 @@ func (c *Controller) CreatePresignMultipartUpload(w http.ResponseWriter, r *http
for i := 0; i < swag.IntValue(params.Parts); i++ {
// generate a pre-signed PUT url for the given request
preSignedURL, err := c.BlockAdapter.GetPresignUploadPartURL(ctx, block.ObjectPointer{
StorageID: repo.StorageID,
StorageNamespace: repo.StorageNamespace,
Identifier: address,
IdentifierType: block.IdentifierTypeRelative,
Expand Down Expand Up @@ -300,6 +302,7 @@ func (c *Controller) AbortPresignMultipartUpload(w http.ResponseWriter, r *http.
}

if err := c.BlockAdapter.AbortMultiPartUpload(ctx, block.ObjectPointer{
StorageID: repo.StorageID,
StorageNamespace: repo.StorageNamespace,
IdentifierType: block.IdentifierTypeRelative,
Identifier: physicalAddress,
Expand Down Expand Up @@ -372,6 +375,7 @@ func (c *Controller) CompletePresignMultipartUpload(w http.ResponseWriter, r *ht
}

mpuResp, err := c.BlockAdapter.CompleteMultiPartUpload(ctx, block.ObjectPointer{
StorageID: repo.StorageID,
StorageNamespace: repo.StorageNamespace,
IdentifierType: block.IdentifierTypeRelative,
Identifier: physicalAddress,
Expand Down Expand Up @@ -702,6 +706,7 @@ func (c *Controller) GetPhysicalAddress(w http.ResponseWriter, r *http.Request,
if swag.BoolValue(params.Presign) {
// generate a pre-signed PUT url for the given request
preSignedURL, expiry, err := c.BlockAdapter.GetPreSignedURL(ctx, block.ObjectPointer{
StorageID: repo.StorageID,
StorageNamespace: repo.StorageNamespace,
Identifier: address,
IdentifierType: block.IdentifierTypeRelative,
Expand Down Expand Up @@ -2091,6 +2096,7 @@ func (c *Controller) ensureStorageNamespace(ctx context.Context, storageNamespac
// this serves two purposes, first, we maintain safety check for older lakeFS version.
// second, in scenarios where lakeFS shouldn't have access to the root namespace (i.e pre-sign URL only).
if c.Config.Graveler.EnsureReadableRootNamespace {
// TODO (gilo): ObjectPointer init - add StorageID here
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why was this change delayed? It's going in a different PR?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To reduce the scope of this one, and making it more reviewable (yet complete enough to be able to merge it in the end).

rootObj := block.ObjectPointer{
StorageNamespace: storageNamespace,
IdentifierType: block.IdentifierTypeRelative,
Expand All @@ -2108,6 +2114,7 @@ func (c *Controller) ensureStorageNamespace(ctx context.Context, storageNamespac

// check if the dummy file exists
obj := block.ObjectPointer{
// TODO (gilo): ObjectPointer init - add StorageID here
StorageNamespace: storageNamespace,
IdentifierType: block.IdentifierTypeRelative,
Identifier: dummyKey,
Expand Down Expand Up @@ -2558,6 +2565,7 @@ func (c *Controller) GetRunHookOutput(w http.ResponseWriter, r *http.Request, re

logPath := taskResult.LogPath()
reader, err := c.BlockAdapter.Get(ctx, block.ObjectPointer{
StorageID: repo.StorageID,
StorageNamespace: repo.StorageNamespace,
IdentifierType: block.IdentifierTypeRelative,
Identifier: logPath,
Expand Down Expand Up @@ -3205,13 +3213,19 @@ func (c *Controller) UploadObject(w http.ResponseWriter, r *http.Request, reposi
writeError(w, r, http.StatusInternalServerError, err)
return
}
opts := block.PutOpts{StorageClass: params.StorageClass}

var blob *upload.Blob
if mediaType != "multipart/form-data" {
// handle non-multipart, direct content upload
address := c.PathProvider.NewPath()
blob, err = upload.WriteBlob(ctx, c.BlockAdapter, repo.StorageNamespace, address, r.Body, r.ContentLength,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this code style change indicate a change in our best practices?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a good question. I don't think we have a code style guide for go,
And the formatter didn't seem to care.
These lines became too long.

block.PutOpts{StorageClass: params.StorageClass})
objectPointer := block.ObjectPointer{
StorageID: repo.StorageID,
StorageNamespace: repo.StorageNamespace,
IdentifierType: block.IdentifierTypeRelative,
Identifier: address,
}
blob, err = upload.WriteBlob(ctx, c.BlockAdapter, objectPointer, r.Body, r.ContentLength, opts)
if err != nil {
writeError(w, r, http.StatusInternalServerError, err)
return
Expand Down Expand Up @@ -3239,8 +3253,13 @@ func (c *Controller) UploadObject(w http.ResponseWriter, r *http.Request, reposi
partName := part.FormName()
if partName == "content" {
// upload the first "content" and exit the loop
address := c.PathProvider.NewPath()
blob, err = upload.WriteBlob(ctx, c.BlockAdapter, repo.StorageNamespace, address, part, -1, block.PutOpts{StorageClass: params.StorageClass})
objectPointer := block.ObjectPointer{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉

StorageID: repo.StorageID,
StorageNamespace: repo.StorageNamespace,
IdentifierType: block.IdentifierTypeRelative,
Identifier: c.PathProvider.NewPath(),
}
blob, err = upload.WriteBlob(ctx, c.BlockAdapter, objectPointer, part, -1, opts)
if err != nil {
_ = part.Close()
writeError(w, r, http.StatusInternalServerError, err)
Expand Down Expand Up @@ -3625,6 +3644,7 @@ func (c *Controller) PrepareGarbageCollectionCommits(w http.ResponseWriter, r *h
if c.handleAPIError(ctx, w, r, err) {
return
}
// TODO (gilo): ObjectPointer init - add StorageID here
presignedURL, _, err := c.BlockAdapter.GetPreSignedURL(ctx, block.ObjectPointer{
Identifier: gcRunMetadata.CommitsCSVLocation,
IdentifierType: block.IdentifierTypeFull,
Expand Down Expand Up @@ -3855,6 +3875,7 @@ func (c *Controller) DumpRefs(w http.ResponseWriter, r *http.Request, repository
return
}
_, err = c.BlockAdapter.Put(ctx, block.ObjectPointer{
StorageID: repo.StorageID,
StorageNamespace: repo.StorageNamespace,
IdentifierType: block.IdentifierTypeRelative,
Identifier: fmt.Sprintf("%s/refs_manifest.json", c.Config.Committed.BlockStoragePrefix),
Expand Down Expand Up @@ -4195,6 +4216,7 @@ func writeSymlink(ctx context.Context, repo *catalog.Repository, branch, path st
address := fmt.Sprintf("%s/%s/%s/%s/symlink.txt", lakeFSPrefix, repo.Name, branch, path)
data := strings.Join(addresses, "\n")
_, err := adapter.Put(ctx, block.ObjectPointer{
StorageID: repo.StorageID,
StorageNamespace: repo.StorageNamespace,
IdentifierType: block.IdentifierTypeRelative,
Identifier: address,
Expand Down Expand Up @@ -4402,6 +4424,7 @@ func (c *Controller) GetMetadataObject(w http.ResponseWriter, r *http.Request, r

// if pre-sign, return a redirect
pointer := block.ObjectPointer{
StorageID: repo.StorageID,
StorageNamespace: repo.StorageNamespace,
IdentifierType: block.IdentifierTypeRelative,
Identifier: objPath,
Expand Down Expand Up @@ -4481,6 +4504,7 @@ func (c *Controller) GetObject(w http.ResponseWriter, r *http.Request, repositor

// if pre-sign, return a redirect
pointer := block.ObjectPointer{
StorageID: repo.StorageID,
StorageNamespace: repo.StorageNamespace,
IdentifierType: entry.AddressType.ToIdentifierType(),
Identifier: entry.PhysicalAddress,
Expand Down Expand Up @@ -4627,6 +4651,7 @@ func (c *Controller) ListObjects(w http.ResponseWriter, r *http.Request, reposit
if authResponse.Allowed {
var expiry time.Time
objStat.PhysicalAddress, expiry, err = c.BlockAdapter.GetPreSignedURL(ctx, block.ObjectPointer{
StorageID: repo.StorageID,
StorageNamespace: repo.StorageNamespace,
IdentifierType: entry.AddressType.ToIdentifierType(),
Identifier: entry.PhysicalAddress,
Expand Down Expand Up @@ -4709,6 +4734,7 @@ func (c *Controller) StatObject(w http.ResponseWriter, r *http.Request, reposito
} else if swag.BoolValue(params.Presign) {
// need to pre-sign the physical address
preSignedURL, expiry, err := c.BlockAdapter.GetPreSignedURL(ctx, block.ObjectPointer{
StorageID: repo.StorageID,
StorageNamespace: repo.StorageNamespace,
IdentifierType: entry.AddressType.ToIdentifierType(),
Identifier: entry.PhysicalAddress,
Expand Down Expand Up @@ -4770,6 +4796,7 @@ func (c *Controller) GetUnderlyingProperties(w http.ResponseWriter, r *http.Requ

// read object properties from underlying storage
properties, err := c.BlockAdapter.GetProperties(ctx, block.ObjectPointer{
StorageID: repo.StorageID,
StorageNamespace: repo.StorageNamespace,
IdentifierType: entry.AddressType.ToIdentifierType(),
Identifier: entry.PhysicalAddress,
Expand Down
18 changes: 14 additions & 4 deletions pkg/api/controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2549,8 +2549,13 @@ func TestController_ObjectsHeadObjectHandler(t *testing.T) {

buf := new(bytes.Buffer)
buf.WriteString("this is file content made up of bytes")
address := upload.DefaultPathProvider.NewPath()
blob, err := upload.WriteBlob(context.Background(), deps.blocks, onBlock(deps, "ns1"), address, buf, 37, block.PutOpts{StorageClass: &expensiveString})
objectPointer := block.ObjectPointer{
StorageID: "",
StorageNamespace: onBlock(deps, "ns1"),
IdentifierType: block.IdentifierTypeRelative,
Identifier: upload.DefaultPathProvider.NewPath(),
}
blob, err := upload.WriteBlob(context.Background(), deps.blocks, objectPointer, buf, 37, block.PutOpts{StorageClass: &expensiveString})
if err != nil {
t.Fatal(err)
}
Expand Down Expand Up @@ -2625,8 +2630,13 @@ func TestController_ObjectsGetObjectHandler(t *testing.T) {

buf := new(bytes.Buffer)
buf.WriteString("this is file content made up of bytes")
address := upload.DefaultPathProvider.NewPath()
blob, err := upload.WriteBlob(context.Background(), deps.blocks, onBlock(deps, "ns1"), address, buf, 37, block.PutOpts{StorageClass: &expensiveString})
objectPointer := block.ObjectPointer{
StorageID: "",
StorageNamespace: onBlock(deps, "ns1"),
IdentifierType: block.IdentifierTypeRelative,
Identifier: upload.DefaultPathProvider.NewPath(),
}
blob, err := upload.WriteBlob(context.Background(), deps.blocks, objectPointer, buf, 37, block.PutOpts{StorageClass: &expensiveString})
if err != nil {
t.Fatal(err)
}
Expand Down
1 change: 1 addition & 0 deletions pkg/block/adapter.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ const DefaultPreSignExpiryDuration = 15 * time.Minute
// ObjectPointer is a unique identifier of an object in the object
// store: the store is a 1:1 mapping between pointers and objects.
type ObjectPointer struct {
StorageID string
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Documentation: This is such an important core class class, but there is no explanation what sort of values these fields are ment to take. Is "S3" a valid storage ID? Or maybe a URL is expected like "https://bucketname.s3.amazonaws.com"? I have no idea when reading this code?

Same goes for the other two fields

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is out of scope for this PR - we should however do this for the config part and document that well.
@itaigilo This is another thing we need to bring up with product

StorageNamespace string
Identifier string

Expand Down
1 change: 1 addition & 0 deletions pkg/block/azure/adapter.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ func ResolveBlobURLInfoFromURL(pathURL *url.URL) (BlobURLInfo, error) {

func resolveBlobURLInfo(obj block.ObjectPointer) (BlobURLInfo, error) {
key := obj.Identifier
// we're in the context of a specific storage here, so there's no need for StorageID.
defaultNamespace := obj.StorageNamespace
var qk BlobURLInfo
// check if the key is fully qualified
Expand Down
4 changes: 4 additions & 0 deletions pkg/block/blocktest/adapter.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ func testAdapterGetRange(t *testing.T, adapter block.Adapter, storageNamespace s
part1 := "this is the first part "
part2 := "this is the last part"
_, err := adapter.Put(ctx, block.ObjectPointer{
StorageID: "",
StorageNamespace: storageNamespace,
Identifier: "test_file",
IdentifierType: block.IdentifierTypeRelative,
Expand All @@ -63,6 +64,7 @@ func testAdapterGetRange(t *testing.T, adapter block.Adapter, storageNamespace s
for _, tt := range cases {
t.Run(tt.name, func(t *testing.T) {
reader, err := adapter.GetRange(ctx, block.ObjectPointer{
StorageID: "",
StorageNamespace: storageNamespace,
Identifier: "test_file",
IdentifierType: block.IdentifierTypeRelative,
Expand All @@ -89,6 +91,7 @@ func testAdapterWalker(t *testing.T, adapter block.Adapter, storageNamespace str
for i := 0; i < filesAndFolders; i++ {
for j := 0; j < filesAndFolders; j++ {
_, err := adapter.Put(ctx, block.ObjectPointer{
StorageID: "",
StorageNamespace: storageNamespace,
Identifier: fmt.Sprintf("%s/folder_%d/test_file_%d", testPrefix, filesAndFolders-i-1, filesAndFolders-j-1),
IdentifierType: block.IdentifierTypeRelative,
Expand All @@ -98,6 +101,7 @@ func testAdapterWalker(t *testing.T, adapter block.Adapter, storageNamespace str
}

_, err := adapter.Put(ctx, block.ObjectPointer{
StorageID: "",
StorageNamespace: storageNamespace,
Identifier: fmt.Sprintf("%s/folder_0.txt", testPrefix),
IdentifierType: block.IdentifierTypeRelative,
Expand Down
8 changes: 8 additions & 0 deletions pkg/block/blocktest/basic_suite.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ func testAdapterPutGet(t *testing.T, adapter block.Adapter, storageNamespace, ex
for _, c := range cases {
t.Run(c.name, func(t *testing.T) {
obj := block.ObjectPointer{
StorageID: "",
StorageNamespace: storageNamespace,
Identifier: c.path,
IdentifierType: c.identifierType,
Expand All @@ -64,11 +65,13 @@ func testAdapterCopy(t *testing.T, adapter block.Adapter, storageNamespace strin
ctx := context.Background()
contents := "foo bar baz quux"
src := block.ObjectPointer{
StorageID: "",
StorageNamespace: storageNamespace,
Identifier: "src",
IdentifierType: block.IdentifierTypeRelative,
}
dst := block.ObjectPointer{
StorageID: "",
StorageNamespace: storageNamespace,
Identifier: "export/to/dst",
IdentifierType: block.IdentifierTypeRelative,
Expand Down Expand Up @@ -130,6 +133,7 @@ func testAdapterRemove(t *testing.T, adapter block.Adapter, storageNamespace str
envObjects = append(envObjects, tt.path)
for _, p := range envObjects {
obj := block.ObjectPointer{
StorageID: "",
StorageNamespace: storageNamespace,
Identifier: tt.name + "/" + p,
IdentifierType: block.IdentifierTypeRelative,
Expand All @@ -140,6 +144,7 @@ func testAdapterRemove(t *testing.T, adapter block.Adapter, storageNamespace str

// test Remove
obj := block.ObjectPointer{
StorageID: "",
StorageNamespace: storageNamespace,
Identifier: tt.name + "/" + tt.path,
IdentifierType: block.IdentifierTypeRelative,
Expand All @@ -165,13 +170,15 @@ func testAdapterExists(t *testing.T, adapter block.Adapter, storageNamespace str
const contents = "exists"
ctx := context.Background()
_, err := adapter.Put(ctx, block.ObjectPointer{
StorageID: "",
StorageNamespace: storageNamespace,
Identifier: contents,
IdentifierType: block.IdentifierTypeRelative,
}, int64(len(contents)), strings.NewReader(contents), block.PutOpts{})
require.NoError(t, err)

_, err = adapter.Put(ctx, block.ObjectPointer{
StorageID: "",
StorageNamespace: storageNamespace,
Identifier: "nested/and/" + contents,
IdentifierType: block.IdentifierTypeRelative,
Expand All @@ -192,6 +199,7 @@ func testAdapterExists(t *testing.T, adapter block.Adapter, storageNamespace str
for _, tt := range cases {
t.Run(tt.name, func(t *testing.T) {
ok, err := adapter.Exists(ctx, block.ObjectPointer{
StorageID: "",
StorageNamespace: storageNamespace,
Identifier: tt.path,
IdentifierType: block.IdentifierTypeRelative,
Expand Down
3 changes: 3 additions & 0 deletions pkg/block/blocktest/multipart_suite.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ func testAdapterMultipartUpload(t *testing.T, adapter block.Adapter, storageName
t.Run(c.name, func(t *testing.T) {
blockstoreType := adapter.BlockstoreType()
obj := block.ObjectPointer{
StorageID: "",
StorageNamespace: storageNamespace,
Identifier: c.path,
IdentifierType: block.IdentifierTypeRelative,
Expand Down Expand Up @@ -296,12 +297,14 @@ func requireEqualBigByteSlice(t *testing.T, exp, actual []byte) {

func objPointers(storageNamespace string) (block.ObjectPointer, block.ObjectPointer) {
var obj = block.ObjectPointer{
StorageID: "",
StorageNamespace: storageNamespace,
Identifier: "abc",
IdentifierType: block.IdentifierTypeRelative,
}

var objCopy = block.ObjectPointer{
StorageID: "",
StorageNamespace: storageNamespace,
Identifier: "abcCopy",
IdentifierType: block.IdentifierTypeRelative,
Expand Down
23 changes: 20 additions & 3 deletions pkg/block/local/adapter.go
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,12 @@ func (l *Adapter) UploadCopyPart(ctx context.Context, sourceObj, destinationObj
}
md5Read := block.NewHashingReader(r, block.HashFunctionMD5)
fName := uploadID + fmt.Sprintf("-%05d", partNumber)
_, err = l.Put(ctx, block.ObjectPointer{StorageNamespace: destinationObj.StorageNamespace, Identifier: fName}, -1, md5Read, block.PutOpts{})
objectPointer := block.ObjectPointer{
StorageID: destinationObj.StorageID,
StorageNamespace: destinationObj.StorageNamespace,
Identifier: fName,
}
_, err = l.Put(ctx, objectPointer, -1, md5Read, block.PutOpts{})
if err != nil {
return nil, fmt.Errorf("copy put: %w", err)
}
Expand All @@ -266,7 +271,12 @@ func (l *Adapter) UploadCopyPartRange(ctx context.Context, sourceObj, destinatio
}
md5Read := block.NewHashingReader(r, block.HashFunctionMD5)
fName := uploadID + fmt.Sprintf("-%05d", partNumber)
_, err = l.Put(ctx, block.ObjectPointer{StorageNamespace: destinationObj.StorageNamespace, Identifier: fName}, -1, md5Read, block.PutOpts{})
objectPointer := block.ObjectPointer{
StorageID: destinationObj.StorageID,
StorageNamespace: destinationObj.StorageNamespace,
Identifier: fName,
}
_, err = l.Put(ctx, objectPointer, -1, md5Read, block.PutOpts{})
if err != nil {
return nil, fmt.Errorf("copy range put: %w", err)
}
Expand Down Expand Up @@ -398,7 +408,12 @@ func (l *Adapter) UploadPart(ctx context.Context, obj block.ObjectPointer, _ int
}
md5Read := block.NewHashingReader(reader, block.HashFunctionMD5)
fName := uploadID + fmt.Sprintf("-%05d", partNumber)
_, err := l.Put(ctx, block.ObjectPointer{StorageNamespace: obj.StorageNamespace, Identifier: fName}, -1, md5Read, block.PutOpts{})
objectPointer := block.ObjectPointer{
StorageID: obj.StorageID,
StorageNamespace: obj.StorageNamespace,
Identifier: fName,
}
_, err := l.Put(ctx, objectPointer, -1, md5Read, block.PutOpts{})
etag := hex.EncodeToString(md5Read.Md5.Sum(nil))
return &block.UploadPartResponse{
ETag: etag,
Expand Down Expand Up @@ -505,6 +520,7 @@ func (l *Adapter) removePartFiles(files []string) error {

func (l *Adapter) getPartFiles(uploadID string, obj block.ObjectPointer) ([]string, error) {
newObj := block.ObjectPointer{
StorageID: obj.StorageID,
StorageNamespace: obj.StorageNamespace,
Identifier: uploadID,
}
Expand Down Expand Up @@ -544,6 +560,7 @@ func (l *Adapter) ResolveNamespace(storageNamespace, key string, identifierType
}

// Check if path allowed and return error if path is not allowed
// TODO (gilo): ObjectPointer init - add StorageID here
_, err = l.extractParamsFromObj(block.ObjectPointer{
StorageNamespace: storageNamespace,
Identifier: key,
Expand Down
Loading
Loading