onlineEditor

package
v0.0.0-...-e9462bd Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2019 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

View Source
const (
	JobLabelMatchIdKey    = "k8s.planetlia.com/match-id"
	JobLabelTypeKey       = "k8s.planetlia.com/job-type"
	JobLabelTypeValue     = "online-editor-match"
	JobLabelCpuAllocation = "k8s.planetlia.com/cpu-allocation"
)
View Source
const (
	MatchStatusQueued     = "queued"
	MatchStatusGenerating = "generating"
	MatchStatusSuccess    = "success"
	MatchStatusFailure    = "failure"
)
View Source
const SubmitDefaultTTL = time.Second * 5

Variables

This section is empty.

Functions

func Checks

func Checks(c *kubernetes.Clientset)

func CollectGarbage

func CollectGarbage() error

Checks the queue if there are any keys which have expired. If they have remove them from the queue.

func DisableExpirationMatchState

func DisableExpirationMatchState(ctx context.Context, id MatchId) error

func ExtendExpirationMatchState

func ExtendExpirationMatchState(ctx context.Context, id MatchId, duration time.Duration) error

func GarbageCollector

func GarbageCollector(interval time.Duration, shutdown chan bool)

func GetMatchBot

func GetMatchBot(ctx context.Context, id MatchId, bot string) (string, error)

func ManagerGarbageCollectorStart

func ManagerGarbageCollectorStart(client *kubernetes.Clientset, shutdown <-chan bool)

func ManagerStart

func ManagerStart(client *kubernetes.Clientset)

func MatchExists

func MatchExists(id MatchId) (bool, error)

func RegisterHandles

func RegisterHandles(r *mux.Router)

func SetMatchData

func SetMatchData(ctx context.Context, id MatchId, status, log, replayUrl string) error

Types

type InputBot

type InputBot struct {
	Name      string
	Language  string
	Source    string
	SourceUrl string
}

func MatchBots

func MatchBots(ctx context.Context, id MatchId) ([]InputBot, error)

type Match

type Match struct {
	Id            MatchId
	Game          string
	QueuePosition int
	Bots          []InputBot
	Log           string
	ReplayUrl     string
	Status        string
	Created       time.Time
}

func GetMatch

func GetMatch(ctx context.Context, id MatchId) (Match, error)

func GetMatchState

func GetMatchState(ctx context.Context, id MatchId) (Match, error)

type MatchDoesNotExist

type MatchDoesNotExist struct{}

func (MatchDoesNotExist) Error

func (_ MatchDoesNotExist) Error() string

type MatchId

type MatchId string

func Submit

func Submit(ctx context.Context, game string, bots []InputBot) (MatchId, error)

type MatchStateFailed

type MatchStateFailed struct{}

func (MatchStateFailed) Error

func (_ MatchStateFailed) Error() string

Jump to

Keyboard shortcuts

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