Skip to content

Commit

Permalink
Remove traces of call invokers
Browse files Browse the repository at this point in the history
  • Loading branch information
WyriHaximus committed May 4, 2019
1 parent 4e2af61 commit a9ad131
Show file tree
Hide file tree
Showing 21 changed files with 194 additions and 1,029 deletions.
8 changes: 0 additions & 8 deletions src/AdapterInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,6 @@ public function getLoop();
*/
public function setFilesystem(FilesystemInterface $filesystem);

/**
* Set the call invoker for this adapter.
*
* @param CallInvokerInterface $invoker
* @return void
*/
public function setInvoker(CallInvokerInterface $invoker);

/**
* Call the underlying filesystem.
*
Expand Down
32 changes: 0 additions & 32 deletions src/CallInvokerInterface.php

This file was deleted.

37 changes: 11 additions & 26 deletions src/ChildProcess/Adapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,6 @@ class Adapter implements AdapterInterface
*/
protected $permissionFlagResolver;

/**
* @var CallInvokerInterface
*/
protected $invoker;

/**
* @var array
*/
Expand All @@ -85,7 +80,6 @@ public function __construct(LoopInterface $loop, array $options = [])
{
$this->loop = $loop;

$this->invoker = \React\Filesystem\getInvoker($this, $options, 'invoker', 'React\Filesystem\InstantInvoker');
$this->openFileLimiter = new OpenFileLimiter(\React\Filesystem\getOpenFileLimit($options));
$this->permissionFlagResolver = new PermissionFlagResolver();

Expand Down Expand Up @@ -145,15 +139,6 @@ public function setFilesystem(FilesystemInterface $filesystem)
];
}

/**
* @param CallInvokerInterface $invoker
* @return void
*/
public function setInvoker(CallInvokerInterface $invoker)
{
$this->invoker = $invoker;
}

/**
* @param string $function
* @param array $args
Expand All @@ -176,7 +161,7 @@ public function callFilesystem($function, $args, $errorResultCode = -1)
*/
public function chmod($path, $mode)
{
return $this->invoker->invokeCall('chmod', [
return $this->callFilesystem('chmod', [
'path' => $path,
'mode' => decoct($mode),
]);
Expand All @@ -189,7 +174,7 @@ public function chmod($path, $mode)
*/
public function mkdir($path, $mode = self::CREATION_MODE)
{
return $this->invoker->invokeCall('mkdir', [
return $this->callFilesystem('mkdir', [
'path' => $path,
'mode' => decoct($this->permissionFlagResolver->resolve($mode)),
]);
Expand Down Expand Up @@ -271,7 +256,7 @@ public function close($fd)
*/
public function rmdir($path)
{
return $this->invoker->invokeCall('rmdir', [
return $this->callFilesystem('rmdir', [
'path' => $path,
]);
}
Expand All @@ -282,7 +267,7 @@ public function rmdir($path)
*/
public function unlink($path)
{
return $this->invoker->invokeCall('unlink', [
return $this->callFilesystem('unlink', [
'path' => $path,
]);
}
Expand All @@ -295,7 +280,7 @@ public function unlink($path)
*/
public function chown($path, $uid, $gid)
{
return $this->invoker->invokeCall('chown', [
return $this->callFilesystem('chown', [
'path' => $path,
'uid' => $uid,
'gid' => $gid,
Expand All @@ -308,7 +293,7 @@ public function chown($path, $uid, $gid)
*/
public function stat($filename)
{
return $this->invoker->invokeCall('stat', [
return $this->callFilesystem('stat', [
'path' => $filename,
])->then(function ($stat) {
$stat['atime'] = new DateTime('@' . $stat['atime']);
Expand All @@ -335,7 +320,7 @@ public function lsStream($path)
{
$stream = new ObjectStream();

$this->invoker->invokeCall('readdir', [
$this->callFilesystem('readdir', [
'path' => $path,
'flags' => $this->options['lsFlags'],
])->then(function ($result) use ($path, $stream) {
Expand Down Expand Up @@ -372,7 +357,7 @@ protected function processLsContents($basePath, $result, ObjectStream $stream)
*/
public function touch($path, $mode = self::CREATION_MODE)
{
return $this->invoker->invokeCall('touch', [
return $this->callFilesystem('touch', [
'path' => $path,
'mode' => decoct($this->permissionFlagResolver->resolve($mode)),
]);
Expand All @@ -385,7 +370,7 @@ public function touch($path, $mode = self::CREATION_MODE)
*/
public function rename($fromPath, $toPath)
{
return $this->invoker->invokeCall('rename', [
return $this->callFilesystem('rename', [
'from' => $fromPath,
'to' => $toPath,
]);
Expand All @@ -397,7 +382,7 @@ public function rename($fromPath, $toPath)
*/
public function readlink($path)
{
return $this->invoker->invokeCall('readlink', [
return $this->callFilesystem('readlink', [
'path' => $path,
])->then(function ($result) {
return \React\Promise\resolve($result['path']);
Expand All @@ -411,7 +396,7 @@ public function readlink($path)
*/
public function symlink($fromPath, $toPath)
{
return $this->invoker->invokeCall('symlink', [
return $this->callFilesystem('symlink', [
'from' => $fromPath,
'to' => $toPath,
])->then(function ($result) {
Expand Down
50 changes: 15 additions & 35 deletions src/Eio/Adapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,6 @@ class Adapter implements AdapterInterface
*/
protected $permissionFlagResolver;

/**
* @var CallInvokerInterface
*/
protected $invoker;

/**
* @var CallInvokerInterface
*/
protected $readDirInvoker;

/**
* @var FilesystemInterface
*/
Expand Down Expand Up @@ -96,8 +86,6 @@ public function __construct(LoopInterface $loop, array $options = [])
*/
protected function applyConfiguration(array $options)
{
$this->invoker = \React\Filesystem\getInvoker($this, $options, 'invoker', 'React\Filesystem\InstantInvoker');
$this->readDirInvoker = \React\Filesystem\getInvoker($this, $options, 'read_dir_invoker', 'React\Filesystem\InstantInvoker');
$this->openFileLimiter = new OpenFileLimiter(\React\Filesystem\getOpenFileLimit($options));
$this->options = array_merge_recursive($this->options, $options);
}
Expand All @@ -118,14 +106,6 @@ public function getLoop()
return $this->loop;
}

/**
* {@inheritDoc}
*/
public function setInvoker(CallInvokerInterface $invoker)
{
$this->invoker = $invoker;
}

/**
* {@inheritDoc}
*/
Expand All @@ -152,7 +132,7 @@ public function setReadDirInvoker(CallInvokerInterface $invoker)
*/
public function stat($filename)
{
return $this->invoker->invokeCall('eio_lstat', [$filename])->then(function ($stat) {
return $this->callFilesystem('eio_lstat', [$filename])->then(function ($stat) {
$stat['atime'] = new DateTime('@' .$stat['atime']);
$stat['mtime'] = new DateTime('@' .$stat['mtime']);
$stat['ctime'] = new DateTime('@' .$stat['ctime']);
Expand All @@ -165,31 +145,31 @@ public function stat($filename)
*/
public function unlink($filename)
{
return $this->invoker->invokeCall('eio_unlink', [$filename]);
return $this->callFilesystem('eio_unlink', [$filename]);
}

/**
* {@inheritDoc}
*/
public function rename($fromFilename, $toFilename)
{
return $this->invoker->invokeCall('eio_rename', [$fromFilename, $toFilename]);
return $this->callFilesystem('eio_rename', [$fromFilename, $toFilename]);
}

/**
* {@inheritDoc}
*/
public function chmod($path, $mode)
{
return $this->invoker->invokeCall('eio_chmod', [$path, $mode]);
return $this->callFilesystem('eio_chmod', [$path, $mode]);
}

/**
* {@inheritDoc}
*/
public function chown($path, $uid, $gid)
{
return $this->invoker->invokeCall('eio_chown', [$path, $uid, $gid]);
return $this->callFilesystem('eio_chown', [$path, $uid, $gid]);
}

/**
Expand Down Expand Up @@ -250,7 +230,7 @@ protected function processLsContents($basePath, $result, ObjectStream $stream)
*/
public function mkdir($path, $mode = self::CREATION_MODE)
{
return $this->invoker->invokeCall('eio_mkdir', [
return $this->callFilesystem('eio_mkdir', [
$path,
$this->permissionFlagResolver->resolve($mode),
]);
Expand All @@ -261,7 +241,7 @@ public function mkdir($path, $mode = self::CREATION_MODE)
*/
public function rmdir($path)
{
return $this->invoker->invokeCall('eio_rmdir', [$path]);
return $this->callFilesystem('eio_rmdir', [$path]);
}

/**
Expand All @@ -272,7 +252,7 @@ public function open($path, $flags, $mode = self::CREATION_MODE)
$eioFlags = $this->openFlagResolver->resolve($flags);
$mode = $this->permissionFlagResolver->resolve($mode);
return $this->openFileLimiter->open()->then(function () use ($path, $eioFlags, $mode) {
return $this->invoker->invokeCall('eio_open', [
return $this->callFilesystem('eio_open', [
$path,
$eioFlags,
$mode,
Expand All @@ -288,7 +268,7 @@ public function open($path, $flags, $mode = self::CREATION_MODE)
*/
public function close($fd)
{
return $this->invoker->invokeCall('eio_close', [$fd])->always(function () {
return $this->callFilesystem('eio_close', [$fd])->always(function () {
$this->openFileLimiter->close();
});
}
Expand All @@ -302,14 +282,14 @@ public function touch($path, $mode = self::CREATION_MODE, $time = null)
if ($time === null) {
$time = microtime(true);
}
return $this->invoker->invokeCall('eio_utime', [
return $this->callFilesystem('eio_utime', [
$path,
$time,
$time,
]);
}, function () use ($path, $mode) {
return $this->openFileLimiter->open()->then(function () use ($path, $mode) {
return $this->invoker->invokeCall('eio_open', [
return $this->callFilesystem('eio_open', [
$path,
EIO_O_CREAT,
$this->permissionFlagResolver->resolve($mode),
Expand All @@ -325,7 +305,7 @@ public function touch($path, $mode = self::CREATION_MODE, $time = null)
*/
public function read($fileDescriptor, $length, $offset)
{
return $this->invoker->invokeCall('eio_read', [
return $this->callFilesystem('eio_read', [
$fileDescriptor,
$length,
$offset,
Expand All @@ -337,7 +317,7 @@ public function read($fileDescriptor, $length, $offset)
*/
public function write($fileDescriptor, $data, $length, $offset)
{
return $this->invoker->invokeCall('eio_write', [
return $this->callFilesystem('eio_write', [
$fileDescriptor,
$data,
$length,
Expand All @@ -350,7 +330,7 @@ public function write($fileDescriptor, $data, $length, $offset)
*/
public function readlink($path)
{
return $this->invoker->invokeCall('eio_readlink', [
return $this->callFilesystem('eio_readlink', [
$path,
]);
}
Expand All @@ -360,7 +340,7 @@ public function readlink($path)
*/
public function symlink($fromPath, $toPath)
{
return $this->invoker->invokeCall('eio_symlink', [
return $this->callFilesystem('eio_symlink', [
$fromPath,
$toPath,
]);
Expand Down
8 changes: 0 additions & 8 deletions src/Filesystem.php
Original file line number Diff line number Diff line change
Expand Up @@ -137,12 +137,4 @@ public function getContents($filename)
return $file->getContents();
});
}

/**
* @param CallInvokerInterface $invoker
*/
public function setInvoker(CallInvokerInterface $invoker)
{
$this->adapter->setInvoker($invoker);
}
}
5 changes: 0 additions & 5 deletions src/FilesystemInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,4 @@ public function link($path, Node\NodeInterface $destination);
* @return \React\Promise\PromiseInterface
*/
public function getContents($filename);

/**
* @param CallInvokerInterface $invoker
*/
public function setInvoker(CallInvokerInterface $invoker);
}
Loading

0 comments on commit a9ad131

Please sign in to comment.