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

Needs implementation of Seek() added to tinyfs.File #18

Open
deadprogram opened this issue Mar 5, 2024 · 4 comments
Open

Needs implementation of Seek() added to tinyfs.File #18

deadprogram opened this issue Mar 5, 2024 · 4 comments
Labels
enhancement New feature or request next-release

Comments

@deadprogram
Copy link
Member

I need to add the io.Seeker interface to tinyfs.File so I can read some data directly from littlefs storage instead of copying into memory first for some code that has to backtrack in the processing of the file.

I noticed that the littlefs implementation does support Seek() but since the fatfs implementation does not, it is not part of that interface.

So, seems like the options are to either try to add to the current fatfs implementation, or to try swapping to @soypat pure go fatfs?

I really need this quickly so any feedback and/or help I can get will be appreciated! 😸

@deadprogram deadprogram added the enhancement New feature or request label Mar 5, 2024
@soypat
Copy link

soypat commented Mar 5, 2024

Hey @deadprogram ! The pure go implementation does not have seek implemented yet, maybe I could try adding it sometime this week. Keep in mind the pure go implementation could really use some use and load testing to make sure it does what it says it does. DO NOT USE THE PURE GO FOR REALLY IMPORTANT DATA STORAGE YET!

Here's fatfs's seek: https://github.com/abbrev/fatfs/blob/b11f08931929e5f2f1fe8a3a2c0bd16d222b5625/source/ff.c#L4435-L4589

@bgould
Copy link
Member

bgould commented Mar 6, 2024

My opinion would be to add io.Seeker to tinyfs.File and stub out the method to start to always return a "Not Implemented" error or something similar. Probably I could work on an actual implementation and have it ready by the end of this weekend.

@bgould
Copy link
Member

bgould commented Mar 6, 2024

For the pure Go implementation I think we could also have another package under this repo ... maybe call it patfs ;)

@bgould
Copy link
Member

bgould commented Mar 10, 2024

@deadprogram added the io.Seeker interface and preliminary support for the Seek() method in fatfs (currently only supports seeking from the start of the file) - #20

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request next-release
Projects
None yet
Development

No branches or pull requests

3 participants