Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ActionOutput ¶
type ActionOutput struct { // ExecutionInformation is a channel that is used to send the execution information // to the client which contains the name of the temporary directory and the user. ExecutionInformation chan ExecutionInformation // Once is a channel that is used to send the code output to the client once with the // REST API. Once chan CodeOutput // Stream is a channel that is used to send the code output to the client continuously // with the WebSocket API. Stream chan StreamOutput }
type CodeOutput ¶
type CodeOutput struct { User User TempDirName string CompileOutput Output RunOutput Output TestOutput TestOutput }
type ConcurrentQueue ¶
type ConcurrentQueue[T any] struct { // contains filtered or unexported fields }
ConcurrentQueue is a concurrent implementation of the designed `Queue`.
func NewConcurrentQueue ¶
func NewConcurrentQueue[T any]() *ConcurrentQueue[T]
NewConcurrentQueue creates a new queue with any value type and areturns it.
type ExecutionInformation ¶
type Queue ¶
type Queue[T any] struct { // contains filtered or unexported fields }
Queue is a modified queue implementation duplicate of the queue design principles described in https://github.com/ef-ds/queue.
type StreamOutput ¶
type SystemUsers ¶
type SystemUsers struct {
// contains filtered or unexported fields
}
SystemUsers represents a pool of users.
func NewSystemUsers ¶
func NewSystemUsers(amount uint32) *SystemUsers
NewSystemUser creates a new pool of users with a specific amount. By default all users are free.
func (*SystemUsers) Acquire ¶
func (su *SystemUsers) Acquire() (*User, error)
Acquire returns a free user and marks it as used. If no user was found, it will return an error.
func (SystemUsers) GetUsers ¶
func (su SystemUsers) GetUsers() []*User
GetUsers returns the list of users in the current pool.
func (*SystemUsers) Release ¶
func (su *SystemUsers) Release(uid uint32)
Release marks a user with the specified `uid“ as free.
type TestOutput ¶
type TestOutput struct { Results []TestResult `json:"results" binding:"required"` Time int64 `json:"time" binding:"required"` }
type TestResult ¶
type WorkData ¶
type WorkData struct { Lang string Code string Stdin []string Tests []TestResult BypassCache bool }
type WorkType ¶
type WorkType struct {
// contains filtered or unexported fields
}
WorkType represents a unit of work to be executed by the worker pool.
type WorkerPool ¶
type WorkerPool struct {
// contains filtered or unexported fields
}
func NewWorkerPool ¶
func NewWorkerPool(nWorkers int) *WorkerPool
NewWorkerPool creates a new worker pool instance with the specific number of worker goroutines.
func (*WorkerPool) SubmitJob ¶
func (wp *WorkerPool) SubmitJob(data WorkData, action actionFunc, actionOutput ActionOutput, terminate chan<- bool)
SubmitJob adds a new work unit to the worker pool.