import { Machine, MachineInit } from "../Independents/Machine.js" import { CHostOwnershipRecord, IHost } from "../Engine/Host.js" import { Datagram } from "../Independents/Datagram/datagram-types.js" import { HostNameTemplate } from "../Independents/DNS/HostName.js" import { SpawningError } from "../Engine/Gateway.js" import { Either, Left } from "../Independents/util/Either.js"; export class DocumentHost implements IHost { aliases2: string[] = []; machine: Machine; constructor(alias: string | null, public machineInit: MachineInit) { this.machine = new Machine(machineInit); } async onReceiveDatagram(datagram: Datagram) { } allocateChildName(hostTemplate: HostNameTemplate, secret: string): Either { return Left(new SpawningError(hostTemplate.nameTemplate, `Document hosts cannot spawn children.`)); } get childHosts(): { [key: string]: CHostOwnershipRecord; } { return {} } addChild(name: string, secret: string, registred: boolean, gateway: string): CHostOwnershipRecord { throw new Error("Cannot add child hosts to document hosts") } }