Exemplo n.º 1
0
        private void FindInitialEntries()
        {
            List <Tuple <string, int> > entries = _leaderCloudMakefiles [_partition].FindMatchingEntries("");

            foreach (Tuple <string, int> entry in entries)
            {
                _dependencyStructure.AddEntry(entry);
            }
        }
Exemplo n.º 2
0
        private void MemberJoin(Vsync.Group vsyncGroup)
        {
            string memberDirectory         = _name;
            string eventName               = _name + "/new_node";
            string cloudMakeDirectory      = memberDirectory + Path.DirectorySeparatorChar + "CloudMake";
            string cloudMakeConfigFilename = cloudMakeDirectory + Path.DirectorySeparatorChar.ToString() +
                                             "config.xml";
            List <Tuple <string, int> > newNodeEntries;
            HashSet <int> nameSet, cloudMakeConfigSet;

            if (_localCloudMakefile == null)
            {
                throw new Exception("CloudMakeLocal: There is no CloudMakefile.");
            }
            nameSet = _localCloudMakefile.Compatible(memberDirectory);
            if (nameSet.Count > 0)
            {
                Directory.SetCurrentDirectory(_name);
#if DEBUG
                CloudManager.WriteLine(_debugFilename, "Create Directory: " + memberDirectory);
#endif
                Directory.CreateDirectory(memberDirectory);
                cloudMakeConfigSet = _localCloudMakefile.Compatible(cloudMakeConfigFilename, nameSet);
                if (cloudMakeConfigSet.Count > 0)
                {
#if DEBUG
                    CloudManager.WriteLine(_debugFilename, "Create Directory: " + cloudMakeDirectory);
                    CloudManager.WriteLine(_debugFilename, "Added CloudMake Config: " + cloudMakeConfigFilename);
#endif
                    Directory.CreateDirectory(cloudMakeDirectory);
                    _dependencyStructure.AddCloudMakeConfigFile(cloudMakeConfigFilename);
                }
                Directory.SetCurrentDirectory(_curDirectory);
                newNodeEntries = _localCloudMakefile.FindMatchingEntries(eventName);
                if (newNodeEntries.Count > 1)
                {
                    throw new Exception("It is impossible for a NEW_NODE event to have more than one corresponding " +
                                        "DFA.");
                }
                if (newNodeEntries.Count == 1)
                {
                    _dependencyStructure.AddEntry(newNodeEntries [0]);
                    _dependencyStructure.AddTokenToEntry(newNodeEntries [0].Item1);
#if DEBUG
                    CloudManager.WriteLine(_debugFilename, "Added Token to New Node Event: " + eventName);
#endif
                    RunCloudMake(vsyncGroup);
                }
            }
            else
            {
                throw new Exception("CloudMakeLocal: There is no matching entry for " + _name + "/new_node");
            }
        }