Skip to content

refactor: Extract manager classes to improve maintainability #632

@sirtimid

Description

@sirtimid

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.

Metadata

Metadata

Assignees

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions