diff options
| author | nsfisis <nsfisis@gmail.com> | 2025-03-08 10:51:41 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2025-03-08 10:51:41 +0900 |
| commit | a7ce31249948e4f0c1950de93f3c4f7cdda51cf4 (patch) | |
| tree | c4c740f0cccd15f825596f7a115f3b8f8eb8ffa7 /worker/models.go | |
| parent | 7f4d16dca85263dcbc7b3bb29f5fc50f4371739d (diff) | |
| parent | c06d46eae30c9468535fb6af5e9b822acadbbdb6 (diff) | |
| download | phperkaigi-2025-albatross-a7ce31249948e4f0c1950de93f3c4f7cdda51cf4.tar.gz phperkaigi-2025-albatross-a7ce31249948e4f0c1950de93f3c4f7cdda51cf4.tar.zst phperkaigi-2025-albatross-a7ce31249948e4f0c1950de93f3c4f7cdda51cf4.zip | |
Merge branch 'phperkaigi-2025'
Diffstat (limited to 'worker/models.go')
| -rw-r--r-- | worker/models.go | 86 |
1 files changed, 0 insertions, 86 deletions
diff --git a/worker/models.go b/worker/models.go deleted file mode 100644 index 4a318d0..0000000 --- a/worker/models.go +++ /dev/null @@ -1,86 +0,0 @@ -package main - -import ( - "errors" - "time" -) - -const ( - resultSuccess = "success" - resultCompileError = "compile_error" - resultRuntimeError = "runtime_error" - resultTimeout = "timeout" - resultInternalError = "internal_error" -) - -var ( - errInvalidMaxDuration = errors.New("'max_duration_ms' must be positive") -) - -type swiftCompileRequestData struct { - MaxDurationMilliseconds int `json:"max_duration_ms"` - Code string `json:"code"` - CodeHash string `json:"code_hash"` -} - -func (req *swiftCompileRequestData) maxDuration() time.Duration { - return time.Duration(req.MaxDurationMilliseconds) * time.Millisecond -} - -func (req *swiftCompileRequestData) validate() error { - if req.MaxDurationMilliseconds <= 0 { - return errInvalidMaxDuration - } - return nil -} - -type swiftCompileResponseData struct { - Status string `json:"status"` - Stdout string `json:"stdout"` - Stderr string `json:"stderr"` -} - -type wasmCompileRequestData struct { - MaxDurationMilliseconds int `json:"max_duration_ms"` - CodeHash string `json:"code_hash"` -} - -type wasmCompileResponseData struct { - Status string `json:"status"` - Stdout string `json:"stdout"` - Stderr string `json:"stderr"` -} - -func (req *wasmCompileRequestData) maxDuration() time.Duration { - return time.Duration(req.MaxDurationMilliseconds) * time.Millisecond -} - -func (req *wasmCompileRequestData) validate() error { - if req.MaxDurationMilliseconds <= 0 { - return errInvalidMaxDuration - } - return nil -} - -type testRunRequestData struct { - MaxDurationMilliseconds int `json:"max_duration_ms"` - CodeHash string `json:"code_hash"` - Stdin string `json:"stdin"` -} - -func (req *testRunRequestData) maxDuration() time.Duration { - return time.Duration(req.MaxDurationMilliseconds) * time.Millisecond -} - -func (req *testRunRequestData) validate() error { - if req.MaxDurationMilliseconds <= 0 { - return errInvalidMaxDuration - } - return nil -} - -type testRunResponseData struct { - Status string `json:"status"` - Stdout string `json:"stdout"` - Stderr string `json:"stderr"` -} |
