| 1 | package equipo |
| 2 | |
| 3 | import ( |
| 4 | "time" |
| 5 | |
| 6 | "amadan.net/oficina/equipo/internal/equipo/team" |
| 7 | "amadan.net/oficina/equipo/internal/runnerproto" |
| 8 | ) |
| 9 | |
| 10 | type Scope = team.Scope |
| 11 | type ClaimRequest = runnerproto.ClaimRequest |
| 12 | type RunnerRequest = runnerproto.RunnerRequest |
| 13 | |
| 14 | type Assignment = runnerproto.Assignment |
| 15 | type RunnerBrief = runnerproto.RunnerBrief |
| 16 | type ClaimResponse = runnerproto.ClaimResponse |
| 17 | type runnerAssignment struct { |
| 18 | ProtocolVersion int `gorm:"not null;default:1"` |
| 19 | ID string `gorm:"primaryKey"` |
| 20 | TaskID string `gorm:"uniqueIndex:runner_assignment_step"` |
| 21 | StepKey string `gorm:"uniqueIndex:runner_assignment_step"` |
| 22 | WorkspaceKey, TeamID, RunnerID, Person, Selection, Isolation, Kind, State string |
| 23 | Revision int64 `gorm:"uniqueIndex:runner_assignment_step"` |
| 24 | JobID, AttemptID, Fence int64 |
| 25 | ClaimRequest, Brief string |
| 26 | LeaseDeadline time.Time |
| 27 | InvalidationID int64 |
| 28 | } |
| 29 | |
| 30 | func (runnerAssignment) TableName() string { return "runner_assignments" } |
| 31 | |
| 32 | type runnerCleanup struct { |
| 33 | ID string `gorm:"primaryKey"` |
| 34 | AssignmentID, RunnerID, Person, MachineKeyHash, InstanceID, Audience string |
| 35 | TokenHash string `gorm:"uniqueIndex:runner_cleanup_token"` |
| 36 | Fence, AttemptID int64 |
| 37 | ExpiresAt time.Time |
| 38 | } |
| 39 | |
| 40 | func (runnerCleanup) TableName() string { return "runner_cleanups" } |
| 41 | |
| 42 | type runnerObservation struct { |
| 43 | AssignmentID string `gorm:"primaryKey"` |
| 44 | RequestID string `gorm:"primaryKey"` |
| 45 | Operation, PayloadHash, Payload string |
| 46 | At time.Time |
| 47 | } |
| 48 | |
| 49 | func (runnerObservation) TableName() string { return "runner_observations" } |
| 50 | |
| 51 | type runnerRotation struct { |
| 52 | RunnerID string `gorm:"primaryKey"` |
| 53 | AssignmentID, RequestID, State, CredentialID string |
| 54 | } |
| 55 | |
| 56 | func (runnerRotation) TableName() string { return "runner_rotations" } |
| 57 | |
| 58 | type executionAdmissionTicket struct { |
| 59 | ActionID int64 `gorm:"primaryKey;autoIncrement:false"` |
| 60 | JobID int64 `gorm:"not null"` |
| 61 | RequestID string `gorm:"not null"` |
| 62 | AttemptID int64 `gorm:"not null"` |
| 63 | Fence int64 `gorm:"not null"` |
| 64 | Runner, Dispatch, ExpiresAt string `gorm:"not null"` |
| 65 | Incarnation int64 `gorm:"not null"` |
| 66 | } |
| 67 | |
| 68 | func (executionAdmissionTicket) TableName() string { return "admission_tickets" } |
| 69 | |
| 70 | type RunnerValidators = runnerproto.Validators |
| 71 | |
| 72 | // SetRunnerValidators is a startup-only dependency injection seam. |
| 73 | func (e *Execution) SetRunnerValidators(v RunnerValidators) { e.validators = v } |
| 74 | |
| 75 | type CredentialRotation = runnerproto.CredentialRotation |
| 76 | |