configs

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var WireSet = wire.NewSet(
	NewConfig,
	wire.FieldsOf(new(Config), "Log"),
	wire.FieldsOf(new(Config), "Database"),
	wire.FieldsOf(new(Config), "Cache"),
	wire.FieldsOf(new(Config), "Auth"),
	wire.FieldsOf(new(Config), "HTTP"),
	wire.FieldsOf(new(Config), "Logic"),
	wire.FieldsOf(new(Auth), "Hash"),
	wire.FieldsOf(new(Auth), "Token"),
)

Functions

This section is empty.

Types

type Auth

type Auth struct {
	Hash  Hash
	Token Token
}

type Cache added in v1.2.0

type Cache struct {
	Size uint64 `yaml:"size"`
}

type Compile

type Compile struct {
	Image           string   `yaml:"image"`
	CommandTemplate []string `yaml:"command_template"`
	Timeout         string   `yaml:"timeout"`
	CPUQuota        int64    `yaml:"cpu_quota"`
	Memory          string   `yaml:"memory"`
	WorkingDir      string   `yaml:"working_dir"`
	SourceFileName  string   `yaml:"source_file_name"`
	ProgramFileName string   `yaml:"program_file_name"`
}

func (Compile) GetMemoryInBytes

func (c Compile) GetMemoryInBytes() (uint64, error)

func (Compile) GetTimeoutDuration

func (c Compile) GetTimeoutDuration() (time.Duration, error)

type Config

type Config struct {
	Log      Log      `yaml:"log"`
	Database Database `yaml:"database"`
	Cache    Cache    `yaml:"cache"`
	Auth     Auth     `yaml:"auth"`
	HTTP     HTTP     `yaml:"http"`
	Logic    Logic    `yaml:"logic"`
}

func NewConfig

func NewConfig(filePath ConfigFilePath) (Config, error)

type ConfigFilePath

type ConfigFilePath string

type Database

type Database struct {
	FilePath string `yaml:"file_path"`
}

type FirstAccount

type FirstAccount struct {
	AccountName string `yaml:"account_name"`
	DisplayName string `yaml:"display_name"`
	Password    string `yaml:"password"`
}

type FirstAccounts

type FirstAccounts struct {
	Admin  FirstAccount `yaml:"admin"`
	Worker FirstAccount `yaml:"worker"`
}

type HTTP

type HTTP struct {
	Address string `yaml:"address"`
}

type Hash

type Hash struct {
	Cost int `yaml:"cost"`
}

type Judge

type Judge struct {
	Schedule             string     `yaml:"schedule"`
	Languages            []Language `yaml:"languages"`
	SubmissionRetryDelay string     `yaml:"submission_retry_delay"`
}

func (Judge) GetSubmissionRetryDelayDuration

func (j Judge) GetSubmissionRetryDelayDuration() (time.Duration, error)

type Language

type Language struct {
	Value       string      `yaml:"value"`
	Name        string      `yaml:"name"`
	Compile     *Compile    `yaml:"compile"`
	TestCaseRun TestCaseRun `yaml:"test_case_run"`
}

type Log

type Log struct {
	Level string `yaml:"level"`
}

type Logic

type Logic struct {
	FirstAccounts              FirstAccounts              `yaml:"first_accounts"`
	ProblemTestCaseHash        ProblemTestCaseHash        `yaml:"problem_test_case_hash"`
	Judge                      Judge                      `yaml:"judge"`
	SyncProblem                SyncProblem                `yaml:"sync_problem"`
	RevertExecutingSubmissions RevertExecutingSubmissions `yaml:"revert_executing_submissions"`
}

type ProblemTestCaseHash

type ProblemTestCaseHash struct {
	BatchSize uint64 `yaml:"batch_size"`
}

type RevertExecutingSubmissions

type RevertExecutingSubmissions struct {
	Schedule  string `yaml:"schedule"`
	Threshold string `yaml:"threshold"`
}

func (RevertExecutingSubmissions) GetThresholdDuration

func (u RevertExecutingSubmissions) GetThresholdDuration() (time.Duration, error)

type SyncProblem

type SyncProblem struct {
	Schedule                        string `yaml:"schedule"`
	GetProblemSnippetListBatchSize  uint64 `yaml:"get_problem_snippet_list_batch_size"`
	GetTestCaseSnippetListBatchSize uint64 `yaml:"get_test_case_snippet_list_batch_size"`
}

type TestCaseRun

type TestCaseRun struct {
	Image           string   `yaml:"image"`
	CommandTemplate []string `yaml:"command_template"`
	CPUQuota        int64    `yaml:"cpu_quota"`
	WorkingDir      string   `yaml:"working_dir"`
}

type Token

type Token struct {
	ExpiresIn                   string `yaml:"expires_in"`
	RegenerateTokenBeforeExpiry string `yaml:"regenerate_token_before_expiry"`
}

func (Token) GetExpiresInDuration

func (t Token) GetExpiresInDuration() (time.Duration, error)

func (Token) GetRegenerateTokenBeforeExpiryDuration

func (t Token) GetRegenerateTokenBeforeExpiryDuration() (time.Duration, error)

Jump to

Keyboard shortcuts

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