api

package
v0.0.0-...-84db164 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2018 License: MIT Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	HTTPErrorInvalidSnippetID = HTTPError{Status: http.StatusBadRequest, Msg: "Invalid Snippet ID"}
	HTTPErrorSnippetNotFound  = HTTPError{Status: http.StatusNotFound, Msg: "Snippet Not Found"}
)
View Source
var (
	HTTPErrorLanguageNotFound = HTTPError{Status: http.StatusNotFound, Msg: "Language Not Found"}
)

Functions

func NewDefaultServer

func NewDefaultServer() (h *handler, err error)

Types

type Config

type Config struct {
	RunTimeout         time.Duration `mapstructure:"RUN_TIMEOUT"`
	Memory             int64         `mapstructure:"MEMORY"`
	NanoCPUs           int64         `mapstructure:"NANO_CPUS"`
	CPUShares          int64         `mapstructure:"CPU_SHARES"`
	PidsLimit          int64         `mapstructure:"PIDS_LIMIT"`
	NetworkEnabled     bool          `mapstructure:"NETWORK_ENABLED"`
	MongoURL           string        `mapstructure:"MONGO_URL"`
	MongoDB            string        `mapstructure:"MONGO_DB"`
	JSONLogging        bool          `mapstructure:"JSON_LOGGING"`
	SnippetSizeLimit   int64         `mapstructure:"SNIPPET_SIZE_LIMIT"`
	ReturnSizeLimit    int64         `mapstructure:"RETURN_SIZE_LIMIT"`
	CorsEnabled        bool          `mapstructure:"CORS_ENABLED"`
	HTTPAddr           string        `mapstructure:"HTTP_ADDR"`
	DefaultImagePrefix string        `mapstructure:"DEFAULT_IMAGE_PREFIX"`
	LanguagesFile      string        `mapstructure:"LANGUAGES_FILE"`
}

type Fields

type Fields map[string]interface{}

type HTTPError

type HTTPError struct {
	Status int    `json:"-"`
	Msg    string `json:"error"`
	Reason string `json:"reason,omitempty"`
}

func (HTTPError) Error

func (e HTTPError) Error() string

type Language

type Language struct {
	ID          string                  `json:"id" toml:"id"`
	Name        string                  `json:"name,omitempty" toml:"name"`
	Extension   string                  `json:"extension,omitempty" toml:"extension"`
	Command     string                  `json:"command,omitempty" toml:"command"`
	Image       string                  `json:"image,omitempty" toml:"image"`
	NotRunnable bool                    `json:"notRunnable,omitempty" toml:"notRunnable"`
	Tests       map[string]LanguageTest `json:"tests,omitempty" toml:"tests"`
}

type LanguageTest

type LanguageTest map[string]string

type Payload

type Payload struct {
	runner.Payload `bson:",inline"`
	Language       string `json:"language,omitempty" bson:",omitempty"`
}

type Snippet

type Snippet struct {
	Payload  `bson:",inline"`
	ID       bson.ObjectId `json:"id" bson:"_id"`
	Created  time.Time     `json:"created"`
	Modified time.Time     `json:"modified"`
	Public   bool          `json:"public,omitempty" bson:",omitempty"`
}

func (*Snippet) MarshalJSON

func (s *Snippet) MarshalJSON() ([]byte, error)

Directories

Path Synopsis
cmd
api

Jump to

Keyboard shortcuts

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