public SimProc(ServiceId id, SimMachine machine, int procId, TaskFactory scheduler) { _cts = new CancellationTokenSource(); Id = id; Machine = machine; _procId = procId; _scheduler = scheduler; }
public SimService(SimMachine machine, ServiceId id, Func <IEnv, IEngine> launcher) { Id = id; _launcher = launcher; _machine = machine; _scheduler = new SimScheduler(machine.Runtime, id); _factory = new TaskFactory(_scheduler); }
public SimCluster(ClusterDef cluster, SimRuntime runtime) { Runtime = runtime; Rand = Runtime.Rand; // we register each link as a network service foreach (var(id, def) in cluster.Routes) { var service = new ServiceId($"network:{id.Source}->{id.Destinaton}"); var scheduler = new SimScheduler(Runtime, service); Routes.Add(id, new SimRoute(scheduler, this, id, def)); } foreach (var machine in cluster.Services.GroupBy(i => i.Key.Machine)) { var m = new SimMachine(machine.Key, runtime, this); foreach (var pair in machine) { m.Install(pair.Key, pair.Value); } Machines.Add(machine.Key, m); } }
public bool ResolveHost(string name, out SimMachine m) { return(Machines.TryGetValue(name, out m)); }