Ejemplo n.º 1
0
        public async Task <bool> AddInNode()
        {
            Console.WriteLine(await GetName() + "Add new nodes");
            var new_key   = ++Program.num_of_operators;
            var new_grain = GrainFactory.GetGrain <IOperator>(new_key);
            var out_nodes = await children[0].GetOutNodes();
            await new_grain.Init(out_nodes, true);

            float percentage = 1.0f / (children.Count + 1);

            for (int i = 0; i < children.Count; ++i)
            {
                await new_grain.ReceivePartialWorkLoad(await children[i].GetPartialWorkLoad(percentage));
            }
            children.Add(new_grain);
            if (prev != null)
            {
                await prev.AddOutNode(new_grain);
            }
            return(true);
        }