Skip to content

add CloserListerAt#577

Merged
drakkan merged 1 commit into
pkg:masterfrom
drakkan:lister-close
Apr 10, 2024
Merged

add CloserListerAt#577
drakkan merged 1 commit into
pkg:masterfrom
drakkan:lister-close

Conversation

@drakkan

@drakkan drakkan commented Feb 9, 2024

Copy link
Copy Markdown
Collaborator

The ListerAt is stored in the Request state and reused across requests. Some implementations don't store the entire []os.FileInfo buffer in the ListerAt implementation but instead return an open file and get/return []os.FileInfo on request. For these implementation a Close method is required.

The use case is if you want to list a large directory on memory constrained systems.

Comment thread request-interfaces.go Outdated
Comment thread request.go Outdated
Comment thread request.go Outdated
}
}()

r.state.closeListerAt()

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

err := r.state.closeListerAt()

Perhaps? This obviates the need for line 248 as well.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

maybe we can just check for io.Closer like for readers/writers instead of extending the interface

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Yeah, I think that’s a simpler mor direct change.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Yeah, I think that’s a simpler mor direct change.

Done

@drakkan drakkan force-pushed the lister-close branch 3 times, most recently from 311ff0d to 8fe951f Compare February 12, 2024 09:33
The ListerAt is stored in the Request state and reused across requests.
Some implementations don't store the entire []os.FileInfo buffer in the
ListerAt implementation but instead return an open file and get/return
[]os.FileInfo on request. For these implementation calling Close is
required
@drakkan drakkan merged commit 6370888 into pkg:master Apr 10, 2024
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