Skip to content
This repository has been archived by the owner on Oct 1, 2023. It is now read-only.

v4.58.0: HSL-IO v0.2: buffered readers, FDHandle, removal of write queuing, disposables, and PHP resource support

Compare
Choose a tag to compare
@fredemmott fredemmott released this 02 Jul 16:26

This release:

  • increases the version number of the hsl-io virtual package to 0.2.0
  • removes CloseableHandle::closeAsync() - use close() instead
  • adds convenience methods readAllAsync(), readFixedSizeAsync(), writeAllAsync() to IO\ReadHandle
  • adds IO\BufferedReader class, which implements IO\ReadHandle and adds:
    • linesIterator() - use as foreach ($reader->linesIterator() await as $line) {}
    • readLineAsync() - prefer using linesIterator() where appropriate
    • readUntilAsync()
    • readByteAsync()
  • adds IO\MemoryHandle class
  • O_CLOEXEC is now implicitly set on all handles; this will not affect most users, but removes an observable difference when using CLI-server mode
  • Removed disposable interfaces; file/socket open functions now return the non-disposable interface.
  • removed queuing system from IO\WriteHandle, as it can not provide the guarantees that would intuitively be expected. In general, avoid concurrent writes to the same handle, or add a queue or lock for your higher-level operations instead of each individual IO operation.
  • PHP resource support in HSL IO has been removed; all native handles have been ported to OS\FileDescriptor
  • Fixed a bug where non-blocking accepts would never resolve (fail) if the socket was already closed
  • Added OS\mkostemps(), OS\mkostemp(), OS\mkstemp(), OS\mkstemps(); File\temporary_file() now uses these
  • Added IO\FDHandle interface for handles that are backed by OS\FileHandles; all native types now implement this interface
  • Removed UserSpaceHandle; check for the behavior you want instead, e.g. OS\FileHandle
  • invalid arguments in HSL IO now consistently fail with EINVAL, instead of a mix of different exceptions
    • EINVAL is used for consistency regardless of when there error is raised by Hack code or by native functions