Skip to content
This repository has been archived by the owner on Oct 22, 2021. It is now read-only.

Implement appender support #15

Merged
merged 5 commits into from
Apr 25, 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
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ test:
go tool cover -html="coverage.txt" -o "coverage.html"

integration_test:
STORAGE_OSS_INTEGRATION_TEST=on go test -count=1 -race -covermode=atomic -v ./tests
go test -count=1 -race -covermode=atomic -v ./tests

tidy:
go mod tidy
Expand Down
17 changes: 3 additions & 14 deletions storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"fmt"
"io"
"strconv"
"strings"
"time"

"github.com/aliyun/aliyun-oss-go-sdk/oss"
Expand All @@ -24,21 +23,11 @@ func (s *Storage) create(path string, opt pairStorageCreate) (o *Object) {
}

func (s *Storage) createAppend(ctx context.Context, path string, opt pairStorageCreateAppend) (o *Object, err error) {
rp := s.getAbsPath(path)

options := make([]oss.Option, 0)
options = append(options, oss.ContentLength(0))

offset, err := s.bucket.AppendObject(rp, strings.NewReader(""), 0, options...)
if err != nil {
return
}

o = s.newObject(true)
o = s.newObject(false)
Copy link
Collaborator

Choose a reason for hiding this comment

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

We should create this object with true, as there is no more info we cloud provide.

o.Mode = ModeRead | ModeAppend
o.ID = rp
o.ID = s.getAbsPath(path)
o.Path = path
o.SetAppendOffset(offset)
o.SetAppendOffset(0)
return o, nil
}

Expand Down