Campustream 1.0
A social network MQP for WPI
application/lib/PhlockDB/Phlock/ExecuteOperations.php
Go to the documentation of this file.
00001 <?php
00002 
00003 class Phlock_ExecuteOperations {
00004         
00005         private $client;
00006         private $priority = Flock_Priority::High;
00007         private $operations = array();
00008         
00009         public function __construct(FlockDBClient $client) {
00010                 $this->client = $client;
00011         }
00012         
00013         public function setPriority($priority) {
00014                 $this->priority = $priority;
00015         }
00016         
00017         public function addOperation(Phlock_ExecuteOperation $operation) {
00018                 $this->operations[] = $operation;
00019         }
00020         
00021         public function apply() {
00022                 $this->client->execute($this->toThrift());
00023         }
00024         
00025         public function toThrift() {
00026                 $operations = array_map(function($o) { return $o->toThrift(); }, $this->operations);
00027                 $execute = new Flock_ExecuteOperations(array(
00028                         'operations' => $operations,
00029                         'priority' => $this->priority
00030                 ));
00031                 return $execute;
00032         }
00033 }