static void Main(string[] args) { if (args.Length < 2) { Console.Error.WriteLine("Usage: <program> <db address:port> <shard ID."); Environment.Exit(-1); } try { BaseDB.Connect(new Address(args[0])); ShardID id = ShardID.Decode(args[1]); var rs = BaseDB.TryGetAddress(id); while (rs.IsEmpty) { Thread.Sleep(1000); rs = BaseDB.TryGetAddress(id); } Console.WriteLine(rs.PeerAddress); } catch (Exception ex) { Console.Error.WriteLine(ex); Environment.Exit(-1); } }
static void Main(string[] args) { try { int at = 0; var dbHost = new Address(args[at++]); BaseDB.Connect(dbHost); //,"admin","1234"); Log.Message("Updating timing..."); BaseDB.Timing = new BaseDB.TimingContainer() { startTime = (DateTime.Now + TimeSpan.FromMinutes(5)).ToString() /*, msGenerationBudget = 30000*/ }; Log.Message("Setting up scenario..."); bool success = BaseDB.TryPullGlobalConfig(3); CreateScenario(args[at++]); Log.Message("Scenario set up. Shutting down"); } catch (Exception ex) { Console.Error.WriteLine(ex); Environment.Exit(-1); } }
static void Main(string[] args) { if (args.Length < 2) { throw new ArgumentException("Missing arguments. Usage: Executable <DBHost> <ShardID>"); } int at = 0; var dbHost = new Address(args[at++]); BaseDB.Connect(dbHost); //,"admin","1234"); ShardID addr = ShardID.Decode(args[at++]); BaseDB.BeginPullConfig(addr.XYZ); iface = new Consensus.Interface(addr, -1, 0, true, Consensus.Interface.ThreadOperations.CheckConfiguration, new Notify(error => { Log.Error(error); iface.Dispose(); Log.Message("Shutting down"); }, () => iface)); iface.Notify.OnConsensusChange(Consensus.Status.NotEstablished, null); iface.AwaitClosure(); }
public void ConnectTo(Address dbHost, ShardID id) { BaseDB.Connect(dbHost); BaseDB.GetAddress(id, addr => AddSector(addr.ObserverAddress, addr.ShardID)); }