public static CommandRequest FromWire(Wire.Raft.CommandRequest wire) { return(new CommandRequest { Tag = CommandTag.FromWire(wire.Tag), Event = Uid.FromWire(wire.Event) }); }
public static CommandTag FromWire(Wire.Raft.CommandTag wire) { return(new CommandTag { Uid = Uid.FromWire(wire.Uid), Type = (CommandType)wire.Type }); }
public static LogResponse FromWire(Wire.Raft.LogResponse wire) { return(new LogResponse { Success = wire.Success, Leader = Uid.FromWire(wire.Leader), Entries = wire.Entries.Select(entryWire => Entry.FromWire(entryWire)).ToList() }); }
public static Peer FromWire(Wire.Sgx.SgxConfig.Types.Peer wire) { return(new Peer { Uid = Uid.FromWire(wire.Uid), Event = Uid.FromWire(wire.Event), Addr = Addr.FromWire(wire.Addr) }); }
public static SgxConfig FromWire(Wire.Sgx.SgxConfig wire) { return(new SgxConfig { Self = Uid.FromWire(wire.Self), Workflow = Workflow.FromWire(wire.Workflow), Peers = wire.Peers.Select(Peer.FromWire).ToArray() }); }
public static CommandReponse FromWire(Wire.Raft.CommandResponse wire) { return(new CommandReponse { Tag = CommandTag.FromWire(wire.Tag), Success = wire.Success, Leader = Uid.FromWire(wire.Leader) }); }
public static Entry FromWire(Wire.Raft.Entry wire) { return(new Entry { Event = Uid.FromWire(wire.Event), Index = wire.Index, Term = wire.Term, Tag = CommandTag.FromWire(wire.Tag) }); }
public void TestUid() { Uid uid = new Uid { Part1 = ulong.MaxValue, Part2 = ulong.MinValue }; Assert.That(Uid.FromWire(uid.ToWire()), Is.EqualTo(uid)); }
public static void CollectGlobalHistory(CollectGlobalHistoryOptions opts) { CoreLib.Messages.Config.SgxConfig config = null; if (!string.IsNullOrEmpty(opts.ConfigPath) && !TryReadConfig(opts.ConfigPath, out config)) { return; } if (!TryConnectRpc(opts, out SgxDaemon.SgxDaemonClient client)) { return; } System.Console.WriteLine("Collecting history..."); Snapshot snapshot; try { snapshot = client.History(new Empty(), new CallOptions(deadline: DateTime.MaxValue)); } catch (Exception ex) { System.Console.WriteLine($"Error while collecting history: {ex.Message}"); return; } // Convert snapshot data structure var result = new List <Tuple <Uid, Entry[]> >(); foreach (var part in snapshot.Parts) { var local = new Tuple <Uid, Entry[]>( Uid.FromWire(part.Cluster), part.Entries.Select(Entry.FromWire).ToArray()); result.Add(local); } var cs = new CheapShot(result); foreach (EventExecution exec in cs.GlobalHistory) { string eventName = config?.Workflow.Events.First(e => e.Uid == exec.Event).Name; System.Console.WriteLine(); System.Console.ForegroundColor = ConsoleColor.DarkGreen; System.Console.WriteLine($"exec {exec.ExecutionID}"); System.Console.ResetColor(); System.Console.WriteLine($"euid {exec.Event}"); if (eventName != null) { System.Console.WriteLine($"event {eventName}"); } } }