- go.mod module name
- All 714 import references across 289 Go files
- VERSION: 0.1.0
- CI DB names: switchboard_core_{ci,dev,test}
- Docker image: gobha/switchboard-core
- Test fixtures: JWT issuer, repo names
- .env.example, docker-compose container name
- Compiles clean (go build exit 0)
38 lines
1.5 KiB
Go
38 lines
1.5 KiB
Go
package store
|
|
|
|
import (
|
|
"context"
|
|
|
|
"switchboard-core/models"
|
|
)
|
|
|
|
// TaskStore manages task definitions and run history.
|
|
type TaskStore interface {
|
|
// Task CRUD
|
|
Create(ctx context.Context, t *models.Task) error
|
|
GetByID(ctx context.Context, id string) (*models.Task, error)
|
|
Update(ctx context.Context, id string, patch models.TaskPatch) error
|
|
Delete(ctx context.Context, id string) error
|
|
ListByOwner(ctx context.Context, ownerID string) ([]models.Task, error)
|
|
ListByTeam(ctx context.Context, teamID string) ([]models.Task, error)
|
|
ListAll(ctx context.Context) ([]models.Task, error)
|
|
|
|
// Trigger lookup (inbound webhooks)
|
|
GetByTriggerToken(ctx context.Context, token string) (*models.Task, error)
|
|
|
|
// Scheduler queries
|
|
ClaimDueTask(ctx context.Context) (*models.Task, error)
|
|
SetNextRun(ctx context.Context, id string, nextRun interface{}) error
|
|
SetLastRun(ctx context.Context, id string) error
|
|
IncrementRunCount(ctx context.Context, id string) error
|
|
|
|
// Run history
|
|
CreateRun(ctx context.Context, r *models.TaskRun) error
|
|
CreateRunExclusive(ctx context.Context, taskID string) (*models.TaskRun, error)
|
|
UpdateRun(ctx context.Context, id string, status string, tokensUsed, toolCalls, wallClock int, errMsg string) error
|
|
TransitionRunStatus(ctx context.Context, id string, status string) error
|
|
GetActiveRun(ctx context.Context, taskID string) (*models.TaskRun, error)
|
|
GetQueuedRun(ctx context.Context, taskID string) (*models.TaskRun, error)
|
|
ListRuns(ctx context.Context, taskID string, limit int) ([]models.TaskRun, error)
|
|
}
|