5
5
use DateTime;
6
6
use React\EventLoop\LoopInterface;
7
7
use React\Filesystem\AdapterInterface;
8
- use React\Filesystem\CallInvokerInterface;
9
8
use React\Filesystem\FilesystemInterface;
10
9
use React\Filesystem\ModeTypeDetector;
11
10
use React\Filesystem\Node\NodeInterface;
@@ -44,16 +43,6 @@ class Adapter implements AdapterInterface
44
43
*/
45
44
protected $permissionFlagResolver;
46
45
47
- /**
48
- * @var CallInvokerInterface
49
- */
50
- protected $invoker;
51
-
52
- /**
53
- * @var CallInvokerInterface
54
- */
55
- protected $readDirInvoker;
56
-
57
46
/**
58
47
* @var FilesystemInterface
59
48
*/
@@ -96,8 +85,6 @@ public function __construct(LoopInterface $loop, array $options = [])
96
85
*/
97
86
protected function applyConfiguration(array $options)
98
87
{
99
- $this->invoker = \React\Filesystem\getInvoker($this, $options, 'invoker', 'React\Filesystem\InstantInvoker');
100
- $this->readDirInvoker = \React\Filesystem\getInvoker($this, $options, 'read_dir_invoker', 'React\Filesystem\InstantInvoker');
101
88
$this->openFileLimiter = new OpenFileLimiter(\React\Filesystem\getOpenFileLimit($options));
102
89
$this->options = array_merge_recursive($this->options, $options);
103
90
}
@@ -118,14 +105,6 @@ public function getLoop()
118
105
return $this->loop;
119
106
}
120
107
121
- /**
122
- * {@inheritDoc}
123
- */
124
- public function setInvoker(CallInvokerInterface $invoker)
125
- {
126
- $this->invoker = $invoker;
127
- }
128
-
129
108
/**
130
109
* {@inheritDoc}
131
110
*/
@@ -139,20 +118,12 @@ public function setFilesystem(FilesystemInterface $filesystem)
139
118
];
140
119
}
141
120
142
- /**
143
- * {@inheritDoc}
144
- */
145
- public function setReadDirInvoker(CallInvokerInterface $invoker)
146
- {
147
- $this->readDirInvoker = $invoker;
148
- }
149
-
150
121
/**
151
122
* {@inheritDoc}
152
123
*/
153
124
public function stat($filename)
154
125
{
155
- return $this->invoker->invokeCall ('eio_lstat', [$filename])->then(function ($stat) {
126
+ return $this->callFilesystem ('eio_lstat', [$filename])->then(function ($stat) {
156
127
$stat['atime'] = new DateTime('@' .$stat['atime']);
157
128
$stat['mtime'] = new DateTime('@' .$stat['mtime']);
158
129
$stat['ctime'] = new DateTime('@' .$stat['ctime']);
@@ -165,31 +136,31 @@ public function stat($filename)
165
136
*/
166
137
public function unlink($filename)
167
138
{
168
- return $this->invoker->invokeCall ('eio_unlink', [$filename]);
139
+ return $this->callFilesystem ('eio_unlink', [$filename]);
169
140
}
170
141
171
142
/**
172
143
* {@inheritDoc}
173
144
*/
174
145
public function rename($fromFilename, $toFilename)
175
146
{
176
- return $this->invoker->invokeCall ('eio_rename', [$fromFilename, $toFilename]);
147
+ return $this->callFilesystem ('eio_rename', [$fromFilename, $toFilename]);
177
148
}
178
149
179
150
/**
180
151
* {@inheritDoc}
181
152
*/
182
153
public function chmod($path, $mode)
183
154
{
184
- return $this->invoker->invokeCall ('eio_chmod', [$path, $mode]);
155
+ return $this->callFilesystem ('eio_chmod', [$path, $mode]);
185
156
}
186
157
187
158
/**
188
159
* {@inheritDoc}
189
160
*/
190
161
public function chown($path, $uid, $gid)
191
162
{
192
- return $this->invoker->invokeCall ('eio_chown', [$path, $uid, $gid]);
163
+ return $this->callFilesystem ('eio_chown', [$path, $uid, $gid]);
193
164
}
194
165
195
166
/**
@@ -208,7 +179,7 @@ public function lsStream($path)
208
179
{
209
180
$stream = new ObjectStream();
210
181
211
- $this->readDirInvoker->invokeCall ('eio_readdir', [$path, $this->options['lsFlags']], false)->then(function ($result) use ($path, $stream) {
182
+ $this->callFilesystem ('eio_readdir', [$path, $this->options['lsFlags']], false)->then(function ($result) use ($path, $stream) {
212
183
$this->processLsContents($path, $result, $stream);
213
184
});
214
185
@@ -250,7 +221,7 @@ protected function processLsContents($basePath, $result, ObjectStream $stream)
250
221
*/
251
222
public function mkdir($path, $mode = self::CREATION_MODE)
252
223
{
253
- return $this->invoker->invokeCall ('eio_mkdir', [
224
+ return $this->callFilesystem ('eio_mkdir', [
254
225
$path,
255
226
$this->permissionFlagResolver->resolve($mode),
256
227
]);
@@ -261,7 +232,7 @@ public function mkdir($path, $mode = self::CREATION_MODE)
261
232
*/
262
233
public function rmdir($path)
263
234
{
264
- return $this->invoker->invokeCall ('eio_rmdir', [$path]);
235
+ return $this->callFilesystem ('eio_rmdir', [$path]);
265
236
}
266
237
267
238
/**
@@ -272,7 +243,7 @@ public function open($path, $flags, $mode = self::CREATION_MODE)
272
243
$eioFlags = $this->openFlagResolver->resolve($flags);
273
244
$mode = $this->permissionFlagResolver->resolve($mode);
274
245
return $this->openFileLimiter->open()->then(function () use ($path, $eioFlags, $mode) {
275
- return $this->invoker->invokeCall ('eio_open', [
246
+ return $this->callFilesystem ('eio_open', [
276
247
$path,
277
248
$eioFlags,
278
249
$mode,
@@ -288,7 +259,7 @@ public function open($path, $flags, $mode = self::CREATION_MODE)
288
259
*/
289
260
public function close($fd)
290
261
{
291
- return $this->invoker->invokeCall ('eio_close', [$fd])->always(function () {
262
+ return $this->callFilesystem ('eio_close', [$fd])->always(function () {
292
263
$this->openFileLimiter->close();
293
264
});
294
265
}
@@ -302,14 +273,14 @@ public function touch($path, $mode = self::CREATION_MODE, $time = null)
302
273
if ($time === null) {
303
274
$time = microtime(true);
304
275
}
305
- return $this->invoker->invokeCall ('eio_utime', [
276
+ return $this->callFilesystem ('eio_utime', [
306
277
$path,
307
278
$time,
308
279
$time,
309
280
]);
310
281
}, function () use ($path, $mode) {
311
282
return $this->openFileLimiter->open()->then(function () use ($path, $mode) {
312
- return $this->invoker->invokeCall ('eio_open', [
283
+ return $this->callFilesystem ('eio_open', [
313
284
$path,
314
285
EIO_O_CREAT,
315
286
$this->permissionFlagResolver->resolve($mode),
@@ -325,7 +296,7 @@ public function touch($path, $mode = self::CREATION_MODE, $time = null)
325
296
*/
326
297
public function read($fileDescriptor, $length, $offset)
327
298
{
328
- return $this->invoker->invokeCall ('eio_read', [
299
+ return $this->callFilesystem ('eio_read', [
329
300
$fileDescriptor,
330
301
$length,
331
302
$offset,
@@ -337,7 +308,7 @@ public function read($fileDescriptor, $length, $offset)
337
308
*/
338
309
public function write($fileDescriptor, $data, $length, $offset)
339
310
{
340
- return $this->invoker->invokeCall ('eio_write', [
311
+ return $this->callFilesystem ('eio_write', [
341
312
$fileDescriptor,
342
313
$data,
343
314
$length,
@@ -350,7 +321,7 @@ public function write($fileDescriptor, $data, $length, $offset)
350
321
*/
351
322
public function readlink($path)
352
323
{
353
- return $this->invoker->invokeCall ('eio_readlink', [
324
+ return $this->callFilesystem ('eio_readlink', [
354
325
$path,
355
326
]);
356
327
}
@@ -360,7 +331,7 @@ public function readlink($path)
360
331
*/
361
332
public function symlink($fromPath, $toPath)
362
333
{
363
- return $this->invoker->invokeCall ('eio_symlink', [
334
+ return $this->callFilesystem ('eio_symlink', [
364
335
$fromPath,
365
336
$toPath,
366
337
]);
0 commit comments