Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( PermissionAccountsSelfRead = gorbac.NewStdPermission("accounts.self.read") PermissionAccountsSelfWrite = gorbac.NewStdPermission("accounts.self.write") PermissionAccountsAllRead = gorbac.NewStdPermission("accounts.all.read") PermissionAccountsAllWrite = gorbac.NewStdPermission("accounts.all.write") PermissionProblemsSelfRead = gorbac.NewStdPermission("problems.self.read") PermissionProblemsSelfWrite = gorbac.NewStdPermission("problems.self.write") PermissionProblemsAllRead = gorbac.NewStdPermission("problems.all.read") PermissionProblemsAllWrite = gorbac.NewStdPermission("problems.all.write") PermissionTestCasesSelfRead = gorbac.NewStdPermission("test_cases.self.read") PermissionTestCasesSelfWrite = gorbac.NewStdPermission("test_cases.self.write") PermissionTestCasesAllRead = gorbac.NewStdPermission("test_cases.all.read") PermissionTestCasesAllWrite = gorbac.NewStdPermission("test_cases.all.write") PermissionSubmissionsSelfRead = gorbac.NewStdPermission("submissions.self.read") PermissionSubmissionsSelfWrite = gorbac.NewStdPermission("submissions.self.write") PermissionSubmissionsAllRead = gorbac.NewStdPermission("submissions.all.read") PermissionSubmissionsAllWrite = gorbac.NewStdPermission("submissions.all.write") PermissionSettingsWrite = gorbac.NewStdPermission("settings.write") )
View Source
var WireSet = wire.NewSet( NewHash, NewToken, NewRole, NewAccount, NewProblem, NewTestCase, NewSubmission, NewCompile, NewTestCaseRun, NewJudge, NewSetting, )
Functions ¶
This section is empty.
Types ¶
type Account ¶
type Account interface { CreateFirstAccounts(ctx context.Context) error CreateAccount(ctx context.Context, in *rpc.CreateAccountRequest, token string) (*rpc.CreateAccountResponse, error) GetAccountList(ctx context.Context, in *rpc.GetAccountListRequest, token string) (*rpc.GetAccountListResponse, error) GetAccount(ctx context.Context, in *rpc.GetAccountRequest, token string) (*rpc.GetAccountResponse, error) UpdateAccount(ctx context.Context, in *rpc.UpdateAccountRequest, token string) (*rpc.UpdateAccountResponse, error) CreateSession(ctx context.Context, in *rpc.CreateSessionRequest) (*rpc.CreateSessionResponse, string, time.Time, error) GetSession(ctx context.Context, token string) (*rpc.GetSessionResponse, error) DeleteSession(ctx context.Context, token string) error IsAccountNameTaken(ctx context.Context, accountName string) (bool, error) WithDB(db *gorm.DB) Account }
type Compile ¶
type Compile interface {
Compile(ctx context.Context, content string) (CompileOutput, error)
}
type CompileOutput ¶
type Hash ¶
type Judge ¶
type Judge interface { JudgeSubmission(ctx context.Context, problem *db.Problem, language string, content string) (db.SubmissionResult, error) ScheduleJudgeLocalSubmission(id uint64) JudgeDistributedFirstSubmittedSubmission(ctx context.Context) error }
func NewJudge ¶
func NewJudge( problemDataAccessor db.ProblemDataAccessor, submissionDataAccessor db.SubmissionDataAccessor, testCaseDataAccessor db.TestCaseDataAccessor, problemTestCaseHashDataAccessor db.ProblemTestCaseHashDataAccessor, dockerClient *client.Client, db *gorm.DB, apiClient rpcclient.APIClient, logger *zap.Logger, logicConfig configs.Logic, appArguments utils.Arguments, ) (Judge, error)
type Problem ¶
type Problem interface { CreateProblem(ctx context.Context, in *rpc.CreateProblemRequest, token string) (*rpc.CreateProblemResponse, error) GetProblemSnippetList( ctx context.Context, in *rpc.GetProblemSnippetListRequest, token string, ) (*rpc.GetProblemSnippetListResponse, error) GetProblem(ctx context.Context, in *rpc.GetProblemRequest, token string) (*rpc.GetProblemResponse, error) UpdateProblem(ctx context.Context, in *rpc.UpdateProblemRequest, token string) (*rpc.UpdateProblemResponse, error) DeleteProblem(ctx context.Context, in *rpc.DeleteProblemRequest, token string) error GetAccountProblemSnippetList( ctx context.Context, in *rpc.GetAccountProblemSnippetListRequest, token string, ) (*rpc.GetAccountProblemSnippetListResponse, error) SyncProblemList(ctx context.Context) error WithDB(db *gorm.DB) Problem }
func NewProblem ¶
func NewProblem( token Token, role Role, testCase TestCase, setting Setting, accountDataAccessor db.AccountDataAccessor, problemDataAccessor db.ProblemDataAccessor, problemExampleDataAccessor db.ProblemExampleDataAccessor, problemTestCaseHashDataAccessor db.ProblemTestCaseHashDataAccessor, testCaseDataAccessor db.TestCaseDataAccessor, submissionDataAccessor db.SubmissionDataAccessor, logger *zap.Logger, db *gorm.DB, apiClient rpcclient.APIClient, logicConfig configs.Logic, ) Problem
type Role ¶
type Setting ¶ added in v1.2.0
type Submission ¶
type Submission interface { CreateSubmission( ctx context.Context, in *rpc.CreateSubmissionRequest, token string, ) (*rpc.CreateSubmissionResponse, error) UpdateSubmission( ctx context.Context, in *rpc.UpdateSubmissionRequest, token string, ) (*rpc.UpdateSubmissionResponse, error) GetSubmissionSnippetList( ctx context.Context, in *rpc.GetSubmissionSnippetListRequest, token string, ) (*rpc.GetSubmissionSnippetListResponse, error) GetSubmission(ctx context.Context, in *rpc.GetSubmissionRequest, token string) (*rpc.GetSubmissionResponse, error) DeleteSubmission(ctx context.Context, in *rpc.DeleteSubmissionRequest, token string) error GetAccountSubmissionSnippetList( ctx context.Context, in *rpc.GetAccountSubmissionSnippetListRequest, token string, ) (*rpc.GetAccountSubmissionSnippetListResponse, error) GetProblemSubmissionSnippetList( ctx context.Context, in *rpc.GetProblemSubmissionSnippetListRequest, token string, ) (*rpc.GetProblemSubmissionSnippetListResponse, error) GetAccountProblemSubmissionSnippetList( ctx context.Context, in *rpc.GetAccountProblemSubmissionSnippetListRequest, token string, ) (*rpc.GetAccountProblemSubmissionSnippetListResponse, error) GetAndUpdateFirstSubmittedSubmissionToExecuting( ctx context.Context, token string, ) (*rpc.GetAndUpdateFirstSubmittedSubmissionToExecutingResponse, error) ScheduleSubmittedExecutingSubmissionToJudge(ctx context.Context) error UpdateExecutingSubmissionUpdatedBeforeThresholdToSubmitted(ctx context.Context) error }
func NewSubmission ¶
func NewSubmission( token Token, role Role, judge Judge, setting Setting, accountDataAccessor db.AccountDataAccessor, problemDataAccessor db.ProblemDataAccessor, submissionDataAccessor db.SubmissionDataAccessor, db *gorm.DB, logger *zap.Logger, appArguments utils.Arguments, logicConfig configs.Logic, ) (Submission, error)
type TestCase ¶
type TestCase interface { CalculateProblemTestCaseHash(ctx context.Context, problemID uint64) (string, error) UpsertProblemTestCaseHash(ctx context.Context, problemID uint64) error CreateTestCase(ctx context.Context, in *rpc.CreateTestCaseRequest, token string) (*rpc.CreateTestCaseResponse, error) CreateTestCaseList(ctx context.Context, in *rpc.CreateTestCaseListRequest, token string) error GetProblemTestCaseSnippetList( ctx context.Context, in *rpc.GetProblemTestCaseSnippetListRequest, token string, ) (*rpc.GetProblemTestCaseSnippetListResponse, error) GetTestCase(ctx context.Context, in *rpc.GetTestCaseRequest, token string) (*rpc.GetTestCaseResponse, error) UpdateTestCase(ctx context.Context, in *rpc.UpdateTestCaseRequest, token string) (*rpc.UpdateTestCaseResponse, error) DeleteTestCase(ctx context.Context, in *rpc.DeleteTestCaseRequest, token string) error SyncProblemTestCaseList(ctx context.Context, problemUUID string) error WithDB(db *gorm.DB) TestCase }
func NewTestCase ¶
func NewTestCase( token Token, role Role, setting Setting, problemDataAccessor db.ProblemDataAccessor, testCaseDataAccessor db.TestCaseDataAccessor, problemTestCaseHashDataAccessor db.ProblemTestCaseHashDataAccessor, db *gorm.DB, apiClient rpcclient.APIClient, logger *zap.Logger, logicConfig configs.Logic, ) TestCase
type TestCaseRun ¶
type TestCaseRun interface { Run( ctx context.Context, programFilePath string, input string, timeLimitInMillisecond uint64, memoryLimitInByte uint64, ) (RunOutput, error) }
func NewTestCaseRun ¶
type Token ¶
type Token interface { GetToken(ctx context.Context, accountID uint64) (string, time.Time, error) GetAccountIDAndExpireTime(ctx context.Context, token string) (uint64, time.Time, error) GetAccount(ctx context.Context, token string) (*db.Account, error) WithDB(db *gorm.DB) Token }
func NewToken ¶
func NewToken( accountDataAccessor db.AccountDataAccessor, tokenPublicKeyDataAccessor db.TokenPublicKeyDataAccessor, tokenPublicKeyCache cache.TokenPublicKey, tokenConfig configs.Token, logger *zap.Logger, ) (Token, error)
Click to show internal directories.
Click to hide internal directories.