-
Notifications
You must be signed in to change notification settings - Fork 0
/
types.go
39 lines (30 loc) · 1.1 KB
/
types.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package gofs
// DB is the interface for the storage database.
// The database is used to store the status of multipart uploads.
type DB interface {
// CreateUpload creates a new multipart upload.
CreateUpload(key string, uploadID string, totalParts int64) error
// AddPart adds a new part to the multipart upload.
AddPart(key string, partNumber int64, etag string) error
// CompleteUpload completes the multipart upload.
CompleteUpload(key string) error
// AbortUpload aborts the multipart upload.
AbortUpload(key string) error
// GetUploadID returns the upload ID for the given key.
GetUploadID(key string) (string, error)
// GetParts returns the parts for the given key.
GetParts(key string) ([]CompletedPart, error)
// GetStatus returns the status of the given key.
GetStatus(key string) (UploadStatus, error)
}
// CompletedPart represents a part of a multipart upload.
type CompletedPart interface {
PartNumber() int64
ETag() string
}
// UploadStatus represents the status of a multipart upload.
type UploadStatus interface {
IsCompleted() bool
TotalParts() int64
CompletedPartsNum() int64
}