Rename root, api and sdk module paths (imports, go.mod, go_package, ldflags, build scripts, buf configs) and regenerate protobuf/gateway code with the project's pinned toolchain. Wire identifiers unchanged. api gets a local replace for sdk; root/api/sdk require v0.1.0. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
44 lines
934 B
Go
44 lines
934 B
Go
// Copyright IBM Corp. 2020, 2026
|
|
// SPDX-License-Identifier: BUSL-1.1
|
|
|
|
package job
|
|
|
|
import (
|
|
"repo.anhonesthost.net/CyberCoveLLC/threshold/internal/scheduler/job/store"
|
|
"google.golang.org/protobuf/proto"
|
|
)
|
|
|
|
// Run represents an instance of a job that is either actively running or has failed in some way.
|
|
type Run struct {
|
|
*store.JobRun
|
|
tableName string `gorm:"-"`
|
|
}
|
|
|
|
func (j *Run) clone() *Run {
|
|
cp := proto.Clone(j.JobRun)
|
|
return &Run{
|
|
JobRun: cp.(*store.JobRun),
|
|
tableName: j.tableName,
|
|
}
|
|
}
|
|
|
|
func allocRun() *Run {
|
|
return &Run{
|
|
JobRun: &store.JobRun{},
|
|
}
|
|
}
|
|
|
|
// TableName returns the table name for the job run.
|
|
func (j *Run) TableName() string {
|
|
if j.tableName != "" {
|
|
return j.tableName
|
|
}
|
|
return "job_run"
|
|
}
|
|
|
|
// SetTableName sets the table name. If the caller attempts to
|
|
// set the name to "" the name will be reset to the default name "job_run".
|
|
func (j *Run) SetTableName(n string) {
|
|
j.tableName = n
|
|
}
|