33namespace React \Filesystem ;
44
55use React \EventLoop \LoopInterface ;
6+ use React \Promise \PromiseInterface ;
67
78interface AdapterInterface
89{
@@ -15,137 +16,180 @@ interface AdapterInterface
1516 public function __construct (LoopInterface $ loop , array $ options = []);
1617
1718 /**
19+ * Return the loop associated with this adapter.
20+ *
1821 * @return LoopInterface
1922 */
2023 public function getLoop ();
2124
2225 /**
26+ * Set the relevant filesystem for this adapter.
27+ *
28+ * @internal
2329 * @param FilesystemInterface $filesystem
2430 * @return void
2531 */
2632 public function setFilesystem (FilesystemInterface $ filesystem );
2733
2834 /**
35+ * Set the call invoker for this adapter.
36+ *
2937 * @param CallInvokerInterface $invoker
3038 * @return void
3139 */
3240 public function setInvoker (CallInvokerInterface $ invoker );
3341
3442 /**
43+ * Call the underlying filesystem.
44+ *
45+ * @internal
3546 * @param string $function
3647 * @param array $args
3748 * @param int $errorResultCode
38- * @return \React\Promise\Promise
49+ * @return PromiseInterface
3950 */
4051 public function callFilesystem ($ function , $ args , $ errorResultCode = -1 );
4152
4253 /**
54+ * Create a directory at the given path with the given mode.
55+ *
4356 * @param string $path
4457 * @param $mode
45- * @return \React\Promise\ PromiseInterface
58+ * @return PromiseInterface
4659 */
4760 public function mkdir ($ path , $ mode = self ::CREATION_MODE );
4861
4962 /**
63+ * Remove the given directory.
64+ *
5065 * @param string $path
51- * @return \React\Promise\ PromiseInterface
66+ * @return PromiseInterface
5267 */
5368 public function rmdir ($ path );
5469
5570 /**
71+ * Remove the given file.
72+ *
5673 * @param string $filename
57- * @return \React\Promise\ PromiseInterface
74+ * @return PromiseInterface
5875 */
5976 public function unlink ($ filename );
6077
6178 /**
79+ * Change the mode of the given path.
80+ *
6281 * @param string $path
6382 * @param int $mode
64- * @return \React\Promise\ PromiseInterface
83+ * @return PromiseInterface
6584 */
6685 public function chmod ($ path , $ mode );
6786
6887 /**
88+ * Change the owner of the given path.
89+ *
6990 * @param string $path
7091 * @param int $uid
7192 * @param int $gid
72- * @return \React\Promise\ PromiseInterface
93+ * @return PromiseInterface
7394 */
7495 public function chown ($ path , $ uid , $ gid );
7596
7697 /**
98+ * Stat the node, returning information such as the file, c/m/a-time, mode, g/u-id, and more.
99+ *
77100 * @param string $filename
78- * @return \React\Promise\ PromiseInterface
101+ * @return PromiseInterface
79102 */
80103 public function stat ($ filename );
81104
82105 /**
106+ * List contents of the given path.
107+ *
83108 * @param string $path
84- * @return \React\Promise\ PromiseInterface
109+ * @return PromiseInterface
85110 */
86111 public function ls ($ path );
87112
88113 /**
114+ * Touch the given path, either creating a file, or updating mtime on the file.
115+ *
89116 * @param string $path
90117 * @param $mode
91- * @return \React\Promise\ PromiseInterface
118+ * @return PromiseInterface
92119 */
93120 public function touch ($ path , $ mode = self ::CREATION_MODE );
94121
95122 /**
123+ * Open a file for reading or writing at the given path. This will return a file descriptor,
124+ * which can be used to read or write to the file. And ultimately close the file descriptor.
125+ *
96126 * @param string $path
97127 * @param string $flags
98128 * @param $mode
99- * @return \React\Promise\ PromiseInterface
129+ * @return PromiseInterface<file descriptor>
100130 */
101131 public function open ($ path , $ flags , $ mode = self ::CREATION_MODE );
102132
103133 /**
134+ * Read from the given file descriptor.
135+ *
104136 * @param $fileDescriptor
105137 * @param int $length
106138 * @param int $offset
107- * @return \React\Promise\ PromiseInterface
139+ * @return PromiseInterface
108140 */
109141 public function read ($ fileDescriptor , $ length , $ offset );
110142
111143 /**
144+ * Write to the given file descriptor.
145+ *
112146 * @param $fileDescriptor
113147 * @param string $data
114148 * @param int $length
115149 * @param int $offset
116- * @return \React\Promise\ PromiseInterface
150+ * @return PromiseInterface
117151 */
118152 public function write ($ fileDescriptor , $ data , $ length , $ offset );
119153
120154 /**
155+ * Close the given file descriptor.
156+ *
121157 * @param resource $fd
122- * @return \React\Promise\ PromiseInterface
158+ * @return PromiseInterface
123159 */
124160 public function close ($ fd );
125161
126162 /**
163+ * Rename a node.
164+ *
127165 * @param string $fromPath
128166 * @param string $toPath
129- * @return \React\Promise\ PromiseInterface
167+ * @return PromiseInterface
130168 */
131169 public function rename ($ fromPath , $ toPath );
132170
133171 /**
172+ * Read link information from the given path (has to be a symlink).
173+ *
134174 * @param string $path
135- * @return \React\Promise\ PromiseInterface
175+ * @return PromiseInterface
136176 */
137177 public function readlink ($ path );
138178
139179 /**
180+ * Create a symlink from $fromPath to $toPath.
181+ *
140182 * @param string $fromPath
141183 * @param string $toPath
142- * @return \React\Promise\ PromiseInterface
184+ * @return PromiseInterface
143185 */
144186 public function symlink ($ fromPath , $ toPath );
145187
146188 /**
189+ * Detect the type of the given path.
190+ *
147191 * @param string $path
148- * @return \React\Promise\ PromiseInterface
192+ * @return PromiseInterface
149193 */
150194 public function detectType ($ path );
151195}
0 commit comments