Documentation ¶
Overview ¶
Package db provides a database storage layer.
Index ¶
- type CommitModule
- type DB
- func (d *DB) Close() error
- func (d *DB) CreateTask(ctx context.Context, worker string, s entity.TaskSpec) (*entity.Task, error)
- func (d *DB) FindBenchmarkByUUID(ctx context.Context, id uuid.UUID) (*entity.Benchmark, error)
- func (d *DB) FindCommitBySHA(ctx context.Context, sha string) (*entity.Commit, error)
- func (d *DB) FindDataFileByUUID(ctx context.Context, id uuid.UUID) (*entity.DataFile, error)
- func (d *DB) FindModuleByUUID(ctx context.Context, id uuid.UUID) (*entity.Module, error)
- func (d *DB) FindPackageByUUID(ctx context.Context, id uuid.UUID) (*entity.Package, error)
- func (d *DB) FindPropertiesByUUID(ctx context.Context, id uuid.UUID) (entity.Properties, error)
- func (d *DB) FindResultByUUID(ctx context.Context, id uuid.UUID) (*entity.Result, error)
- func (d *DB) FindTaskByUUID(ctx context.Context, id uuid.UUID) (*entity.Task, error)
- func (d *DB) ListBenchmarkPoints(ctx context.Context, b *entity.Benchmark, n int) (entity.Points, error)
- func (d *DB) ListBenchmarkResults(ctx context.Context, b *entity.Benchmark) ([]*entity.Result, error)
- func (d *DB) ListCommitModulesWithoutCompleteTasks(ctx context.Context, worker string, n int) ([]CommitModule, error)
- func (d *DB) ListModulePackages(ctx context.Context, m *entity.Module) ([]*entity.Package, error)
- func (d *DB) ListModules(ctx context.Context) ([]*entity.Module, error)
- func (d *DB) ListPackageBenchmarks(ctx context.Context, p *entity.Package) ([]*entity.Benchmark, error)
- func (d *DB) ListTasksWithStatus(ctx context.Context, statuses []entity.TaskStatus) ([]*entity.Task, error)
- func (d *DB) ListWorkerTasksPending(ctx context.Context, worker string) ([]*entity.Task, error)
- func (d *DB) ListWorkerTasksWithStatus(ctx context.Context, worker string, statuses []entity.TaskStatus) ([]*entity.Task, error)
- func (d *DB) MostRecentCommit(ctx context.Context) (*entity.Commit, error)
- func (d *DB) RecordTaskDataUpload(ctx context.Context, id uuid.UUID, f *entity.DataFile) error
- func (d *DB) SetLogger(l *zap.Logger)
- func (d *DB) StoreBenchmark(ctx context.Context, b *entity.Benchmark) error
- func (d *DB) StoreCommit(ctx context.Context, c *entity.Commit) error
- func (d *DB) StoreCommits(ctx context.Context, cs []*entity.Commit) error
- func (d *DB) StoreDataFile(ctx context.Context, f *entity.DataFile) error
- func (d *DB) StoreModule(ctx context.Context, m *entity.Module) error
- func (d *DB) StorePackage(ctx context.Context, p *entity.Package) error
- func (d *DB) StoreProperties(ctx context.Context, p entity.Properties) error
- func (d *DB) StoreResult(ctx context.Context, r *entity.Result) error
- func (d *DB) TransitionTaskStatus(ctx context.Context, id uuid.UUID, from []entity.TaskStatus, ...) error
- func (d *DB) TruncateNonStatic(ctx context.Context) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CommitModule ¶
CommitModule represents a commit module pair.
type DB ¶
type DB struct {
// contains filtered or unexported fields
}
DB provides database access.
func (*DB) CreateTask ¶
func (d *DB) CreateTask(ctx context.Context, worker string, s entity.TaskSpec) (*entity.Task, error)
CreateTask creates a new task.
func (*DB) FindBenchmarkByUUID ¶
FindBenchmarkByUUID looks up the given benchmark in the database.
func (*DB) FindCommitBySHA ¶
FindCommitBySHA looks up the given commit in the database.
func (*DB) FindDataFileByUUID ¶
FindDataFileByUUID looks up the given data file in the database.
func (*DB) FindModuleByUUID ¶
FindModuleByUUID looks up the given module in the database.
func (*DB) FindPackageByUUID ¶
FindPackageByUUID looks up the given package in the database.
func (*DB) FindPropertiesByUUID ¶
FindPropertiesByUUID looks up the given properties in the database.
func (*DB) FindResultByUUID ¶
FindResultByUUID looks up a result in the database given the ID.
func (*DB) FindTaskByUUID ¶
FindTaskByUUID looks up the given task in the database.
func (*DB) ListBenchmarkPoints ¶
func (d *DB) ListBenchmarkPoints(ctx context.Context, b *entity.Benchmark, n int) (entity.Points, error)
ListBenchmarkPoints returns n most recent timeseries points for the given benchmark.
func (*DB) ListBenchmarkResults ¶
func (d *DB) ListBenchmarkResults(ctx context.Context, b *entity.Benchmark) ([]*entity.Result, error)
ListBenchmarkResults returns all results for the given benchmark.
func (*DB) ListCommitModulesWithoutCompleteTasks ¶
func (d *DB) ListCommitModulesWithoutCompleteTasks(ctx context.Context, worker string, n int) ([]CommitModule, error)
ListCommitModulesWithoutCompleteTasks searches for n recent commit module pairs without completed tasks for the given worker.
func (*DB) ListModulePackages ¶
ListModulePackages returns all packages in the given module.
func (*DB) ListModules ¶
ListModules returns all modules.
func (*DB) ListPackageBenchmarks ¶
func (d *DB) ListPackageBenchmarks(ctx context.Context, p *entity.Package) ([]*entity.Benchmark, error)
ListPackageBenchmarks returns all benchmarks in the given package.
func (*DB) ListTasksWithStatus ¶
func (d *DB) ListTasksWithStatus(ctx context.Context, statuses []entity.TaskStatus) ([]*entity.Task, error)
ListTasksWithStatus returns tasks in the given states.
func (*DB) ListWorkerTasksPending ¶
ListWorkerTasksPending returns tasks assigned to a worker in a pending state.
func (*DB) ListWorkerTasksWithStatus ¶
func (d *DB) ListWorkerTasksWithStatus(ctx context.Context, worker string, statuses []entity.TaskStatus) ([]*entity.Task, error)
ListWorkerTasksWithStatus returns tasks assigned to a worker in the given states.
func (*DB) MostRecentCommit ¶
MostRecentCommit returns the most recent commit by commit time.
func (*DB) RecordTaskDataUpload ¶
RecordTaskDataUpload inserts the given datafile and associates it with the supplied task ID.
func (*DB) StoreBenchmark ¶
StoreBenchmark writes benchmark to the database.
func (*DB) StoreCommit ¶
StoreCommit writes commit to the database.
func (*DB) StoreCommits ¶
StoreCommits writes the given commits to the database.
func (*DB) StoreDataFile ¶
StoreDataFile writes the data file to the database.
func (*DB) StoreModule ¶
StoreModule writes module to the database.
func (*DB) StorePackage ¶
StorePackage writes package to the database.
func (*DB) StoreProperties ¶
StoreProperties writes properties to the database.
func (*DB) StoreResult ¶
StoreResult writes a result to the database.
func (*DB) TransitionTaskStatus ¶
func (d *DB) TransitionTaskStatus(ctx context.Context, id uuid.UUID, from []entity.TaskStatus, to entity.TaskStatus) error
TransitionTaskStatus performs the given task status transition.