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 appender support #40

Merged
merged 7 commits into from
Apr 28, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
10 changes: 7 additions & 3 deletions storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -522,11 +522,15 @@ func (s *Storage) writeAppend(ctx context.Context, o *Object, r io.Reader, size
return
}

offset = *output.XQSNextAppendPosition
o.SetAppendOffset(offset)
if output.XQSNextAppendPosition != nil {
offset = *output.XQSNextAppendPosition
o.SetAppendOffset(offset)
} else {
err = fmt.Errorf("next append position is empty")
return
}

return offset, nil

}

func (s *Storage) writeMultipart(ctx context.Context, o *Object, r io.Reader, size int64, index int, opt pairStorageWriteMultipart) (n int64, err error) {
Expand Down
5 changes: 3 additions & 2 deletions storager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -315,9 +315,10 @@ func TestStorage_Stat(t *testing.T) {
checkSum, ok := o.GetEtag()
assert.True(t, ok)
assert.Equal(t, "test_etag", checkSum)
storageClass, ok := o.MustGetServiceMetadata()[MetadataStorageClass]
sm := o.MustGetServiceMetadata()
Copy link
Contributor

Choose a reason for hiding this comment

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

We can use GetObjectMetadata here which is generated by go-storage.

serviceMetadata, ok := sm.(ObjectMetadata)
assert.True(t, ok)
assert.Equal(t, StorageClassStandard, storageClass)
assert.Equal(t, StorageClassStandard, serviceMetadata.StorageClass)
}
}
}
Expand Down