mc

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: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidProjectFilePath = errors.New("path not in project")
	ErrFileNotUploaded        = errors.New("existing file not uploaded")
	ErrFileVersionNotUploaded = errors.New("existing file has changes that haven't been uploaded")
)
View Source
var ProjectOpener sqlProjectDBOpener = sqlProjectDBOpener{
	// contains filtered or unexported fields
}
View Source
var Projects *mcprojects = NewProjects(NewOSUserConfiger())

Functions

func NewOSUserConfiger

func NewOSUserConfiger() osUserConfiger

func NewProjects

func NewProjects(configer Configer) *mcprojects

Types

type ClientAPI

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

ClientAPI implements API calls to the mcstored server.

func NewClientAPI

func NewClientAPI() *ClientAPI

NewClientAPI creates a new instance of a ClientAPI. It checks for client side project data in $HOME/.materialscommons

func (*ClientAPI) CreateDirectory

func (c *ClientAPI) CreateDirectory(projectName, path string) error

CreateDirectory will create a single directory on the server for the named project.

func (*ClientAPI) CreateProject

func (c *ClientAPI) CreateProject(name, path string) error

CreateProject creates a new project. If the project already exists on the client it returns app.ErrExists.

func (*ClientAPI) CreateProjectDirectories

func (c *ClientAPI) CreateProjectDirectories(projectName string) error

CreateProjectDirectories will create all the directories on the server that are found under the client project.

func (*ClientAPI) DownloadDirectory

func (c *ClientAPI) DownloadDirectory(projectName string, path string, recursive bool, numThreads int) error

func (*ClientAPI) DownloadFile

func (c *ClientAPI) DownloadFile(projectName string, path string) error

func (*ClientAPI) DownloadProject

func (c *ClientAPI) DownloadProject(projectName string, numThreads int) error

func (*ClientAPI) IndexProject

func (c *ClientAPI) IndexProject(projectName string) error

IndexProject will index a project (whatever that means at the moment)

func (*ClientAPI) ProjectStatus

func (c *ClientAPI) ProjectStatus(projectID string) error

func (*ClientAPI) RenameProject

func (c *ClientAPI) RenameProject(oldName, newName string) error

RenameProject will rename an existing project.

func (*ClientAPI) UploadDirectory

func (c *ClientAPI) UploadDirectory(projectName string, path string, recursive bool, numThreads int) error

UploadDirectory uploads all the entries in a given directory. It will not follow sub directories. However it will create sub directories that are direct children of the given path.

func (*ClientAPI) UploadFile

func (c *ClientAPI) UploadFile(projectName string, path string) error

UploadFile uploads a single file to the given project.

func (*ClientAPI) UploadProject

func (c *ClientAPI) UploadProject(projectName string, numThreads int) error

UploadProject will upload all the changed and new files in a given project.

type Configer

type Configer interface {
	APIKey() string
	ConfigDir() string
	ConfigFile() string
}

type Directory

type Directory struct {
	ID           int64
	DirectoryID  string
	Path         string
	LastUpload   time.Time
	LastDownload time.Time
}

type File

type File struct {
	ID           int64
	FileID       string
	Name         string
	Checksum     string
	Size         int64
	MTime        time.Time
	CTime        time.Time
	LastUpload   time.Time
	LastDownload time.Time
	Directory    int64
}

type Project

type Project struct {
	ID           int64
	Name         string
	Path         string
	ProjectID    string
	LastUpload   time.Time
	LastDownload time.Time
}

type ProjectDB

type ProjectDB interface {
	Project() *Project
	UpdateProject(project *Project) error
	InsertDirectory(dir *Directory) (*Directory, error)
	UpdateDirectory(dir *Directory) error
	Directories() []Directory
	Ls(dir Directory) []File
	InsertFile(f *File) (*File, error)
	FindFile(fileName string, dirID int64) (*File, error)
	UpdateFile(f *File) error
	FindDirectory(path string) (*Directory, error)
	Clone() ProjectDB
}

type ProjectDBLister

type ProjectDBLister interface {
	// All returns a list of the known ProjectDBs. The ProjectDBs
	// are open.
	All() ([]ProjectDB, error)

	// Create will create a new local project and populate
	// the default database entries. The returned ProjectDB
	// has already been opened.
	Create(dbSpec ProjectDBSpec) (ProjectDB, error)
}

type ProjectDBOpener

type ProjectDBOpener interface {
	CreateProjectDB(dbSpec ProjectDBSpec) (ProjectDB, error)
	OpenProjectDB(name string) (ProjectDB, error)
	ProjectExists(name string) bool
	PathToName(path string) string
}

type ProjectDBSpec

type ProjectDBSpec struct {
	Name      string
	ProjectID string
	Path      string
}

type ProjectOpenFlags

type ProjectOpenFlags int

Jump to

Keyboard shortcuts

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