Skip to content

Commit 76f66a9

Browse files
committed
Update documation and expose remaing bytes in chunk upload
1 parent 2f456f8 commit 76f66a9

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
lines changed

README.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,11 +109,9 @@ Examples
109109

110110
Full documentation
111111
==================
112-
Generate document locally
112+
You can read the documentation at https://egnyte.github.io/egnyte-go-sdk/ and https://pkg.go.dev/github.com/egnyte/egnyte-go-sdk
113+
113114

114-
```
115-
godoc -http=:6060 & open http://localhost:6060/pkg/github.com/egnyte/egnyte-go-sdk/egnyte
116-
```
117115

118116
Command line
119117
============

egnyte/chunk_upload.go

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,20 @@ type ChunkUploadInfo struct {
2020
lastChunk []byte
2121
}
2222

23-
// Init chunk for a given file
2423
func (c *ChunkUploadInfo) Init(data io.Reader, size int64, chunkSize int64) {
2524
c.checkSumMap = make(map[int]string)
2625
c.data = data
2726
c.remainingBytes = size
2827
c.chunkSize = chunkSize
2928
c.chunkNum = 0
3029
c.lastChunk = nil
30+
31+
}
32+
33+
func (c *ChunkUploadInfo) GetRemainingBytes() int64 {
34+
c.dataMutex.Lock()
35+
defer c.dataMutex.Unlock()
36+
return c.remainingBytes
3137
}
3238

3339
// GetChunk returns chunk
@@ -57,6 +63,8 @@ func (c *ChunkUploadInfo) GetChunk() ([]byte, int64, int, error) {
5763
}
5864

5965
func (c *ChunkUploadInfo) GetLastChunk() ([]byte, int) {
66+
c.dataMutex.Lock()
67+
defer c.dataMutex.Unlock()
6068
return c.lastChunk, c.chunkNum
6169
}
6270

@@ -66,8 +74,8 @@ func (c *ChunkUploadInfo) SetChunkCheckSum(chunkNum int, csum string) {
6674
c.checkSumMap[chunkNum] = csum
6775
}
6876

69-
// GetResultChecksum return final check sum of all chunks
70-
func (c *ChunkUploadInfo) GetResultChecksum() string {
77+
// GetResultCsum return final check sum of all chunks
78+
func (c *ChunkUploadInfo) GetResultCsum() string {
7179
c.resultMutex.Lock()
7280
defer c.resultMutex.Unlock()
7381
res := ""

0 commit comments

Comments
 (0)