83 lines
2.7 KiB
Markdown
83 lines
2.7 KiB
Markdown
# Coordinator Refactoring Status
|
|
|
|
## ✅ Completed
|
|
|
|
1. **SupervisorTransport trait created** - `lib/clients/supervisor`
|
|
2. **Mycelium transport moved** - `lib/clients/supervisor/src/transports/mycelium.rs`
|
|
3. **SupervisorClient made generic** - `SupervisorClient<T: SupervisorTransport>`
|
|
4. **Coordinator client updated** - Uses `SupervisorClient<MyceliumTransport>`
|
|
5. **Job type migrated** - Now uses `hero_job::Job`
|
|
6. **Job validation added** - `job.validate_required_fields()`, `job.validate_context()`
|
|
7. **Old validation removed** - Removed `validate_job()` from service.rs
|
|
|
|
## 🔄 In Progress - Coordinator Code Updates
|
|
|
|
The coordinator needs updates throughout to use the new Job API:
|
|
|
|
### Required Changes:
|
|
|
|
1. **Method calls → Field access**:
|
|
- `job.id()` → `job.id`
|
|
- `job.caller_id()` → `job.caller_id`
|
|
- `job.context_id()` → `job.context_id`
|
|
|
|
2. **Field name changes**:
|
|
- `job.script` → `job.payload`
|
|
- `job.script_type` → `job.executor`
|
|
|
|
3. **ID type changes**:
|
|
- Change from `u32` to `String` throughout
|
|
- Update HashMap keys, function signatures, database queries
|
|
|
|
4. **Status handling**:
|
|
- Remove `job.status()` calls
|
|
- Status is tracked separately in coordinator state
|
|
|
|
5. **Workflow fields** (depends, prerequisites):
|
|
- These don't exist on `hero_job::Job`
|
|
- Stored in `JobSummary` for DAG operations
|
|
- Need separate storage/tracking
|
|
|
|
### Files Needing Updates (~41 errors):
|
|
|
|
- `service.rs` - Job CRUD operations, method→field changes
|
|
- `dag.rs` - Workflow orchestration, depends/prerequisites handling
|
|
- `rpc.rs` - RPC handlers, ID type changes
|
|
- `router.rs` - Job routing, already partially updated
|
|
- Database queries - ID type changes
|
|
|
|
### Next Steps:
|
|
|
|
1. Update `service.rs` - Replace method calls with field access
|
|
2. Update `dag.rs` - Handle workflow fields from JobSummary
|
|
3. Update `rpc.rs` - Handle String IDs
|
|
4. Update database layer - String ID support
|
|
5. Test compilation
|
|
6. Integration testing
|
|
|
|
## Architecture Summary
|
|
|
|
```
|
|
lib/clients/supervisor/
|
|
├── src/
|
|
│ ├── lib.rs (SupervisorClient<T>, HttpTransport, trait)
|
|
│ └── transports/
|
|
│ ├── mod.rs
|
|
│ └── mycelium.rs (MyceliumClient, MyceliumTransport, SupervisorHub)
|
|
|
|
bin/coordinator/
|
|
├── models/
|
|
│ └── job.rs (re-exports hero_job::Job with validation)
|
|
├── service.rs (needs updates)
|
|
├── dag.rs (needs updates)
|
|
├── rpc.rs (needs updates)
|
|
└── router.rs (updated)
|
|
```
|
|
|
|
## Notes
|
|
|
|
- `hero_job::Job` uses String UUIDs for IDs
|
|
- Workflow orchestration (depends, prerequisites) handled by JobSummary
|
|
- Job status tracked separately in coordinator state machine
|
|
- Validation methods added to Job model for coordinator use
|