server

package
v0.0.0-...-6d04afb Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2017 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CopyCancelled = errors.New("Copy cancelled")

Functions

func CopyFile

func CopyFile(src, dst string) (err error)

CopyFile copies a file from src to dst. If src and dst files exist, and are the same, then return success. Otherise, attempt to create a hard link between the two files. If that fail, copy the file contents from src to dst.

Types

type CopyJob

type CopyJob struct {
	ID string

	Done chan bool
	// contains filtered or unexported fields
}

func NewCopyJob

func NewCopyJob(cd moocfetcher.CourseData, copier CourseCopier) *CopyJob

func (*CopyJob) Cancel

func (c *CopyJob) Cancel()

func (*CopyJob) Progress

func (c *CopyJob) Progress() CopyJobProgress

func (*CopyJob) Run

func (c *CopyJob) Run()

type CopyJobProgress

type CopyJobProgress struct {
	Current string `json:"current,omitempty"`
	Done    int    `json:"done"`
	Total   int    `json:"total"`
	Status  string `json:"status"`
	Error   error  `json:"error,omitempty"`
	Copied  int    `json:"copied"`
}

type CourseCopier

type CourseCopier interface {
	Copy(courseSlug string) error
	Progress() int
	Cancel()
}

type FileSystemCopier

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

func NewFileSystemCopier

func NewFileSystemCopier(from, to string) *FileSystemCopier

func (*FileSystemCopier) Cancel

func (f *FileSystemCopier) Cancel()

func (*FileSystemCopier) Copy

func (f *FileSystemCopier) Copy(courseSlug string) error

func (*FileSystemCopier) Progress

func (f *FileSystemCopier) Progress() int

type MOOCFetcherApplianceServer

type MOOCFetcherApplianceServer struct {
	*http.ServeMux

	Copier           CourseCopier
	USBDriveOverride string // Ugly hack to make USB detection more robust on Windows
	// contains filtered or unexported fields
}

MOOCFetcherApplianceServer take request from the MOOCFetcher Appliance frontend app and performs copy operations, provides status updates etc.

func NewServer

func NewServer(courseFoldersPath string, courseMetadata moocfetcher.CourseData) *MOOCFetcherApplianceServer

Jump to

Keyboard shortcuts

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