Rename execution.Storage to Storer to follow Go convention

Interfaces should be named like someone actively doing a thing. Thus,
instead of Storage we use Storer.
This commit is contained in:
sirkrypt0
2021-07-29 16:02:28 +02:00
parent bd14b1e181
commit 4ad470a5c4
4 changed files with 8 additions and 8 deletions

View File

@ -37,7 +37,7 @@ type Runner interface {
// MappedPorts returns the mapped ports of the runner. // MappedPorts returns the mapped ports of the runner.
MappedPorts() []*dto.MappedPort MappedPorts() []*dto.MappedPort
execution.Storage execution.Storer
InactivityTimer InactivityTimer
// ExecuteInteractively runs the given execution request and forwards from and to the given reader and writers. // ExecuteInteractively runs the given execution request and forwards from and to the given reader and writers.
@ -60,7 +60,7 @@ type Runner interface {
// NomadJob is an abstraction to communicate with Nomad environments. // NomadJob is an abstraction to communicate with Nomad environments.
type NomadJob struct { type NomadJob struct {
execution.Storage execution.Storer
InactivityTimer InactivityTimer
id string id string
portMappings []nomadApi.PortMapping portMappings []nomadApi.PortMapping
@ -76,7 +76,7 @@ func NewNomadJob(id string, portMappings []nomadApi.PortMapping,
id: id, id: id,
portMappings: portMappings, portMappings: portMappings,
api: apiClient, api: apiClient,
Storage: execution.NewLocalStorage(), Storer: execution.NewLocalStorage(),
manager: manager, manager: manager,
} }
job.InactivityTimer = NewInactivityTimer(job, manager) job.InactivityTimer = NewInactivityTimer(job, manager)

View File

@ -119,7 +119,7 @@ func (s *ExecuteInteractivelyTestSuite) SetupTest() {
s.manager.On("Return", mock.Anything).Return(nil) s.manager.On("Return", mock.Anything).Return(nil)
s.runner = &NomadJob{ s.runner = &NomadJob{
Storage: execution.NewLocalStorage(), Storer: execution.NewLocalStorage(),
InactivityTimer: s.timer, InactivityTimer: s.timer,
id: tests.DefaultRunnerID, id: tests.DefaultRunnerID,
api: s.apiMock, api: s.apiMock,
@ -225,7 +225,7 @@ func (s *UpdateFileSystemTestSuite) SetupTest() {
s.timer.On("ResetTimeout").Return() s.timer.On("ResetTimeout").Return()
s.timer.On("TimeoutPassed").Return(false) s.timer.On("TimeoutPassed").Return(false)
s.runner = &NomadJob{ s.runner = &NomadJob{
Storage: execution.NewLocalStorage(), Storer: execution.NewLocalStorage(),
InactivityTimer: s.timer, InactivityTimer: s.timer,
id: tests.DefaultRunnerID, id: tests.DefaultRunnerID,
api: s.apiMock, api: s.apiMock,

View File

@ -7,8 +7,8 @@ import (
// ID is an identifier for an execution. // ID is an identifier for an execution.
type ID string type ID string
// Storage stores executions. // Storer stores executions.
type Storage interface { type Storer interface {
// Add adds a runner to the storage. // Add adds a runner to the storage.
// It overwrites the existing execution if an execution with the same id already exists. // It overwrites the existing execution if an execution with the same id already exists.
Add(id ID, executionRequest *dto.ExecutionRequest) Add(id ID, executionRequest *dto.ExecutionRequest)

View File

@ -12,7 +12,7 @@ type localStorage struct {
executions map[ID]*dto.ExecutionRequest executions map[ID]*dto.ExecutionRequest
} }
// NewLocalStorage responds with an Storage implementation. // NewLocalStorage responds with an Storer implementation.
// This implementation stores the data thread-safe in the local application memory. // This implementation stores the data thread-safe in the local application memory.
func NewLocalStorage() *localStorage { func NewLocalStorage() *localStorage {
return &localStorage{ return &localStorage{