Skip to content

Conversation

@omus
Copy link
Contributor

@omus omus commented Oct 26, 2021

Fixes #143. Also, made it so more methods trigger the FileBuffer to become populated to avoid erroneous behaviour.

I ended up using the short-form function syntax with two statements which I normally avoid but here it seemed cleaner. More than willing to revise that.

# filepath contents
if buffer.io.size == 0
write(buffer.io, read(buffer.path))
seekstart(buffer.io)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I could definitely clean up Base.read(buffer::FileBuffer, ::Type{UInt8}) but we should probably leave the other _read(...); seekstart(...) calls alone as they would rewind the stream on each call after the FileBuffer was populated

Copy link
Owner

Choose a reason for hiding this comment

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

Yeah, I think when I initially wrote this the automatic rewinding seemed helpful for my use case. In retrospect, it seems like it has caused more problems with the IO API. I'm a little surprised this didn't break any of the existing tests though.

@codecov
Copy link

codecov bot commented Oct 26, 2021

Codecov Report

Merging #144 (92e4fc3) into master (647f26c) will increase coverage by 0.07%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #144      +/-   ##
==========================================
+ Coverage   91.70%   91.77%   +0.07%     
==========================================
  Files          12       12              
  Lines        1182     1180       -2     
==========================================
- Hits         1084     1083       -1     
+ Misses         98       97       -1     
Impacted Files Coverage Δ
src/buffer.jl 100.00% <100.00%> (+2.00%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 647f26c...92e4fc3. Read the comment docs.

Copy link
Owner

@rofinn rofinn left a comment

Choose a reason for hiding this comment

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

Seems fine to me. I think the existing tests covered my use, so if those aren't changing, then it should be fine. Please bump the patch release when you get a chance.

# filepath contents
if buffer.io.size == 0
write(buffer.io, read(buffer.path))
seekstart(buffer.io)
Copy link
Owner

Choose a reason for hiding this comment

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

Yeah, I think when I initially wrote this the automatic rewinding seemed helpful for my use case. In retrospect, it seems like it has caused more problems with the IO API. I'm a little surprised this didn't break any of the existing tests though.

@rofinn rofinn merged commit 97146a9 into rofinn:master Oct 26, 2021
@omus omus deleted the cv/skip branch October 26, 2021 21:53
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.

MethodError: no method matching skip(::FileBuffer, ::Int64)

2 participants