uploads

package
v0.0.0-...-2be0f72 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2017 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MediaType

func MediaType(name, path string) schema.MediaType

MediaType determines the mime media type for the given file. Because MaterialsCommons stores the file by id, which is different from the filename, the name and the path are passed. The name allows us to try and determine the file type by its extension.

func NewIDService

func NewIDService(session *r.Session) *idService

NewIDService creates a new idService that connects to the database using the given session.

func NewUploadService

func NewUploadService(session *r.Session) *uploadService

NewUploadService creates a new idService that connects to the database using the given session.

Types

type IDRequest

type IDRequest struct {
	User        string
	DirectoryID string
	ProjectID   string
	FileName    string
	FileSize    int64
	Checksum    string
	ChunkSize   int32
	FileMTime   time.Time
	Host        string
	Birthtime   time.Time
}

A IDRequest requests a new upload id be created for the given parameters.

type IDService

type IDService interface {
	ID(req IDRequest) (*schema.Upload, error)
	Delete(requestID, user string) error
	UploadsForProject(projectID string) ([]schema.Upload, error)
}

IDService creates new upload requests

type UploadRequest

type UploadRequest struct {
	*flow.Request
}

A UploadRequest contains the block to upload and the information required to write that block.

type UploadService

type UploadService interface {
	Upload(req *UploadRequest) (*UploadStatus, error)
}

UploadService takes care of uploading blocks and constructing the file when all blocks have been uploaded.

type UploadStatus

type UploadStatus struct {
	FileID string
	Done   bool
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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