github.com/mondo192/jfrog-client-go@v1.0.0/utils/io/progress.go (about) 1 package io 2 3 import "io" 4 5 // You may implement this interface to display progress indication of files transfer (upload / download) 6 type ProgressMgr interface { 7 // Initializes a new reader progress indicator for a new file transfer. 8 // Input: 'total' - file size, 'label' - the title of the operation, 'path' - the path of the file being processed. 9 // Output: progress indicator id 10 NewProgressReader(total int64, label, path string) (progress Progress) 11 // Changes progress indicator state. 12 SetProgressState(id int, state string) 13 // Returns the requested progress indicator. 14 GetProgress(id int) (progress Progress) 15 // Aborts a progress indicator. Called on both successful and unsuccessful operations. 16 RemoveProgress(id int) 17 // Quits the whole progress mechanism. 18 Quit() (err error) 19 // Increments the general progress total count by given n. 20 IncGeneralProgressTotalBy(n int64) 21 // Replace the headline progress indicator message with new one. 22 SetHeadlineMsg(msg string) 23 // Terminate the headline progress indicator. 24 ClearHeadlineMsg() 25 // Specific initialization of reader progress indicators. 26 // Should be called before the first call to NewProgressReader. 27 InitProgressReaders() 28 } 29 30 type Progress interface { 31 // Used for updating the progress indicator progress. 32 ActionWithProgress(reader io.Reader) (results io.Reader) 33 // Aborts a progress indicator. Called on both successful and unsuccessful operations 34 Abort() 35 // Returns the Progress ID 36 GetId() (Id int) 37 }