| 1 | package equipo |
| 2 | |
| 3 | import ( |
| 4 | "slices" |
| 5 | "time" |
| 6 | |
| 7 | "amadan.net/oficina/equipo/internal/equipo/planning" |
| 8 | "amadan.net/oficina/equipo/internal/equipo/team" |
| 9 | "amadan.net/oficina/equipo/internal/runnerproto" |
| 10 | ) |
| 11 | |
| 12 | // ConnectionRouting is an assertion by the authenticated runner about its |
| 13 | // operator-managed binding file and supported provider routing. It contains |
| 14 | // opaque account identity and a home hash, never credentials or home paths. |
| 15 | type ConnectionRouting = runnerproto.ConnectionRouting |
| 16 | |
| 17 | type ConnectionReport = runnerproto.ConnectionReport |
| 18 | |
| 19 | type Connection = planning.Connection |
| 20 | type connectionRecord = planning.ConnectionRecord |
| 21 | type ConnectionChoice = planning.ConnectionChoice |
| 22 | type connectionChoiceRecord = planning.ConnectionChoiceRecord |
| 23 | |
| 24 | type IsolationAcknowledgement struct { |
| 25 | ID string `gorm:"primaryKey"` |
| 26 | ConnectionID string `gorm:"index:connection_ack"` |
| 27 | Owner, Provider, ProviderVersion, PaseoVersion, IsolationConfigHash string |
| 28 | AcknowledgedAt time.Time |
| 29 | ConnectionRevision int64 |
| 30 | } |
| 31 | type isolationAcknowledgementRecord struct { |
| 32 | IsolationAcknowledgement `gorm:"embedded"` |
| 33 | OwnerRevision int64 |
| 34 | RevokedAt *time.Time |
| 35 | } |
| 36 | |
| 37 | func (isolationAcknowledgementRecord) TableName() string { return "isolation_acknowledgements" } |
| 38 | |
| 39 | // ConnectionInvalidation is a durable request for the assignment service to |
| 40 | // fence pending work and contain affected attempts before reuse. Selection is |
| 41 | // not a dispatch reservation; Task 8 must recheck inside admission. |
| 42 | type ConnectionInvalidation struct { |
| 43 | ID int64 |
| 44 | ConnectionID string `gorm:"index:connection_invalidation"` |
| 45 | Revision int64 |
| 46 | Reason string |
| 47 | At time.Time |
| 48 | } |
| 49 | |
| 50 | type Selection = runnerproto.Selection |
| 51 | |
| 52 | // WithVerifiedIsolationTuples captures a copy at construction. Reports cannot |
| 53 | // extend this release-owned list. The production default is empty. |
| 54 | func WithVerifiedIsolationTuples(tuples []team.IsolationTuple) StoreOption { |
| 55 | captured := slices.Clone(tuples) |
| 56 | return func(s *Store) { s.verifiedIsolation = slices.Clone(captured) } |
| 57 | } |
| 58 | |