Skip to content

Commit

Permalink
update executor's interface method names to make them more significant
Browse files Browse the repository at this point in the history
  • Loading branch information
susana-garcia authored and ccremer committed Nov 25, 2020
1 parent 219d4f2 commit a0595f7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions executor/generic.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,11 +108,11 @@ func (g *generic) GetRepository() string {
return g.Repository
}

func (g *generic) GetNamespace() string {
func (g *generic) GetJobNamespace() string {
return g.Obj.GetMetaObject().GetNamespace()
}

func (g *generic) GetType() string {
func (g *generic) GetJobType() string {
return g.Obj.GetType()
}

Expand Down
12 changes: 6 additions & 6 deletions queue/execution.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ type Executor interface {
// Logger returns the logger in the job's context so we can
// Associate the logs with the actual job.
Logger() logr.Logger
// GetType() returns the type of the CDR that the job will execute
GetType() string
// GetNamespace() returns the namespace of the CDR that the job will execute
GetNamespace() string
// GetJobType() returns the type of the CDR that the job will execute
GetJobType() string
// GetJobNamespace() returns the namespace of the CDR that the job will execute
GetJobNamespace() string
// GetName() string
GetRepository() string
// TODO: ability to mark job as skipped && metric for that
Expand Down Expand Up @@ -72,7 +72,7 @@ func (eq *ExecutionQueue) Add(exec Executor) {
eq.queues[repository] = newPriorityQueue()
}
eq.queues[repository].add(exec)
eq.incQueueGauge(exec.GetNamespace(), exec.GetType())
eq.incQueueGauge(exec.GetJobNamespace(), exec.GetJobType())
}

// Get returns and removes and executor from the given repository. If the
Expand All @@ -83,7 +83,7 @@ func (eq *ExecutionQueue) Get(repository string) Executor {
entry := eq.queues[repository].get()
if eq.queues[repository].Len() == 0 {
delete(eq.queues, repository)
eq.decQueueGauge(entry.GetNamespace(), entry.GetType())
eq.decQueueGauge(entry.GetJobNamespace(), entry.GetJobType())
}
return entry
}
Expand Down

0 comments on commit a0595f7

Please sign in to comment.