The main Kernel.ts class (965 lines) handles too many responsibilities and should be split into focused manager classes organized by domain.
Proposed Structure
src/
├── liveslots/
│ ├── kernel-marshal.ts
│ ├── meter-control.ts
│ └── types.ts
│
├── vats/
│ ├── VatManager.ts
│ ├── VatHandle.ts
│ ├── VatSupervisor.ts
│ ├── VatSyscall.ts
│ ├── SubclusterManager.ts
│ ├── syscall.ts
│ └── types.ts
│
├── remotes/
│ ├── RemoteManager.ts
│ ├── RemoteHandle.ts
│ ├── network.ts
│ ├── remote-comms.ts
│ ├── OcapURLManager.ts
│ └── types.ts
│
├── garbage-collection/
│ ├── garbage-collection.ts
│ ├── gc-engine.ts
│ ├── gc-finalize.ts
│ └── gc-handlers.ts
│
├── store/
├── rpc/
├── utils/
│
├── Kernel.ts
├── KernelQueue.ts
├── KernelRouter.ts
├── types.ts
└── index.ts
Key Extractions
- VatManager - Vat lifecycle operations (
launchVat, terminateVat, restartVat, etc.)
- SubclusterManager - Subcluster operations (
launchSubcluster, reloadSubcluster, etc.)
- RemoteManager - Remote connections (
initRemoteComms, sendRemoteMessage, etc.)
- OcapURLManager - OCAP URL issuing/redemption
Benefits
- Single responsibility principle
- Improved testability and maintainability
- Cleaner separation of concerns
- Easier code navigation
The refactored Kernel class becomes a lightweight coordinator that delegates to specialized managers, making the codebase more maintainable and extensible.
The main
Kernel.tsclass (965 lines) handles too many responsibilities and should be split into focused manager classes organized by domain.Proposed Structure
Key Extractions
launchVat,terminateVat,restartVat, etc.)launchSubcluster,reloadSubcluster, etc.)initRemoteComms,sendRemoteMessage, etc.)Benefits
The refactored
Kernelclass becomes a lightweight coordinator that delegates to specialized managers, making the codebase more maintainable and extensible.