Documentation ¶
Index ¶
- func FindMinMissingInteger(arr []int) int
- func NewUploadStatusMonitor(uploadStatusMap map[string]*FileInfo, orderedFileList *[]string, hidden bool) tea.Model
- type ApiOpts
- type DummyMonitor
- type FileInfo
- type FileOpts
- type IntHeap
- type MultipartOpts
- type TickMsg
- type UploadDB
- type UploadManager
- func (um *UploadManager) AddErr(path string, err error)
- func (um *UploadManager) AddFile(path string)
- func (um *UploadManager) Debugf(format string, args ...interface{})
- func (um *UploadManager) FMultipartPutObject(ctx context.Context, bucket string, key string, filePath string, ...) (err error)
- func (um *UploadManager) FPutObject(absPath string, bucket string, key string, userTags map[string]string)
- func (um *UploadManager) PrintErrs()
- func (um *UploadManager) Run(ctx context.Context, rcd *name.Record, fileOpts *FileOpts) error
- func (um *UploadManager) UploadFileThroughUrl(file string, uploadUrl string) error
- func (um *UploadManager) Wait()
- type UploadStatusEnum
- type UploadStatusMonitor
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FindMinMissingInteger ¶ added in v1.1.0
FindMinMissingInteger finds the minimum missing integer in a sorted array
func NewUploadStatusMonitor ¶
func NewUploadStatusMonitor(uploadStatusMap map[string]*FileInfo, orderedFileList *[]string, hidden bool) tea.Model
NewUploadStatusMonitor is used to create a new upload status monitor, note that uploadStatusMap and orderedFileList are used to maintain the state of the monitor and will change as the underlying map/list changes.
Types ¶
type ApiOpts ¶ added in v1.1.3
type ApiOpts struct { api.SecurityTokenInterface api.FileInterface }
type DummyMonitor ¶ added in v1.1.3
type DummyMonitor struct {
ManualQuit bool
}
func (*DummyMonitor) Init ¶ added in v1.1.3
func (m *DummyMonitor) Init() tea.Cmd
func (*DummyMonitor) Quit ¶ added in v1.1.3
func (m *DummyMonitor) Quit() bool
func (*DummyMonitor) View ¶ added in v1.1.3
func (m *DummyMonitor) View() string
type FileInfo ¶
type FileInfo struct { Path string Size int64 Sha256 string Uploaded int64 Status UploadStatusEnum }
FileInfo contains the path, size and sha256 of a file.
type FileOpts ¶ added in v1.1.3
type MultipartOpts ¶ added in v1.1.0
func (*MultipartOpts) Valid ¶ added in v1.1.0
func (opt *MultipartOpts) Valid() error
type UploadDB ¶ added in v1.1.0
func NewUploadDB ¶ added in v1.1.0
func (*UploadDB) BatchPut ¶ added in v1.1.0
BatchPut puts a batch of key-value pairs into the database.
type UploadManager ¶
type UploadManager struct { Errs map[string]error sync.WaitGroup // contains filtered or unexported fields }
UploadManager is a manager for uploading files through minio client. Note that it's user's responsibility to check the Errs field after Wait() to see if there's any error.
func NewUploadManagerFromConfig ¶ added in v1.1.0
func NewUploadManagerFromConfig(proj *name.Project, timeout time.Duration, hideMonitor bool, apiOpts *ApiOpts, multiOpts *MultipartOpts) (*UploadManager, error)
func (*UploadManager) AddErr ¶
func (um *UploadManager) AddErr(path string, err error)
AddErr adds an error to the manager.
func (*UploadManager) AddFile ¶ added in v1.1.4
func (um *UploadManager) AddFile(path string)
AddFile adds a file to the upload manager.
func (*UploadManager) Debugf ¶ added in v1.1.0
func (um *UploadManager) Debugf(format string, args ...interface{})
func (*UploadManager) FMultipartPutObject ¶
func (*UploadManager) FPutObject ¶
func (um *UploadManager) FPutObject(absPath string, bucket string, key string, userTags map[string]string)
FPutObject uploads a file to a bucket with a key and sha256. If the file size is larger than minPartSize, it will use multipart upload.
func (*UploadManager) PrintErrs ¶ added in v1.1.0
func (um *UploadManager) PrintErrs()
PrintErrs prints all errors.
func (*UploadManager) UploadFileThroughUrl ¶ added in v1.1.0
func (um *UploadManager) UploadFileThroughUrl(file string, uploadUrl string) error
UploadFileThroughUrl uploads a single file to the given uploadUrl. um is the upload manager to use. file is the absolute path of the file to be uploaded. uploadUrl is the pre-signed url to upload the file to.
func (*UploadManager) Wait ¶
func (um *UploadManager) Wait()
Wait waits for all uploads to finish. And wait for status monitor to finish.
type UploadStatusEnum ¶
type UploadStatusEnum int
UploadStatusEnum is used to keep track of the state of a file upload
const ( // Unprocessed is used to indicate that the file has not been processed yet Unprocessed UploadStatusEnum = iota // PreviouslyUploaded is used to indicate that the file has been uploaded before PreviouslyUploaded // UploadInProgress is used to indicate that the file upload is in progress UploadInProgress // UploadCompleted is used to indicate that the file upload has completed UploadCompleted // MultipartCompletionInProgress is used to indicate that the multipart upload completion is in progress MultipartCompletionInProgress // UploadFailed is used to indicate that the file upload has failed UploadFailed )
type UploadStatusMonitor ¶
type UploadStatusMonitor struct { ManualQuit bool // contains filtered or unexported fields }
UploadStatusMonitor is a bubbletea model that is used to monitor the progress of file uploads
func (*UploadStatusMonitor) Init ¶
func (m *UploadStatusMonitor) Init() tea.Cmd
func (*UploadStatusMonitor) Quit ¶ added in v1.1.3
func (m *UploadStatusMonitor) Quit() bool
func (*UploadStatusMonitor) View ¶
func (m *UploadStatusMonitor) View() string