iansmith / parigot

Develop as a monolith, deploy as microservices.
https://parigot.info
BSD 3-Clause "New" or "Revised" License
12 stars 1 forks source link

add reader to fileInfo struct #25

Closed cindyuc closed 1 year ago

cindyuc commented 1 year ago

It seems to be having some memory issues. For now, I just let it read as far as the file service can do (no more than a limited size).

The purpose of this PR is that I want to know if this is an idiomatic way to implement the reader interface.


update(06/22/2023): Read request and response are initially done, also add an OpenRead test


update(06/26/2023) Add reader inside the fileInfo struct


update(06/29/2023)

I'm gonna add writer in my next PR

netlify[bot] commented 1 year ago

Deploy Preview for parigot canceled.

Name Link
Latest commit f2a89426ed5bc3065bca5d97f83529ef1cef851e
Latest deploy log https://app.netlify.com/sites/parigot/deploys/649dfe52f6a0190008ada955
iansmith commented 1 year ago

You could probably write a test program that used real files in a test that does:

You probably should create a test that tests that your error with a buffer too large actually works. E.g. if your maximum size is 20 bytes, then send in a buffer that Is 21 bytes.

Might also want to handle a special case where they send you a zero size buffer. I would argue that sending a zero size buffer is not an error, and you return success, but with 0 bytes read.

cindyuc commented 1 year ago

If go through my comments and figure out what to do, you are welcome to merge this and do "write" in a separate PR.

I will update according to your comments in the following PR