GetInstance returns a copy of the loop instance data for a specific PRD.
(name string)
| 445 | |
| 446 | // GetInstance returns a copy of the loop instance data for a specific PRD. |
| 447 | func (m *Manager) GetInstance(name string) *LoopInstance { |
| 448 | m.mu.RLock() |
| 449 | instance, exists := m.instances[name] |
| 450 | m.mu.RUnlock() |
| 451 | |
| 452 | if !exists { |
| 453 | return nil |
| 454 | } |
| 455 | |
| 456 | instance.mu.Lock() |
| 457 | defer instance.mu.Unlock() |
| 458 | |
| 459 | // Return a copy to avoid race conditions |
| 460 | return &LoopInstance{ |
| 461 | Name: instance.Name, |
| 462 | PRDPath: instance.PRDPath, |
| 463 | WorktreeDir: instance.WorktreeDir, |
| 464 | Branch: instance.Branch, |
| 465 | State: instance.State, |
| 466 | Iteration: instance.Iteration, |
| 467 | StartTime: instance.StartTime, |
| 468 | Error: instance.Error, |
| 469 | } |
| 470 | } |
| 471 | |
| 472 | // GetAllInstances returns a snapshot of all loop instances. |
| 473 | func (m *Manager) GetAllInstances() []*LoopInstance { |
no outgoing calls