예제 #1
0
 /**
  * @param AdapterInterface $adapter
  * @param int $maxSimultaneousOperations
  */
 public function __construct(AdapterInterface $adapter, $maxSimultaneousOperations = 133)
 {
     $this->loop = $adapter->getLoop();
     $this->adapter = $adapter;
     $this->callQueue = new \SplQueue();
     $this->maxSimultaneousOperations = $maxSimultaneousOperations;
 }
 /**
  * @param AdapterInterface $adapter
  * @param float $interval
  */
 public function __construct(AdapterInterface $adapter, $interval = self::DEFAULT_INTERVAL)
 {
     $this->loop = $adapter->getLoop();
     $this->adapter = $adapter;
     $this->callQueue = new \SplQueue();
     $this->interval = $interval;
 }
예제 #3
0
 /**
  * @param $sourceStream
  * @return Stream
  */
 protected function processLsRecursiveContents($sourceStream)
 {
     $stream = new ObjectStream();
     $closeCount = 0;
     $sourceStream->on('data', function (NodeInterface $node) use(&$closeCount, $stream) {
         if ($node instanceof Directory || $node instanceof File) {
             $stream->emit('data', [$node]);
         }
         if ($node instanceof Directory) {
             $this->streamLsIntoStream($node, $stream, $closeCount);
         }
     });
     $sourceStream->on('end', function () use(&$closeCount, $stream) {
         $this->adapter->getLoop()->addPeriodicTimer(0.01, function (TimerInterface $timer) use(&$closeCount, $stream) {
             if ($closeCount === 0) {
                 $timer->cancel();
                 $stream->close();
             }
         });
     });
     return $stream;
 }
예제 #4
0
 /**
  * @param AdapterInterface $adapter
  */
 public function __construct(AdapterInterface $adapter)
 {
     $this->loop = $adapter->getLoop();
     $this->adapter = $adapter;
 }
예제 #5
0
 /**
  * @param AdapterInterface $adapter
  */
 public function __construct(AdapterInterface $adapter)
 {
     $this->loop = $adapter->getLoop();
     $this->adapter = $adapter;
     $this->callQueue = new \SplQueue();
 }