-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rework the whole package #1
base: develop
Are you sure you want to change the base?
Conversation
Welcome to Codecov 🎉Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests. Thanks for integrating Codecov - We've got you covered ☂️ |
->flatMap(static fn($sideEffect) => match ($autoClose) { | ||
true => $stream->close()->maybe(), | ||
false => Maybe::just($sideEffect), | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It misses the case of closing the file when the writing failed.
->write($chunk) | ||
->maybe(), | ||
), | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe add a call to fsync
before closing the file ?
static fn() => throw new FailedToLoadStream, | ||
); | ||
|
||
$register(static fn() => $rewind()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should close the file on partial read.
Problem
The current handling of IO in Innmind packages is split between
innmind/stream
andinnmind/socket
for the low level details on how to read/write to streams and sockets, and this package for a higher abstraction on how to handle these streams.Other packages wanting to deal with IO has to keep track of capabilities (from
innmind/stream
) to open streams or directly call to classes frominnmind/socket
to open sockets. And also keep track of this packageIO
instance to wrap the streams in order to simplify their usage.This exposes a few problems:
innmind/stream
andinnmind/socket
use interfaces which limits the possibilities to add new features in minor versionsSolution
WIP