memjudge

package module
v0.0.0-...-fc8e493 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2016 License: MIT Imports: 15 Imported by: 0

README

MemJudge

Online Judge for Competitive Programming Contests. And Memes
P.S. If you have better name for this thing, please tell me ._____.
P.P.S. I will appreciate any advices as well
###Version### 0.0-a0

##Structure##

  1. Front End:
  • JavaScript:
    • Handle user actions
    • Send requests
  1. Back end:
  • Golang:
    • Handles HTTP Requests from users:
      • Looks up DB
      • Adds new Solutions to Queue
      • ...
  • Python:
    • Testing Solutions (?)
  1. Database:
  2. MongoDB: * Users Info * Solutions * Testing Results * Testing Queue * Contests

##Database Structure##

###MongoDB Collections###

  1. users:
  • Example:
{
  "_id": {
    "_id": _id,
    "login": ...,
    "passwordHash": ...,
    "lastSID": len 32 hex,
    "lastSessionStart": date,
    "lastSessionEnd": date,
    "email": ...,
    "firstName": ...,
    "lastName": ...,
    "address": ..., #and other (index, ...)
    "solutions": [ids],
    "contests": [ids],
    ... #TODO (Polygon auth info)
  },
  ...
}
  1. contests:
  • Example:
{
  "id": {
    "owners": [Rights],
    "authors": [user ids],
    "registeredUsers": [user ids],
    "problems": [ids],
    "startDate": date,
    "endDate": date,
    "private": true/false,
    "scoring": [len(problems), ranking system],
    # TODO Ranking System
  },
  ...
}
  1. problems:
  • Example:
{
  "id": {
    "owners": [Rights],
    "authors": [user ids],
    "name": ...,
    "statement": ...,
    "tests": [Tests],
    "inputType": stdin/file name (if not interactive),
    "outputType": stdout/file name (if not interactive),
    "checker": checker file, # TODO specification
    "type": standard/interactive,
    
    "polygonId": ..., #TODO
  },
  ...
}
  1. solutions:
  • Example:
{
  "id": {
    "owner": user id,
    "problem": problem id,
    "testingTesult": TestingResult,
    "timestamp": date,
  
  }
}
  1. testing_queue

####Utility Classes####

"Rights":
{
  "owner": user id,
  "read": true/false,
  "write": true/false,
  "setRights": true/false
}
"Test":
{
  "problem": problem id,
  "input": ...,
  "inputShort": first 1024 symbols of input,
  "output": ...,
  "outputShort": first 1024 symbols of output,
  "timeLimit": float (seconds),
  "memoryLimit": bytes,
  "timeElapsed": float,
  "memoryUsed": bytes,
  "reason": does not exist | reason of verdict
}
"TestingResult" :
{
  "status": (Queued/Compiling/Compilation Error/Running/(OK|Accepted)/Time Limit Exceeded/Memory Limit Exceeded/Runtime Error/Wrong Answer/Security Violation/...)
  "tests": [Test],
  "invokerId": id,
}

##TODO##

What about...
  1. Move Testing Queue to another DB (like MemCached, Redis, etc.)
  2. Move main DB from MongoDB to MySQL, ...
  3. Decide which language to use for testing solutions (Python / Golang / C++ / Java)
  4. Add Polygon Integration
  5. Better daemon controller (control/control)

Documentation

Index

Constants

View Source
const MasterPort = ":45100"
View Source
const WebPort = ":8080"

Variables

This section is empty.

Functions

This section is empty.

Types

type Server

type Server struct {
	Config       *ServerConfig
	Judges       map[int]chan bool // chans used to kill specified judges
	WebInstances map[int]chan bool // or web instances

	DB    *mgo.Database
	Proxy *httputil.ReverseProxy
	// contains filtered or unexported fields
}

func (*Server) Serve

func (s *Server) Serve()

func (*Server) Stop

func (s *Server) Stop(seconds int64)

type ServerConfig

type ServerConfig struct {
	NumJudges       int
	NumWebInstances int
}

func DefaultServerConfig

func DefaultServerConfig() *ServerConfig

func (*ServerConfig) SpreadThreads

func (s *ServerConfig) SpreadThreads(threads int)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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