forked from jfrog/jfrog-client-go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
progress.go
39 lines (36 loc) · 1.51 KB
/
progress.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 io
import "io"
// You may implement this interface to display progress indication of files transfer (upload / download)
type ProgressMgr interface {
// Initializes a new reader progress indicator for a new file transfer.
// Input: 'total' - file size, 'label' - the title of the operation, 'path' - the path of the file being processed.
// Output: progress indicator id
NewProgressReader(total int64, label, path string) (progress Progress)
// Changes progress indicator state.
SetProgressState(id int, state string)
// Returns the requested progress indicator.
GetProgress(id int) (progress Progress)
// Aborts a progress indicator. Called on both successful and unsuccessful operations.
RemoveProgress(id int)
// Increments the general progress by 1
IncrementGeneralProgress()
// Quits the whole progress mechanism.
Quit() (err error)
// Increments the general progress total count by given n.
IncGeneralProgressTotalBy(n int64)
// Replace the headline progress indicator message with new one.
SetHeadlineMsg(msg string)
// Terminate the headline progress indicator.
ClearHeadlineMsg()
// Specific initialization of reader progress indicators.
// Should be called before the first call to NewProgressReader.
InitProgressReaders()
}
type Progress interface {
// Used for updating the progress indicator progress.
ActionWithProgress(reader io.Reader) (results io.Reader)
// Aborts a progress indicator. Called on both successful and unsuccessful operations
Abort()
// Returns the Progress ID
GetId() (Id int)
}