model

package module
v0.0.0-...-66be2e1 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2018 License: NCSA Imports: 14 Imported by: 4

README

README Build Status stability-experimental

Developing

Make sure to run go generate anytime you change one of the structures in the code.

Testing

To run a mongodb on localhost (for ranking_test.go), try

docker run -d -p27017:27017 mongo:3.0

Documentation

Index

Constants

View Source
const (
	Success = ErrorCodeSuccess
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Base

type Base struct {
	CreatedAt time.Time  `json:"created_at" toml:"created_at,omitempty" validate:"required"`
	UpdatedAt time.Time  `json:"updated_at" toml:"updated_at,omitempty" validate:"required"`
	DeletedAt *time.Time `json:"deleted_at" sql:"index" toml:"deleted_at,omitempty"`
}

easyjson:json

func (Base) MarshalEasyJSON

func (v Base) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (Base) MarshalJSON

func (v Base) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*Base) UnmarshalEasyJSON

func (v *Base) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*Base) UnmarshalJSON

func (v *Base) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type BuildCommands

type BuildCommands []string

easyjson:json

func (BuildCommands) MarshalEasyJSON

func (v BuildCommands) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (BuildCommands) MarshalJSON

func (v BuildCommands) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*BuildCommands) UnmarshalEasyJSON

func (v *BuildCommands) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*BuildCommands) UnmarshalJSON

func (v *BuildCommands) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type BuildImageSpecification

type BuildImageSpecification struct {
	ImageName  string `json:"image_name" yaml:"image_name"`
	Dockerfile string `json:"dockerfile" yaml:"dockerfile"`
	Push       *Push  `json:"push" yaml:"push"`
	NoCache    bool   `json:"no_cache" yaml:"no_cache"`
}

easyjson:json

func (BuildImageSpecification) MarshalEasyJSON

func (v BuildImageSpecification) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (BuildImageSpecification) MarshalJSON

func (v BuildImageSpecification) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*BuildImageSpecification) PushQ

func (b *BuildImageSpecification) PushQ() bool

func (*BuildImageSpecification) UnmarshalEasyJSON

func (v *BuildImageSpecification) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*BuildImageSpecification) UnmarshalJSON

func (v *BuildImageSpecification) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type BuildSpecification

type BuildSpecification struct {
	RAI       RAIBuildSpecification      `json:"rai" yaml:"rai" validate:"required"`
	Resources Resources                  `json:"resources" yaml:"resources" validate:"required"`
	Commands  CommandsBuildSpecification `json:"commands" yaml:"commands" validate:"required"`
}

easyjson:json

func (BuildSpecification) MarshalEasyJSON

func (v BuildSpecification) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (BuildSpecification) MarshalJSON

func (v BuildSpecification) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*BuildSpecification) UnmarshalEasyJSON

func (v *BuildSpecification) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*BuildSpecification) UnmarshalJSON

func (v *BuildSpecification) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type CPUResources

type CPUResources struct {
	Architecture string `json:"architecture" yaml:"architecture" validate:"required"`
}

easyjson:json

func (CPUResources) MarshalEasyJSON

func (v CPUResources) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (CPUResources) MarshalJSON

func (v CPUResources) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*CPUResources) UnmarshalEasyJSON

func (v *CPUResources) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*CPUResources) UnmarshalJSON

func (v *CPUResources) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type CommandsBuildSpecification

type CommandsBuildSpecification struct {
	BuildImage *BuildImageSpecification `json:"build_image,omitempty" yaml:"build_image,omitempty"`
	Build      BuildCommands            `json:"build" yaml:"build"`
}

easyjson:json

func (CommandsBuildSpecification) MarshalEasyJSON

func (v CommandsBuildSpecification) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (CommandsBuildSpecification) MarshalJSON

func (v CommandsBuildSpecification) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*CommandsBuildSpecification) UnmarshalEasyJSON

func (v *CommandsBuildSpecification) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*CommandsBuildSpecification) UnmarshalJSON

func (v *CommandsBuildSpecification) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type DataResources

type DataResources []MountResource

easyjson:json

func (DataResources) MarshalEasyJSON

func (v DataResources) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (DataResources) MarshalJSON

func (v DataResources) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*DataResources) UnmarshalEasyJSON

func (v *DataResources) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*DataResources) UnmarshalJSON

func (v *DataResources) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type DockerHubCredentials

type DockerHubCredentials struct {
	Username string `json:"username" yaml:"username" toml:"username" validate:"required"`
	Password string `json:"password" yaml:"password" toml:"password" validate:"required"`
}

easyjson:json

func (DockerHubCredentials) MarshalEasyJSON

func (v DockerHubCredentials) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (DockerHubCredentials) MarshalJSON

func (v DockerHubCredentials) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*DockerHubCredentials) UnmarshalEasyJSON

func (v *DockerHubCredentials) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*DockerHubCredentials) UnmarshalJSON

func (v *DockerHubCredentials) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type Error

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

func (*Error) Code

func (e *Error) Code() int32

func (*Error) Error

func (e *Error) Error() string

func (*Error) MarshalJSON

func (e *Error) MarshalJSON() ([]byte, error)

func (*Error) WithCode

func (e *Error) WithCode(code int) *Error

func (*Error) WithName

func (e *Error) WithName(name string) *Error

func (*Error) Wrap

func (e *Error) Wrap(err error) *Error

type ErrorCode

type ErrorCode int
const (
	ErrorCodeSuccess ErrorCode = iota
	ErrorCodeInvalidSpec
	ErrorCodeInvalidQueue
	ErrorCodeInvalid
	ErrorCodeTimeoutLimit
	ErrorCodeStorageLimit
	ErrorCodeGPUCountLimit
	ErrorCodeLimit
	ErrorCodePermission
	ErrorCodeNoServer
	ErrorCodeUnknown
)

func ErrorCodeString

func ErrorCodeString(s string) (ErrorCode, error)

ErrorCodeString retrieves an enum value from the enum constants string name. Throws an error if the param is not part of the enum.

func ErrorCodeValues

func ErrorCodeValues() []ErrorCode

ErrorCodeValues returns all values of the enum

func (ErrorCode) IsAErrorCode

func (i ErrorCode) IsAErrorCode() bool

IsAErrorCode returns "true" if the value is listed in the enum definition. "false" otherwise

func (ErrorCode) MarshalJSON

func (i ErrorCode) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface for ErrorCode

func (ErrorCode) String

func (i ErrorCode) String() string

func (*ErrorCode) UnmarshalJSON

func (i *ErrorCode) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface for ErrorCode

type GPUResources

type GPUResources struct {
	Architecture string `json:"architecture" yaml:"architecture" validate:"required"`
	Count        int    `json:"count" yaml:"count" validate:"required"`
	Memory       int64  `json:"memory" yaml:"memory" validate:"required"`
}

easyjson:json

func (GPUResources) MarshalEasyJSON

func (v GPUResources) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (GPUResources) MarshalJSON

func (v GPUResources) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*GPUResources) UnmarshalEasyJSON

func (v *GPUResources) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*GPUResources) UnmarshalJSON

func (v *GPUResources) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type JobRequest

type JobRequest struct {
	ID                 bson.ObjectId `json:"_id" bson:"_id" gorm:"primary_key" toml:"id,omitempty" validate:"required"`
	Base               `json:",inline" bson:",inline"`
	ClientVersion      config.VersionInfo `json:"client_version" validate:"required"`
	UploadKey          string             `json:"upload_key"`
	User               User               `json:"user" validate:"required,dive,required" gorm:"ForeignKey:UserID;AssociationForeignKey:Refer"`
	BuildSpecification BuildSpecification `json:"build_specification" validate:"required,dive,required"`
}

easyjson:json

func (JobRequest) MarshalEasyJSON

func (v JobRequest) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (JobRequest) MarshalJSON

func (v JobRequest) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*JobRequest) PushQ

func (j *JobRequest) PushQ() bool

func (*JobRequest) UnmarshalEasyJSON

func (v *JobRequest) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*JobRequest) UnmarshalJSON

func (v *JobRequest) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type JobResponse

type JobResponse struct {
	ID        string                 `json:"id" validate:"required"`
	Kind      ResponseKind           `json:"kind" validate:"required"`
	Error     *Error                 `json:"error" `
	Body      []byte                 `json:"body" validate:"required"`
	Metadata  map[string]interface{} `json:"metadata,omitempty"`
	CreatedAt time.Time              `json:"created_at" validate:"required"`
}

easyjson:json

func (JobResponse) MarshalEasyJSON

func (v JobResponse) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (JobResponse) MarshalJSON

func (v JobResponse) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (JobResponse) TableName

func (JobResponse) TableName() string

func (*JobResponse) UnmarshalEasyJSON

func (v *JobResponse) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*JobResponse) UnmarshalJSON

func (v *JobResponse) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type Limits

type Limits struct {
	Network  bool          `json:"network" yaml:"network"`
	Time     time.Duration `json:"time" yaml:"time"`
	DataSize uint64        `json:"datasize" yaml:"datasize"`
}

easyjson:json

func (Limits) MarshalEasyJSON

func (v Limits) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (Limits) MarshalJSON

func (v Limits) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*Limits) UnmarshalEasyJSON

func (v *Limits) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*Limits) UnmarshalJSON

func (v *Limits) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type MountResource

type MountResource struct {
	Mount  string      `json:"mount" yaml:"mount" validate:"required"` // mount location
	Source MountSource `json:"source" yaml:"source"`
	Cache  bool        `json:"cache" yaml:"cache"`
}

easyjson:json

func (MountResource) MarshalEasyJSON

func (v MountResource) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (MountResource) MarshalJSON

func (v MountResource) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*MountResource) UnmarshalEasyJSON

func (v *MountResource) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*MountResource) UnmarshalJSON

func (v *MountResource) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type MountSource

type MountSource struct {
	URL     string `json:"url" yaml:"url" validate:"required"`
	Extract bool   `json:"extract" yaml:"extract"`
}

type Push

type Push struct {
	Push        bool                 `json:"push" yaml:"push"`
	ImageName   string               `json:"image_name" yaml:"image_name"`
	Registry    string               `json:"registry" yaml:"registry"`
	Credentials DockerHubCredentials `json:"credentials" yaml:"credentials"`
}

easyjson:json

func (Push) MarshalEasyJSON

func (v Push) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (Push) MarshalJSON

func (v Push) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*Push) UnmarshalEasyJSON

func (v *Push) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*Push) UnmarshalJSON

func (v *Push) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type RAIBuildSpecification

type RAIBuildSpecification struct {
	Version        string `json:"version" yaml:"version"`
	ContainerImage string `json:"image" yaml:"image"`
}

easyjson:json

func (RAIBuildSpecification) MarshalEasyJSON

func (v RAIBuildSpecification) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (RAIBuildSpecification) MarshalJSON

func (v RAIBuildSpecification) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*RAIBuildSpecification) UnmarshalEasyJSON

func (v *RAIBuildSpecification) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*RAIBuildSpecification) UnmarshalJSON

func (v *RAIBuildSpecification) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type Resources

type Resources struct {
	CPU           CPUResources   `json:"cpu" yaml:"cpu" validate:"required,dive,required"`
	GPU           *GPUResources  `json:"gpu,omitempty" yaml:"gpu"`
	DataResources *DataResources `json:"dataresources,omitempty" yaml:"dataresources"`
	Limits        Limits         `json:"limits" yaml:"limits"`
}

easyjson:json

func (Resources) MarshalEasyJSON

func (v Resources) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (Resources) MarshalJSON

func (v Resources) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*Resources) UnmarshalEasyJSON

func (v *Resources) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*Resources) UnmarshalJSON

func (v *Resources) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type ResponseKind

type ResponseKind string
const (
	StderrResponse ResponseKind = "Stderr"
	StdoutResponse ResponseKind = "Stdout"
	StdinResponse  ResponseKind = "Stdin"
	EndResponse    ResponseKind = "End"
)

type Team

type Team struct {
	Name string `json:"name"`
}

easyjson:json

func (Team) MarshalEasyJSON

func (v Team) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (Team) MarshalJSON

func (v Team) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*Team) UnmarshalEasyJSON

func (v *Team) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*Team) UnmarshalJSON

func (v *Team) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type User

type User struct {
	ID          bson.ObjectId `json:"_id" bson:"_id" gorm:"primary_key" toml:"id,omitempty" validate:"required"`
	Base        `toml:"-" yaml:"-" validate:"required,dive,required"`
	Firstname   string                `json:"firstname" yaml:"firstname,omitempty" toml:"firstname,omitempty" validate:"required"`
	Lastname    string                `json:"lastname" yaml:"lastname,omitempty" toml:"lastname,omitempty" validate:"required"`
	Username    string                `json:"username" yaml:"username" toml:"username"`
	Email       string                `json:"email" yaml:"email" toml:"email" validate:"required,email"`
	AccessKey   string                `json:"access_key" yaml:"access_key" toml:"access_key" validate:"required"`
	SecretKey   string                `json:"secret_key" yaml:"secret_key" toml:"secret_key" validate:"required"`
	Affiliation string                `json:"affiliation" yaml:"affiliation" toml:"affiliation"`
	Password    string                `json:"password" yaml:"-" toml:"-"`
	Team        *Team                 `json:"team" gorm:"ForeignKey:TeamID;AssociationForeignKey:Refer" toml:"-"`
	DockerHub   *DockerHubCredentials `json:"dockerhub,omitempty" yaml:"dockerhub,omitempty" toml:"dockerhub,omitempty"`
	Role        acl.Role              `json:"role" yaml:"role" validate:"required"`
}

easyjson:json

func (User) MarshalEasyJSON

func (v User) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (User) MarshalJSON

func (v User) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (User) TableName

func (User) TableName() string

func (*User) UnmarshalEasyJSON

func (v *User) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*User) UnmarshalJSON

func (v *User) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

Jump to

Keyboard shortcuts

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