chunk

package module
v0.0.0-...-1b4cf4b Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2015 License: MIT Imports: 12 Imported by: 0

README

chunk

FlowJS Server written in Go Lang - Upload Large Files in Chunks.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AssembleFolder

type AssembleFolder struct {
	Callback    func(*UploadOutcome)
	Data        interface{}
	Source      *ChunkFolder
	Destination FolderDestination
	// contains filtered or unexported fields
}

func (*AssembleFolder) Notify

func (o *AssembleFolder) Notify()

type ByChunk

type ByChunk []os.FileInfo

func (ByChunk) Len

func (a ByChunk) Len() int

func (ByChunk) Less

func (a ByChunk) Less(i, j int) bool

func (ByChunk) Swap

func (a ByChunk) Swap(i, j int)

type ChunkFolder

type ChunkFolder struct {
	FolderSource

	//final final name
	Filename string
	// contains filtered or unexported fields
}

folder to assemble

func (*ChunkFolder) IsComplete

func (f *ChunkFolder) IsComplete() bool

type ChunkUpload

type ChunkUpload struct {
	CurrentChunkNumber int //flowChunkNumber
	CurrentChunkSize   int
	ChunkSize          int
	TotalSize          int64
	Identifier         string
	Filename           string
	RelativePath       string
	TotalChunks        int
	Destination        Destination
}

func (*ChunkUpload) ChunkAlreadyUploaded

func (u *ChunkUpload) ChunkAlreadyUploaded() bool

func (*ChunkUpload) UploadChunk

func (u *ChunkUpload) UploadChunk(src io.Reader) (*ChunkFolder, error)

type Destination

type Destination interface {
	Writer(subfolder string) FolderDestination
	Reader(subfolder string) FolderSource
}

type FileAssembler

type FileAssembler struct {
	Log logging.Logger `inject:""`
	// contains filtered or unexported fields
}

FileAssembler - assembles file chunks into files

func (*FileAssembler) Post

func (fa *FileAssembler) Post(folder *AssembleFolder)

func (*FileAssembler) Start

func (fa *FileAssembler) Start()

Start - Start Threads to assemble files.

func (*FileAssembler) Stop

func (fa *FileAssembler) Stop()

Stop = stop all new file assembly

type FileDestination

type FileDestination struct {
	FolderRoot string
	// contains filtered or unexported fields
}

func (*FileDestination) Create

func (fd *FileDestination) Create(filename string) (io.WriteCloser, error)

func (*FileDestination) Delete

func (d *FileDestination) Delete(filePath string) error

func (*FileDestination) Files

func (f *FileDestination) Files() ([]FileSource, error)

func (*FileDestination) Reader

func (f *FileDestination) Reader(subfolder string) FolderSource

func (*FileDestination) Remove

func (f *FileDestination) Remove() error

func (*FileDestination) Size

func (d *FileDestination) Size(filePath string) int64

Size() - Gets the file's size. If file doesn't exist, value is less than zero

func (*FileDestination) Uri

func (fd *FileDestination) Uri(filename string) string

func (*FileDestination) Writer

func (f *FileDestination) Writer(subfolder string) FolderDestination

type FileFlusher

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

func (*FileFlusher) Close

func (fd *FileFlusher) Close() error

func (*FileFlusher) Write

func (fd *FileFlusher) Write(b []byte) (int, error)

type FileSource

type FileSource interface {
	Name() string
	Uri() string
	Size() int64
	Open() (io.ReadCloser, error)
}

type FileSystemFile

type FileSystemFile struct {
	Path string
}

func (*FileSystemFile) Name

func (f *FileSystemFile) Name() string

do we need this?

func (*FileSystemFile) Open

func (f *FileSystemFile) Open() (io.ReadCloser, error)

func (*FileSystemFile) Size

func (f *FileSystemFile) Size() int64

func (*FileSystemFile) Uri

func (f *FileSystemFile) Uri() string

type FolderDestination

type FolderDestination interface {
	//Folder Destination
	Create(filename string) (io.WriteCloser, error)
	Delete(filename string) error
	Uri(filename string) string

	Size(filename string) int64
}

type FolderSource

type FolderSource interface {
	//returns chunks in sorted order
	Files() ([]FileSource, error)
	Remove() error
}

FOLDER

type S3Destination

type S3Destination struct {
	S3Domain      string // "s3-us-west-2.amazonaws.com"
	BucketName    string // my.bucket.name
	AccessKey     string
	SecretKey     string
	SecurityToken string

	Folder string
}

func (*S3Destination) Create

func (d *S3Destination) Create(filename string) (io.WriteCloser, error)

func (*S3Destination) Delete

func (d *S3Destination) Delete(filename string) error

func (*S3Destination) Size

func (d *S3Destination) Size(filename string) int64

func (*S3Destination) Uri

func (d *S3Destination) Uri(filename string) string

type UploadOutcome

type UploadOutcome struct {
	Uri  string
	Err  error
	Data interface{}
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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