schema

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var FileFields fileFields

File contains methods to get the json fields names for a File

View Source
var Files fs

Files gives access to helper routines that work on lists of files.

View Source
var Uploads uploadList

Uploads gives access to helper routines that work on lists of uploads.

Functions

func CUpload

func CUpload() *uploadCreater

CUpload creates a new uploadCreater.

Types

type Access

type Access struct {
	ID          string    `gorethink:"id,omitempty"`
	Dataset     string    `gorethink:"dataset"`
	Birthtime   time.Time `gorethink:"birthtime"`
	MTime       time.Time `gorethink:"mtime"`
	Permissions string    `gorethink:"permissions"`
	ProjectID   string    `gorethink:"project_id"`
	ProjectName string    `gorethink:"project_name"`
	Status      string    `gorethink:"status"`
	UserID      string    `gorethink:"user_id"`
}

func NewAccess

func NewAccess(projectID, projectName, userID string) Access

type DataDir2DataFile

type DataDir2DataFile struct {
	ID         string `gorethink:"id,omitempty"`
	DataDirID  string `gorethink:"datadir_id"`
	DataFileID string `gorethink:"datafile_id"`
}

DataDir2DataFile is a join table that maps datadirs to their files.

type Dataset

type Dataset struct {
	ID        string `gorethink:"id,omitempty" json:"id"`
	Published bool   `gorethink:"published" json:"published"`
}

type Directory

type Directory struct {
	ID        string    `gorethink:"id,omitempty" json:"id"`
	Type      string    `gorethink:"otype" json:"otype"`
	Owner     string    `gorethink:"owner" json:"owner"`
	Name      string    `gorethink:"name" json:"name"`
	Project   string    `gorethink:"project" json:"project"`
	Parent    string    `gorethink:"parent" json:"parent"`
	Birthtime time.Time `gorethink:"birthtime" json:"birthtime"`
	MTime     time.Time `gorethink:"mtime" json:"mtime"`
	ATime     time.Time `gorethink:"atime" json:"mtime"`
}

Directory models a directory of user files. A dir is an abstract representation of a users file system directory plus the metadata needed by the system.

func NewDirectory

func NewDirectory(name, owner, project, parent string) Directory

NewDirectory creates a new Directory instance.

type File

type File struct {
	ID          string    `gorethink:"id,omitempty" json:"id"`         // Primary key.
	Type        string    `gorethink:"otype" json:"otype"`             // Type
	Current     bool      `gorethink:"current" json:"current"`         // Is this the most current version.
	Name        string    `gorethink:"name" json:"name"`               // Name of file.
	Path        string    `gorethink:"path,omitempty" json:"path"`     // Directory path where file resides.
	Birthtime   time.Time `gorethink:"birthtime" json:"birthtime"`     // Creation time.
	MTime       time.Time `gorethink:"mtime" json:"mtime"`             // Modification time.
	ATime       time.Time `gorethink:"atime" json:"atime"`             // Last access time.
	Description string    `gorethink:"description" json:"description"` // Description of file
	MediaType   MediaType `gorethink:"mediatype" json:"mediatype"`     // File media type and description
	Owner       string    `gorethink:"owner" json:"owner"`             // Who owns the file.
	Checksum    string    `gorethink:"checksum" json:"checksum"`       // MD5 Hash.
	Size        int64     `gorethink:"size" json:"size"`               // Size of file.
	Uploaded    int64     `gorethink:"uploaded" json:"-"`              // Number of bytes uploaded. When Size != Uploaded file is only partially uploaded.
	Parent      string    `gorethink:"parent" json:"parent"`           // If there are multiple ids then parent is the id of the previous version.
	UsesID      string    `gorethink:"usesid" json:"usesid"`           // If file is a duplicate, then usesid points to the real file. This allows multiple files to share a single physical file.
}

File models a user file. A datafile is an abstract representation of a real file plus the attributes that we need in our model for access, and other metadata.

func NewFile

func NewFile(name, owner string) File

NewFile creates a new File instance.

func (*File) FileID

func (f *File) FileID() string

FileID returns the id to use for the file. Because files can be duplicates, all duplicates are stored under a single ID. UsesID is set to the ID that an entry points to when it is a duplicate.

type FileUpload

type FileUpload struct {
	Name        string         `gorethink:"name"`         // File name on remote system
	Checksum    string         `gorethink:"checksum"`     // Computed file checksum
	Size        int64          `gorethink:"size"`         // Size of file on remote system
	Birthtime   time.Time      `gorethink:"birthtime"`    // When was FileUpload started
	MTime       time.Time      `gorethink:"mtime"`        // Last time this entry was modified
	RemoteMTime time.Time      `gorethink:"remote_mtime"` // CTime of the remote file
	ChunkSize   int            `gorethink:"chunk_size"`   // Chunk transfer size
	ChunkCount  int            `gorethink:"chunk_count"`  // Number of chunks expected
	BitString   []byte         `gorethink:"bitstring"`    // bit string representation of blocks
	Blocks      *bitset.BitSet // Block state. If set block as has been uploaded
}

FileUpload is the tracking information for an individual file upload.

type Group

type Group struct {
	ID          string    `gorethink:"id,omitempty"`
	Owner       string    `gorethink:"owner"`
	Name        string    `gorethink:"name"`
	Description string    `gorethink:"description"`
	Birthtime   time.Time `gorethink:"birthtime"`
	MTime       time.Time `gorethink:"mtime"`
	Access      string    `gorethink:"access"`
	Users       []string  `gorethink:"users"`
}

Group models users groups and access permissions to user data.

func NewGroup

func NewGroup(owner, name string) Group

NewGroup creates a new UserGroup instance.

type MediaType

type MediaType struct {
	Mime        string `gorethink:"mime" json:"mime"`               // The MIME type
	Description string `gorethink:"description" json:"description"` // Description of MIME type

	// MIME Description translated to human readable format
	MimeDescription string `gorethink:"mime_description" json:"mime_description"`
}

MediaType describes the mime media type and its description.

type MediaTypeSummary

type MediaTypeSummary struct {
	Count       int    `gorethink:"count" json:"count"`
	Description string `gorethink:"description" json:"description"`
	Size        int64  `gorethink:"size" json:"size"`
}

type Note

type Note struct {
	Date    string `gorethink:"date"`
	Message string `gorethink:"message"`
	Who     string `gorethink:"who"`
}

Note represents a note entry.

type Project

type Project struct {
	ID          string                      `gorethink:"id,omitempty"`
	Type        string                      `gorethink:"otype" json:"otype"`
	Name        string                      `gorethink:"name"`
	Description string                      `gorethink:"description"`
	DataDir     string                      `gorethink:"datadir" db:"-"`
	Owner       string                      `gorethink:"owner" db:"-"`
	Birthtime   time.Time                   `gorethink:"birthtime"`
	MTime       time.Time                   `gorethink:"mtime"`
	MediaTypes  map[string]MediaTypeSummary `gorethink:"mediatypes" json:"mediatypes"`
	Size        int64                       `gorethink:"size" json:"size"`
}

Project models a users project. A project is an instance of a users workspace where they conduct their research. A project can be shared.

func NewProject

func NewProject(name, owner string) Project

NewProject creates a new Project instance.

type Project2DataDir

type Project2DataDir struct {
	ID        string `gorethink:"id,omitempty" db:"-"`
	ProjectID string `gorethink:"project_id" db:"project_id"`
	DataDirID string `gorethink:"datadir_id" db:"datadir_id"`
}

Project2DataDir is a join table that maps projects to their datadirs.

type Project2DataFile

type Project2DataFile struct {
	ID         string `gorethink:"id,omitempty"`
	ProjectID  string `gorethink:"project_id"`
	DataFileID string `gorethink:"datafile_id"`
}

Project2DataFile is a join table that maps projects to their files.

type Sample2DataFile

type Sample2DataFile struct {
	ID         string `gorethink:"id"`
	SampleID   string `gorethink:"sample_id"`
	DataFileID string `gorethink:"datafile_id"`
}

Sample2DataFile is a join table that maps samples to their files.

type Upload

type Upload struct {
	ID              string     `gorethink:"id,omitempty"`
	Owner           string     `gorethink:"owner"`          // Who started the upload
	DirectoryID     string     `gorethink:"directory_id"`   // Directory to upload to
	DirectoryName   string     `gorethink:"directory_name"` // Name of directory
	ProjectID       string     `gorethink:"project_id"`     // Project to upload to
	ProjectOwner    string     `gorethink:"project_owner"`  // Owner of project
	ProjectName     string     `gorethink:"project_name"`   // Name of project
	Birthtime       time.Time  `gorethink:"birthtime"`      // When was upload started
	Host            string     `gorethink:"host"`           // Host requesting the upload
	File            FileUpload `gorethink:"file"`           // File being uploaded
	IsExisting      bool       `gorethink:"is_existing"`    // Is this an upload request that matches an uploaded file
	ServerRestarted bool       `gorethink:"server_restart"` // Has the server been restarted since upload was created?
}

A Upload models a user upload request. It allows for users to restart upload requests.

func (*Upload) SetFBlocks

func (u *Upload) SetFBlocks(blocks *bitset.BitSet)

SetFBlocks sets the blocks and BitString. It does nothing if blocks is nil.

type User

type User struct {
	ID          string    `gorethink:"id,omitempty" json:"id"`
	Email       string    `gorethink:"email" json:"email"`
	Admin       bool      `gorethink:"admin" json:"admin"`
	Fullname    string    `gorethink:"fullname" json:"fullname"`
	Password    string    `gorethink:"password" json:"-"`
	APIKey      string    `gorethink:"apikey" json:"-"`
	Birthtime   time.Time `gorethink:"birthtime" json:"birthtime"`
	MTime       time.Time `gorethink:"mtime" json:"mtime"`
	Avatar      string    `gorethink:"avatar" json:"avatar"`
	Description string    `gorethink:"description" json:"description"`
	Affiliation string    `gorethink:"affiliation" json:"affiliation"`
	HomePage    string    `gorethink:"homepage" json:"homepage"`
	Type        string    `gorethink:"otype" json:"otype"`
}

User models a user in the system.

func NewUser

func NewUser(name, email, password, apikey string) User

NewUser creates a new User instance.

Jump to

Keyboard shortcuts

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