Skip to content
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

Expose API for modifying fuse_conn_info.max_read #50

Closed
wants to merge 6 commits into from

Conversation

SupraSummus
Copy link

Related to issue #49

@SupraSummus
Copy link
Author

I exposed only max_read field, because that is what I need. Is that acceptable or should I expose all fuse_conn_info fields?

@Nikratio I don't know what you meant in this comment SupraSummus@2e128ca#r59074244. How can I merge getter and setter into one func?

@Nikratio
Copy link
Contributor

Nikratio commented Nov 2, 2021

Thanks for the patch!

I think just exposing max_read for now is fine. Nevermind what I said about the getter/setter, I got myself confused.

I think your current patch overcomplicates things a bit though (wasn't it much simpler in the beginning)? I think all you need is a new (pure-Python) ConnInfo class with a single max_requests parameter. You pass this to init, and afterwards you copy the value of the max_read attribute. No need to be more sophisticated than that :-).

src/_pyfuse3.py Outdated
@@ -65,7 +65,7 @@ class Operations:
enable_writeback_cache: bool = False
enable_acl: bool = False

def init(self) -> None:
def init(self, conn_info) -> None:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a type annotation for the second argument

src/_pyfuse3.py Show resolved Hide resolved
src/pyfuse3.pyx Outdated
@@ -393,6 +393,37 @@ cdef class FileInfo:
out.nonseekable = 0


@cython.freelist(1)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is needed for something that's used once

test/test_fs.py Show resolved Hide resolved
src/pyfuse3.pyi Outdated
@@ -72,6 +72,15 @@ class FileInfo:
def __cinit__(self, fh: FileHandleT, direct_io: bool, keep_cache: bool, nonseekable: bool) -> None: ...
# def _copy_to_fuse(self, fuse_file_info *out) -> None: ...


class ConnInfo:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why both this and the cdef clas in pyfuse3.pyx? Isn't one sufficient?

src/pyfuse3.pyx Outdated
The attributes correspond to the elements of the ``fuse_conn_info`` struct.
'''

cdef fuse_conn_info conn
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the point of keeping a copy of the whole struct around, if all you care about is the max_read parameter?

src/_pyfuse3.py Show resolved Hide resolved
src/handlers.pxi Outdated
# Blocking rather than async, in case we decide to let the
# init hander modify `conn` in the future.
operations.init()
cdef object conn_obj = ConnInfo(max_read=conn.max_read)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cdef object does nothing, please omit.

src/handlers.pxi Outdated
# init hander modify `conn` in the future.
operations.init()
cdef object conn_obj = ConnInfo(max_read=conn.max_read)
# Blocking rather than async, to let the init hander modify `conn_obj`.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment doesn't make sense. async functions can modify their parameters too. Just omit it entirely, having it sync is fine.

@Nikratio
Copy link
Contributor

Are you still interested in working on this?

@SupraSummus
Copy link
Author

It's finished except unit tests. I tried to write one and got stuck, but someday I'll get it done. If you don't want hanging PR in the repo feel free to close it and I'll reopen it when the test is ready.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants