-
Notifications
You must be signed in to change notification settings - Fork 79
feat(fusedev): add try_with_writer
on FuseSession
; update
#216
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
Conversation
`with_writer` docs - Introduce `try_with_writer<F, R, E>` that builds a `FuseDevWriter` and returns the closure’s `Result`, converting `super::Error` via `From`. - Return `SessionFailure("invalid fuse session")` when `self.file` is absent. - Tweak `with_writer` doc to clarify it passes a writer to the given closure. example(passthrough): update example to show how to use try_with_writer
Hello, could you also provide the same implementation in macos_session? |
I didn't notice failed ci on macos, could you point out the failed test? |
I noticed that this submission was originally prepared for the nydus PR #1740. In the original nydus code, the with_writer method was not used, which is why the macOS CI did not report any errors. I tried to use the with_writer method in a PR, but in macos_session this method does not exist, causing nydus macos build CI fail. Here’s the error message I encountered:
If PR #1740 were to use try_with_writer, I think it would encounter the same issue. You can also see the CI run here: CI run link |
oh I see, thanks for point out the problem |
To reduce code duplication between the Linux and macOS FuseSession implementations, this change extracts the with_writer and try_with_writer helper methods into a new extension trait, FuseSessionExt. The trait provides default implementations for these methods, which rely on file() and bufsize() accessor methods that the concrete session types must provide. Both linux_session::FuseSession and macos_session::FuseSession now implement this trait, allowing them to share the common logic.
Hi I have implement the method for macos in the latest commit |
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.
LGTM!
with_writer
docstry_with_writer<F, R, E>
that builds aFuseDevWriter
and returnsthe closure’s
Result
, convertingsuper::Error
viaFrom
.SessionFailure("invalid fuse session")
whenself.file
is absent.with_writer
doc to clarify it passes a writer to the given closure.example(passthrough): update example to show how to use try_with_writer