public override TupleStream Execute(TupleStream tuple) { this.TupleCount++; var output = new List <string>(); output.Add(this.TupleCount.ToString()); return(new TupleStream(output)); }
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; }
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); }
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; }
public Uri resolve(TupleStream tuple) { return(this.RoutingPolicy.resolveRouting(this, tuple)); }
public override TupleStream Execute(TupleStream tuple) { Console.WriteLine("Executing dup " + tuple.Elems[0]); return(tuple); }
abstract public TupleStream Execute(TupleStream tuple);
public override TupleStream Execute(TupleStream tuple) { return(tuple); }
public Uri resolveRouting(Replica replica, TupleStream tuple) { var index = Math.Abs(tuple.Elems[this.fieldNum].GetHashCode() % replica.Nodes.Count); return(replica.Nodes[index]); }
public Uri resolveRouting(Replica replica, TupleStream tuple) { int r = this.RandomGen.Next(0, replica.Nodes.Count); return(replica.Nodes[r]); }
public Uri resolveRouting(Replica replica, TupleStream tuple) { return(replica.Nodes[0]); }