Ejemplo n.º 1
0
 /**
  * Allows subscribing new map-reduce tasks to the handler.
  * @param task an object representing the map-reduce task.
  */
 public void SubscribeTask(MapReduceTask task)
 {
     lock (_sync) {
         if (_name_to_task.ContainsKey(task.TaskName))
         {
             throw new Exception(String.Format("Map reduce task name: {0} already registered.", task.TaskName));
         }
         _name_to_task[task.TaskName] = task;
     }
 }
Ejemplo n.º 2
0
 /**
  * Constructor
  * @param node local node
  * @param state RPC related state.
  * @param task map-reduce task.
  * @param args arguments to the map reduce task.
  */
 public MapReduceComputation(Node node, object state,
                             MapReduceTask task,
                             MapReduceArgs args)
 {
     _node             = node;
     _rpc              = node.Rpc;
     _mr_request_state = state;
     _mr_task          = task;
     _mr_args          = args;
     //Here is our state variable:
     _state  = new State();
     _result = State.DEFAULT_OBJ;
 }
Ejemplo n.º 3
0
        /**
         * Constructor
         * @param n local node
         */
        public MapReduceHandler(Node n)
        {
            _node         = n;
            _rpc          = n.Rpc;
            _name_to_task = new Dictionary <string, MapReduceTask>();
            _sync         = new object();
            //Set up some basic tasks:
            var basetasks = new MapReduceTask[] {
                new MapReduceBoundedBroadcast(_node),
                new MapReduceGreedy(_node),
                new MapReduceListConcat(_node),
            };

            foreach (MapReduceTask mrt in basetasks)
            {
                SubscribeTask(mrt);
            }
        }
Ejemplo n.º 4
0
 /** 
  * Constructor
  * @param node local node
  * @param state RPC related state.
  * @param task map-reduce task.
  * @param args arguments to the map reduce task.
  */
 public MapReduceComputation(Node node, object state, 
                             MapReduceTask task,
                             MapReduceArgs args)
 {
   _node = node;
   _rpc = node.Rpc;
   _mr_request_state = state;
   _mr_task = task;
   _mr_args = args;
   //Here is our state variable:
   _state = new State();
   _result = State.DEFAULT_OBJ;
 }
Ejemplo n.º 5
0
 /**
  * Allows subscribing new map-reduce tasks to the handler.
  * @param task an object representing the map-reduce task.
  */
 public void SubscribeTask(MapReduceTask task) {
   lock(_sync) {
     if (_name_to_task.ContainsKey(task.TaskName)) {
       throw new Exception(String.Format("Map reduce task name: {0} already registered.", task.TaskName));
     }
     _name_to_task[task.TaskName] = task;
   }
 }
Ejemplo n.º 6
0
 /**
  * Constructor
  * @param n local node
  */
 public MapReduceHandler(Node n) {
   _node = n;
   _rpc = n.Rpc;
   _name_to_task = new Dictionary<string, MapReduceTask>();
   _sync = new object();
   //Set up some basic tasks:
   var basetasks = new MapReduceTask[]{
     new MapReduceBoundedBroadcast(_node),
     new MapReduceGreedy(_node),
     new MapReduceListConcat(_node),
   };
   foreach(MapReduceTask mrt in basetasks) {
     SubscribeTask(mrt);
   }
 }