Move execution storage to new package
This commit is contained in:
@ -10,6 +10,7 @@ import (
|
||||
nomadApi "github.com/hashicorp/nomad/api"
|
||||
"gitlab.hpi.de/codeocean/codemoon/poseidon/internal/nomad"
|
||||
"gitlab.hpi.de/codeocean/codemoon/poseidon/pkg/dto"
|
||||
"gitlab.hpi.de/codeocean/codemoon/poseidon/pkg/execution"
|
||||
"io"
|
||||
"strings"
|
||||
"time"
|
||||
@ -18,9 +19,6 @@ import (
|
||||
// ContextKey is the type for keys in a request context.
|
||||
type ContextKey string
|
||||
|
||||
// ExecutionID is an id for an execution in a Runner.
|
||||
type ExecutionID string
|
||||
|
||||
const (
|
||||
// runnerContextKey is the key used to store runners in context.Context.
|
||||
runnerContextKey ContextKey = "runner"
|
||||
@ -39,7 +37,7 @@ type Runner interface {
|
||||
// MappedPorts returns the mapped ports of the runner.
|
||||
MappedPorts() []*dto.MappedPort
|
||||
|
||||
ExecutionStorage
|
||||
execution.Storage
|
||||
InactivityTimer
|
||||
|
||||
// ExecuteInteractively runs the given execution request and forwards from and to the given reader and writers.
|
||||
@ -62,7 +60,7 @@ type Runner interface {
|
||||
|
||||
// NomadJob is an abstraction to communicate with Nomad environments.
|
||||
type NomadJob struct {
|
||||
ExecutionStorage
|
||||
execution.Storage
|
||||
InactivityTimer
|
||||
id string
|
||||
portMappings []nomadApi.PortMapping
|
||||
@ -75,11 +73,11 @@ func NewNomadJob(id string, portMappings []nomadApi.PortMapping,
|
||||
apiClient nomad.ExecutorAPI, manager Manager,
|
||||
) *NomadJob {
|
||||
job := &NomadJob{
|
||||
id: id,
|
||||
portMappings: portMappings,
|
||||
api: apiClient,
|
||||
ExecutionStorage: NewLocalExecutionStorage(),
|
||||
manager: manager,
|
||||
id: id,
|
||||
portMappings: portMappings,
|
||||
api: apiClient,
|
||||
Storage: execution.NewLocalStorage(),
|
||||
manager: manager,
|
||||
}
|
||||
job.InactivityTimer = NewInactivityTimer(job, manager)
|
||||
return job
|
||||
|
Reference in New Issue
Block a user