upload_utils

package
v1.1.5-rc4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 21, 2024 License: Apache-2.0 Imports: 33 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FindMinMissingInteger added in v1.1.0

func FindMinMissingInteger(arr []int) int

FindMinMissingInteger finds the minimum missing integer in a sorted array

Types

type ApiOpts added in v1.1.3

type ApiOpts struct {
	api.SecurityTokenInterface
	api.FileInterface
}

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 FileOpts struct {
	Path string

	Recursive     bool
	IncludeHidden bool

	// Additional mapping from file path to oss path
	AdditionalUploads map[string]string
	// contains filtered or unexported fields
}

func (*FileOpts) Valid added in v1.1.3

func (opt *FileOpts) Valid() error

type IncUploadedMsg

type IncUploadedMsg struct {
	Path        string
	UploadedInc int64
}

IncUploadedMsg is used to send incremental uploaded size to the progress update goroutine

type IntHeap added in v1.1.0

type IntHeap []int

An IntHeap is a min-heap of ints.

func NewHeap added in v1.1.0

func NewHeap(s []int) *IntHeap

func (IntHeap) Len added in v1.1.0

func (h IntHeap) Len() int

func (IntHeap) Less added in v1.1.0

func (h IntHeap) Less(i, j int) bool

func (*IntHeap) Peek added in v1.1.0

func (h *IntHeap) Peek() int

func (*IntHeap) Pop added in v1.1.0

func (h *IntHeap) Pop() any

func (*IntHeap) Push added in v1.1.0

func (h *IntHeap) Push(x any)

func (*IntHeap) Remove added in v1.1.0

func (h *IntHeap) Remove(x any)

func (IntHeap) Swap added in v1.1.0

func (h IntHeap) Swap(i, j int)

type MultipartCheckpointInfo

type MultipartCheckpointInfo struct {
	UploadId     string               `json:"upload_id"`
	UploadedSize int64                `json:"uploaded_size"`
	Parts        []minio.CompletePart `json:"parts"`
}

MultipartCheckpointInfo contains the information needed to resume a multipart upload.

type TickMsg added in v1.1.4

type TickMsg time.Time

TickMsg is a message that is sent to the update function every 0.5 second.

type UploadDB added in v1.1.0

type UploadDB struct {
	*bolt.DB
}

func NewUploadDB added in v1.1.0

func NewUploadDB(filename string, recordId string, hash string, partSize uint64) (*UploadDB, error)

func (*UploadDB) Delete added in v1.1.0

func (db *UploadDB) Delete() error

Delete removes the database file from the filesystem.

func (*UploadDB) Get added in v1.1.0

func (db *UploadDB) Get(key string, objectPtr interface{}) error

Get retrieves the value of a key from the database. if the key does not exist, it returns nil.

func (*UploadDB) Reset added in v1.1.1

func (db *UploadDB) Reset() error

Reset removes all the keys from the database multipart_uploads bucket.

type UploadInfo

type UploadInfo struct {
	Path       string
	Bucket     string
	Key        string
	Tags       map[string]string
	FileReader *os.File

	// Upload result infos
	Result minio.ObjectPart
	Err    error

	// Multipart info
	UploadId        string
	PartId          int
	TotalPartsCount int
	ReadOffset      int64
	ReadSize        int64
	DB              *UploadDB
}

UploadInfo contains the information needed to upload a file or a file part (multipart upload).

type UploadManager

type UploadManager struct {
	// contains filtered or unexported fields
}

UploadManager is a manager for uploading files through minio client.

func NewUploadManagerFromConfig added in v1.1.0

func NewUploadManagerFromConfig(proj *name.Project, timeout time.Duration, apiOpts *ApiOpts, opts *UploadManagerOpts) (*UploadManager, error)

func (*UploadManager) Init

func (um *UploadManager) Init() tea.Cmd

func (*UploadManager) Run added in v1.1.3

func (um *UploadManager) Run(ctx context.Context, rcd *name.Record, fileOpts *FileOpts) error

Run is used to start the upload process.

func (*UploadManager) Update

func (um *UploadManager) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (*UploadManager) View

func (um *UploadManager) View() string

type UploadManagerOpts

type UploadManagerOpts struct {
	Threads  int
	PartSize string
	// contains filtered or unexported fields
}

func (*UploadManagerOpts) Valid

func (opt *UploadManagerOpts) Valid() error

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

	// CalculatingSha256 is used to indicate that the file sha256 is being calculated
	CalculatingSha256

	// PreviouslyUploaded is used to indicate that the file has been uploaded before
	PreviouslyUploaded

	// WaitingForUpload is used to indicate that the file is waiting to be uploaded
	WaitingForUpload

	// 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
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL