uploader

package
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2025 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CachePartETag added in v1.4.0

type CachePartETag struct {
	// Etag ETag
	Etag string `json:"etag"`

	// Part Part index
	Part     int32 `json:"part"`
	PartSize int64 `json:"part_size"`
}

CachePartETag Part index and ETag

type CacheUploadInstruction added in v1.4.0

type CacheUploadInstruction struct {
	// Method HTTP method
	Method string  `json:"method"`
	Offset *Offset `json:"offset,omitempty"`

	// Url URL
	Url string `json:"url"`
}

CacheUploadInstruction defines model for CacheUploadInstruction.

type Offset added in v1.4.0

type Offset struct {
	// End End position of the part
	End int64 `json:"end"`

	// Part Part number
	Part int32 `json:"part"`

	// Start Start position of the part
	Start int64 `json:"start"`
}

Offset defines model for Offset.

type Uploader

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

Uploader uses go routines to upload files in parallel with a limit of 20 concurrent uploads. It is provided a list of URLs to upload and a channel to receive the results. The results are sent to the channel as a map of URL to error. If an error occurs, the error is sent to the channel and the upload is stopped. The uploader will continue to upload files until the channel is closed. The uploader will return when all uploads are complete or when an error occurs.

func NewUploader

func NewUploader(ctx context.Context, filePath string, uploadInstructs []CacheUploadInstruction, limit int) *Uploader

func (*Uploader) Upload

func (u *Uploader) Upload(ctx context.Context) ([]CachePartETag, error)

Jump to

Keyboard shortcuts

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