| 1 | package conversation |
| 2 | |
| 3 | import ( |
| 4 | "amadan.net/oficina/equipo/internal/equipo/team" |
| 5 | "amadan.net/oficina/equipo/internal/runnerproto" |
| 6 | "context" |
| 7 | "gorm.io/gorm" |
| 8 | "time" |
| 9 | ) |
| 10 | |
| 11 | type CoordinatorClaim = runnerproto.CoordinatorClaim |
| 12 | type RunnerPrincipal = runnerproto.RunnerPrincipal |
| 13 | type Assignment = runnerproto.Assignment |
| 14 | type RunnerRequest = runnerproto.RunnerRequest |
| 15 | type Engine struct { |
| 16 | Defaults func(context.Context, *gorm.DB, runnerproto.Selection) error |
| 17 | Copy func(string) string |
| 18 | Rebind func(*gorm.DB, Actor, BindingRecord) (BindingRecord, error) |
| 19 | ContextLimit error |
| 20 | ContextUnavailable error |
| 21 | ContextSource ContextSource |
| 22 | ToolCopy runnerproto.CoordinatorToolCopy |
| 23 | Tools ToolOperations |
| 24 | Selection func(*gorm.DB, BindingRecord) (runnerproto.Selection, error) |
| 25 | CheckProject func(*gorm.DB, string, int64, runnerproto.Selection) (int64, error) |
| 26 | StoreError func(error) error |
| 27 | WaitingConnection error |
| 28 | NotFound error |
| 29 | |
| 30 | Core *team.Store |
| 31 | Atomic func(context.Context, func(context.Context, *gorm.DB) error) error |
| 32 | Conversation func(*gorm.DB) *Store |
| 33 | Project func(*gorm.DB, string, int64, runnerproto.Selection) (int64, runnerproto.SourceSnapshot, error) |
| 34 | RunnerCurrent func(*gorm.DB, RunnerPrincipal) error |
| 35 | Audit func(*gorm.DB, BindingRecord, string, string) error |
| 36 | Now func() time.Time |
| 37 | Events func(context.Context, Assignment, RunnerRequest) error |
| 38 | Receipt func(context.Context, Assignment, RunnerRequest) (team.Receipt, error) |
| 39 | Containment func(context.Context, Assignment, RunnerRequest) error |
| 40 | Delivery func(context.Context, CoordinatorClaim, runnerproto.Event) (string, team.Receipt, error) |
| 41 | Redact func([]byte) []byte |
| 42 | Invalid, Conflict, Forbidden, Unavailable error |
| 43 | } |
| 44 | type EventRecord struct { |
| 45 | Key string `gorm:"primaryKey"` |
| 46 | AssignmentID string `gorm:"index:runner_event_assignment"` |
| 47 | StreamKey string `gorm:"index:runner_event_timeline,priority:1"` |
| 48 | Epoch string `gorm:"index:runner_event_timeline,priority:2"` |
| 49 | Sequence *int64 `gorm:"index:runner_event_timeline,priority:3"` |
| 50 | Kind, ContentHash, Body, Isolation string |
| 51 | } |
| 52 | |
| 53 | func (EventRecord) TableName() string { return "runner_events" } |
| 54 | |