/// <exception cref="System.IO.IOException"/> private MiniJournalCluster(MiniJournalCluster.Builder b) { Log.Info("Starting MiniJournalCluster with " + b.numJournalNodes + " journal nodes" ); if (b.baseDir != null) { this.baseDir = new FilePath(b.baseDir); } else { this.baseDir = new FilePath(MiniDFSCluster.GetBaseDirectory()); } nodes = new MiniJournalCluster.JNInfo[b.numJournalNodes]; for (int i = 0; i < b.numJournalNodes; i++) { if (b.format) { FilePath dir = GetStorageDir(i); Log.Debug("Fully deleting JN directory " + dir); FileUtil.FullyDelete(dir); } JournalNode jn = new JournalNode(); jn.SetConf(CreateConfForNode(b, i)); jn.Start(); nodes[i] = new MiniJournalCluster.JNInfo(jn); } }
/// <exception cref="System.Exception"/> /// <exception cref="System.IO.IOException"/> public virtual void RestartJournalNode(int i) { MiniJournalCluster.JNInfo info = nodes[i]; JournalNode jn = info.node; Configuration conf = new Configuration(jn.GetConf()); if (jn.IsStarted()) { jn.StopAndJoin(0); } conf.Set(DFSConfigKeys.DfsJournalnodeRpcAddressKey, NetUtils.GetHostPortString(info .ipcAddr)); string uri = info.httpServerURI; if (uri.StartsWith("http://")) { conf.Set(DFSConfigKeys.DfsJournalnodeHttpAddressKey, Sharpen.Runtime.Substring(uri , ("http://".Length))); } else { if (info.httpServerURI.StartsWith("https://")) { conf.Set(DFSConfigKeys.DfsJournalnodeHttpsAddressKey, Sharpen.Runtime.Substring(uri , ("https://".Length))); } } JournalNode newJN = new JournalNode(); newJN.SetConf(conf); newJN.Start(); info.node = newJN; }
private void DrawNode(JournalNode node) { GUILayout.BeginArea(node.GetRect()); Texture2D texture = null; foreach (Texture2D t in _picsInFolder) { if (node.GetImageName().Equals(t.name)) { texture = t; } } GUI.DrawTexture(new Rect(0, 0, _nodeOuterRect.width, _nodeOuterRect.height), texture, ScaleMode.StretchToFill, true, 0f); GUILayout.Space(10); GUILayout.BeginHorizontal(); int order = node.GetOrder(); if (order > 1) { if (GUILayout.Button(" < ", GUILayout.Width(15), GUILayout.Height(15))) { NodeOrder(node, order, false); } } else { GUILayout.Label("", GUILayout.Width(0)); } if (order < _mainJournal.GetAllNodes().Count) { if (GUILayout.Button(" > ", GUILayout.Width(15), GUILayout.Height(15))) { NodeOrder(node, order, true); } } else { GUILayout.Label("", GUILayout.Width(0)); } GUILayout.EndHorizontal(); GUILayout.Space(220); GUILayout.Label("Order: " + node.GetOrder(), _orderStyle, GUILayout.Width(70)); GUILayout.EndArea(); }
private void MouseKeyboardEvents() { if (Event.current.type == EventType.MouseDown && Event.current.type != EventType.MouseDrag) { _scrollViewOffsetDrag = Event.current.mousePosition + _scrollViewPosition; JournalNode jNode = GetMouseOnDialogue(); if (jNode != null) { Selection.activeObject = jNode; } } else if (Event.current.type == EventType.MouseDrag) { _scrollViewPosition = _scrollViewOffsetDrag - Event.current.mousePosition; GUI.changed = true; } }
private void DrawLinesAsConnections(JournalNode nodeTemp) { JournalNode nextNode = null; foreach (JournalNode node in _mainJournal.GetAllNodes()) { if (node.GetOrder() == (nodeTemp.GetOrder() + 1)) { nextNode = node; } } if (nextNode != null) { LineConnectionPosition(new Vector2(nodeTemp.GetRect().xMax, nodeTemp.GetRect().center.y), new Vector2(nextNode.GetRect().xMin, nextNode.GetRect().center.y)); } }
private JournalNode GetMouseOnDialogue() { JournalNode foundNode = null; Vector2 temp = _scrollViewPosition; // if(!isOffset) temp = Vector2.zero; if (_mainJournal != null) { foreach (JournalNode node in _mainJournal.GetAllNodes()) { if (node.GetRect().Contains(Event.current.mousePosition + temp)) { foundNode = node; } } } return(foundNode); }
public virtual void TestStartStop() { Configuration conf = new Configuration(); MiniJournalCluster c = new MiniJournalCluster.Builder(conf).Build(); try { URI uri = c.GetQuorumJournalURI("myjournal"); string[] addrs = uri.GetAuthority().Split(";"); NUnit.Framework.Assert.AreEqual(3, addrs.Length); JournalNode node = c.GetJournalNode(0); string dir = node.GetConf().Get(DFSConfigKeys.DfsJournalnodeEditsDirKey); NUnit.Framework.Assert.AreEqual(new FilePath(MiniDFSCluster.GetBaseDirectory() + "journalnode-0").GetAbsolutePath(), dir); } finally { c.Shutdown(); } }
private void NodeOrder(JournalNode node, int order, bool isForwardSwap) { JournalNode nextNode = null; int newOrder = 1; foreach (JournalNode nodeT in _mainJournal.GetAllNodes()) { newOrder = isForwardSwap ? order + 1 : order - 1; if (nodeT.GetOrder() == newOrder) { nextNode = nodeT; } } node.SetOrder(newOrder); if (nextNode != null) { nextNode.SetOrder(order); } }
private JNInfo(JournalNode node) { this.node = node; this.ipcAddr = node.GetBoundIpcAddress(); this.httpServerURI = node.GetHttpServerURI(); }