From 4ad470a5c4af0d7d05ecd6a55c771abff2212751 Mon Sep 17 00:00:00 2001 From: sirkrypt0 <22522058+sirkrypt0@users.noreply.github.com> Date: Thu, 29 Jul 2021 16:02:28 +0200 Subject: [PATCH] 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. --- internal/runner/runner.go | 6 +++--- internal/runner/runner_test.go | 4 ++-- pkg/execution/execution.go | 4 ++-- pkg/execution/local_storage.go | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/internal/runner/runner.go b/internal/runner/runner.go index 2eb5b5c..4a86919 100644 --- a/internal/runner/runner.go +++ b/internal/runner/runner.go @@ -37,7 +37,7 @@ type Runner interface { // MappedPorts returns the mapped ports of the runner. MappedPorts() []*dto.MappedPort - execution.Storage + execution.Storer InactivityTimer // 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. type NomadJob struct { - execution.Storage + execution.Storer InactivityTimer id string portMappings []nomadApi.PortMapping @@ -76,7 +76,7 @@ func NewNomadJob(id string, portMappings []nomadApi.PortMapping, id: id, portMappings: portMappings, api: apiClient, - Storage: execution.NewLocalStorage(), + Storer: execution.NewLocalStorage(), manager: manager, } job.InactivityTimer = NewInactivityTimer(job, manager) diff --git a/internal/runner/runner_test.go b/internal/runner/runner_test.go index e1a007b..7e90393 100644 --- a/internal/runner/runner_test.go +++ b/internal/runner/runner_test.go @@ -119,7 +119,7 @@ func (s *ExecuteInteractivelyTestSuite) SetupTest() { s.manager.On("Return", mock.Anything).Return(nil) s.runner = &NomadJob{ - Storage: execution.NewLocalStorage(), + Storer: execution.NewLocalStorage(), InactivityTimer: s.timer, id: tests.DefaultRunnerID, api: s.apiMock, @@ -225,7 +225,7 @@ func (s *UpdateFileSystemTestSuite) SetupTest() { s.timer.On("ResetTimeout").Return() s.timer.On("TimeoutPassed").Return(false) s.runner = &NomadJob{ - Storage: execution.NewLocalStorage(), + Storer: execution.NewLocalStorage(), InactivityTimer: s.timer, id: tests.DefaultRunnerID, api: s.apiMock, diff --git a/pkg/execution/execution.go b/pkg/execution/execution.go index 33a1315..5a59e8e 100644 --- a/pkg/execution/execution.go +++ b/pkg/execution/execution.go @@ -7,8 +7,8 @@ import ( // ID is an identifier for an execution. type ID string -// Storage stores executions. -type Storage interface { +// Storer stores executions. +type Storer interface { // Add adds a runner to the storage. // It overwrites the existing execution if an execution with the same id already exists. Add(id ID, executionRequest *dto.ExecutionRequest) diff --git a/pkg/execution/local_storage.go b/pkg/execution/local_storage.go index df2a7b1..7e756d1 100644 --- a/pkg/execution/local_storage.go +++ b/pkg/execution/local_storage.go @@ -12,7 +12,7 @@ type localStorage struct { 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. func NewLocalStorage() *localStorage { return &localStorage{