resumableuploadservice

package
v0.0.0-...-79683fd Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2023 License: MIT Imports: 5 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ReadCloserInformer

type ReadCloserInformer interface {
	Read(buf []byte) (n int, err error)
	Close() error
	GetFractionRead() float32
}

type ReadCloserInformerProvider

type ReadCloserInformerProvider interface {
	GetReadCloserInformer() (ReadCloserInformer, error)
}

type ResumableUploadService

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

func New

func New(path string) (*ResumableUploadService, error)

func (*ResumableUploadService) Close

func (rsu *ResumableUploadService) Close()

Close stops what needs to be stopped

func (*ResumableUploadService) DeleteFile

func (rsu *ResumableUploadService) DeleteFile(uid int64, fileID string, chunkCount int) error

DeleteFile deletes the whole file bucket

func (*ResumableUploadService) IsUploadFinished

func (rsu *ResumableUploadService) IsUploadFinished(uid int64, fileID string, chunkCount int, expectedSize int64) (bool, error)

IsUploadFinished compares the total size of stored chunks a to provided size

func (*ResumableUploadService) NewFileReader

func (rsu *ResumableUploadService) NewFileReader(uid int64, fileID string, chunkCount int) (ReadCloserInformer, error)

NewFileReader returns a reader that reconstructs the file from the chunks on the fly. It does not check if the file is complete.

func (*ResumableUploadService) PutChunk

func (rsu *ResumableUploadService) PutChunk(uid int64, fileID string, chunkNumber int, chunk []byte) error

PutChunk stores chunk, overwrites if exists.

func (*ResumableUploadService) TestChunk

func (rsu *ResumableUploadService) TestChunk(uid int64, fileID string, chunkNumber int, chunkSize int64) (bool, error)

TestChunk returns true if the chunk is already received

Jump to

Keyboard shortcuts

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