Exemplo n.º 1
0
        public override TupleStream Execute(TupleStream tuple)
        {
            this.TupleCount++;
            var output = new List <string>();

            output.Add(this.TupleCount.ToString());
            return(new TupleStream(output));
        }
Exemplo n.º 2
0
        public void Execute(TupleStream tuple)
        {
            var output = this.Operator.Execute(tuple);

            if (output != null)
            {
                SendDownstreamDelegate caller = new SendDownstreamDelegate(this.Client.SendDownstream);
                IAsyncResult           result = caller.BeginInvoke(output, new AsyncCallback(this.SendDownstreamCallback), null);
            }
            return;
        }
Exemplo n.º 3
0
        public override TupleStream Execute(TupleStream tuple)
        {
            var elem = tuple.Elems[this.FieldNumber];

            if (!InputTuples.ContainsKey(elem))
            {
                InputTuples.Add(elem, 1);
                return(tuple);
            }
            InputTuples[elem]++;
            return(null);
        }
Exemplo n.º 4
0
        public void SendDownstream(TupleStream tuple)
        {
            // Console.WriteLine("Remote synchronous and asynchronous delegates.");
            // Console.WriteLine(new String('-', 80));
            // Console.WriteLine();
            Console.WriteLine(this.OutputReplicas.Count);
            foreach (Replica rep in this.OutputReplicas)
            {
                Uri nodeUri = rep.resolve(tuple);
                Console.WriteLine(String.Format("Sending {0} to {1}", tuple.Elems[0], nodeUri));
                IDictionary prop = new Hashtable();
                prop["name"]            = Guid.NewGuid().ToString();
                prop["typeFilterLevel"] = TypeFilterLevel.Full;
                TcpChannel channel = new TcpChannel(prop, null, null);
                ChannelServices.RegisterChannel(channel, false);

                Node op = (Node)Activator.GetObject(
                    typeof(Node),
                    nodeUri.ToString() + "/op");

                op.Execute(tuple);
                // This delegate is an asynchronous delegate. Two delegates must
                // be created. The first is the system-defined AsyncCallback
                // delegate, which references the method that the remote type calls
                // back when the remote method is done.

                AsyncCallback RemoteCallback = new AsyncCallback(this.RemoteCallBack);

                // Create the delegate to the remote method you want to use
                // asynchronously.
                OperatorDelegate RemoteDel = new OperatorDelegate(op.Execute);

                // Start the method call. Note that execution on this
                // thread continues immediately without waiting for the return of
                // the method call.
                IAsyncResult RemAr = RemoteDel.BeginInvoke(tuple, RemoteCallback, null);
            }
            // WaitHandle.WaitAll(AsyncHandles);
            // handleNum = 0;
        }
Exemplo n.º 5
0
 public Uri resolve(TupleStream tuple)
 {
     return(this.RoutingPolicy.resolveRouting(this, tuple));
 }
Exemplo n.º 6
0
 public override TupleStream Execute(TupleStream tuple)
 {
     Console.WriteLine("Executing dup " + tuple.Elems[0]);
     return(tuple);
 }
Exemplo n.º 7
0
 abstract public TupleStream Execute(TupleStream tuple);
Exemplo n.º 8
0
 public override TupleStream Execute(TupleStream tuple)
 {
     return(tuple);
 }
Exemplo n.º 9
0
        public Uri resolveRouting(Replica replica, TupleStream tuple)
        {
            var index = Math.Abs(tuple.Elems[this.fieldNum].GetHashCode() % replica.Nodes.Count);

            return(replica.Nodes[index]);
        }
Exemplo n.º 10
0
        public Uri resolveRouting(Replica replica, TupleStream tuple)
        {
            int r = this.RandomGen.Next(0, replica.Nodes.Count);

            return(replica.Nodes[r]);
        }
Exemplo n.º 11
0
 public Uri resolveRouting(Replica replica, TupleStream tuple)
 {
     return(replica.Nodes[0]);
 }