upload

package
v0.0.0-...-1858810 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2023 License: BSD-3-Clause Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Chunk

type Chunk struct {
	Bytes []byte
}

type CreateParams

type CreateParams struct {
	TotalSize   int
	ProjectName string
	Timeout     time.Duration
}

type InitUploadParams

type InitUploadParams struct {
	ID          string
	Timeout     time.Duration
	Log         *logrus.Logger
	ProjectName string
	TotalSize   int
	FS          *file_system.FS
}

func NewInitUploadParams

func NewInitUploadParams(id, projectName string) *InitUploadParams

func (*InitUploadParams) WithFS

func (*InitUploadParams) WithLogger

func (p *InitUploadParams) WithLogger(log *logrus.Logger) *InitUploadParams

func (*InitUploadParams) WithTimeout

func (p *InitUploadParams) WithTimeout(timeout time.Duration) *InitUploadParams

func (*InitUploadParams) WithTotalSize

func (p *InitUploadParams) WithTotalSize(size int) *InitUploadParams

type Manager

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

func NewManager

func NewManager(ctx context.Context, fs *file_system.FS, hasher *hasher.Hasher, log *logrus.Logger) *Manager

func (*Manager) Create

func (m *Manager) Create(projectName string, TotalSize int) (string, error)

func (*Manager) DeleteUpload

func (m *Manager) DeleteUpload(id string) error

func (*Manager) Get

func (m *Manager) Get(id string) (*Upload, bool)

func (*Manager) Update

func (m *Manager) Update(id string, chunk []byte) error

func (*Manager) UploadManifest

func (m *Manager) UploadManifest(project, hashType string, data []byte) (string, error)

type UpdateParams

type UpdateParams struct {
	ID            string
	UploadedBytes int
	Chunk         []byte
}

func NewUpdateParams

func NewUpdateParams(id string) *UpdateParams

func (*UpdateParams) WithChunk

func (p *UpdateParams) WithChunk(chunk []byte) *UpdateParams

func (*UpdateParams) WithUploadedBytes

func (p *UpdateParams) WithUploadedBytes(size int) *UpdateParams

type Upload

type Upload struct {
	ID          string
	ProjectName string
	ChunkNum    int //for calculate +- size get

	TotalSize     int
	UploadedBytes int //for final check
	Errors        []error
	// contains filtered or unexported fields
}

func InitUpload

func InitUpload(params *InitUploadParams) *Upload

func (*Upload) Done

func (u *Upload) Done(digest string, finalChunk []byte) (int, error)

type Uploads

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

func NewUploads

func NewUploads(fs *file_system.FS, log *logrus.Logger) *Uploads

func (*Uploads) Create

func (u *Uploads) Create(params CreateParams) (string, error)

func (*Uploads) Get

func (u *Uploads) Get(id string) (upload *Upload, ok bool)

Jump to

Keyboard shortcuts

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