server

package
v0.0.0-...-8e942fd Latest Latest
Warning

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

Go to latest
Published: Jan 1, 2020 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitServer

func InitServer(dir string)

InitServer initializes structures and starts listening

Types

type Command

type Command struct {
	Login    string `yaml:"login"`    //user login
	Password string `yaml:"password"` //user password - deleted after check
	Command  string `yaml:"command"`  //given command - described in protocol.md
	Contest  string `yaml:"contest"`  //contest name for commands that need it
	Round    string `yaml:"round"`    //round name for commands that need it
	Task     string `yaml:"task"`     //task name for commands that need it
	Data     string `yaml:"data"`     //additional data like submission code (specified in docs)
}

Command holds user command data (unmarshallized from yaml)

type ReturnMessage

type ReturnMessage struct {
	Status         string           `yaml:"status"`                       //status may be "ok" or contains error
	ContestRanking map[string]uint  `yaml:"contest_ranking,omitempty"`    //used in contest_ranking
	Tasks          []string         `yaml:"tasks,omitempty"`              //used in round_ranking
	Users          []string         `yaml:"users,omitempty"`              //used in round_ranking
	RoundRanking   [][]uint         `yaml:"round_ranking,omitempty,flow"` //used in round_ranking
	Filename       string           `yaml:"filename,omitempty"`           //used in get_task
	Data           string           `yaml:"data,omitempty"`               //used in get_task, encoded in base64
	Submissions    [][3]string      `yaml:"submissions,omitempty,flow"`   //used in list_submissions
	Submission     tasks.Submission `yaml:"submission,omitempty"`         //used in get_submission
	Contests       [][2]string      `yaml:"contests,omitempty,flow"`      //used in list_contests
}

ReturnMessage send to client after execute command

type Server

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

Server stores main SOK data

func (*Server) CheckSubmissions

func (s *Server) CheckSubmissions(fs *fs.Fs, ch chan *connectionData)

CheckSubmissions read and check submissions from sok/queue

func (*Server) Execute

func (s *Server) Execute(buff []byte) []byte

Execute given command. Return response to the client

Jump to

Keyboard shortcuts

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