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

Rewrite to add support for random-acces for Crypt4GHReader #83

Merged
merged 3 commits into from
Aug 23, 2023

Conversation

pontus
Copy link
Contributor

@pontus pontus commented Aug 17, 2023

Unfortunately a large PR, apologies, even if I feel this is a simplification.

This PR adds opportunistic usage if the underlying data provider supports Seek, this allows for the main use case of reading small specific bits of large files. But this also allows for e.g. reading the end of a file first and then going back to an earlier position (if supported).

Interface changes are the addition of Seek and Close to permit Seeker and Closer. GetHeader has also changed from
func (c Crypt4GHReader) GetHeader() []byte to func (c *Crypt4GHReader) GetHeader() []byte.

…ed by

the underlying (encrypted) data stream.
Copy link
Contributor

@blankdots blankdots left a comment

Choose a reason for hiding this comment

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

Copy link
Contributor

@blankdots blankdots left a comment

Choose a reason for hiding this comment

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

some small things.

how do you envision this being used in practice, some example code would help?

streaming/in.go Show resolved Hide resolved
streaming/in.go Outdated Show resolved Hide resolved
streaming/in.go Show resolved Hide resolved
@codecov-commenter
Copy link

codecov-commenter commented Aug 18, 2023

Codecov Report

Merging #83 (5c30913) into master (4aeb7a3) will increase coverage by 7.07%.
The diff coverage is 91.66%.

❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more.

@@            Coverage Diff             @@
##           master      #83      +/-   ##
==========================================
+ Coverage   58.47%   65.54%   +7.07%     
==========================================
  Files           6        6              
  Lines        1103     1164      +61     
==========================================
+ Hits          645      763     +118     
+ Misses        330      281      -49     
+ Partials      128      120       -8     
Flag Coverage Δ
unittests 65.54% <91.66%> (+7.07%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Changed Coverage Δ
streaming/in.go 89.13% <91.66%> (+24.37%) ⬆️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

Co-authored-by: Stefan Negru <blankdots@users.noreply.github.com>
@pontus
Copy link
Contributor Author

pontus commented Aug 18, 2023

how do you envision this being used in practice, some example code would help?

Giving examples sounds like a good idea, but I'm a bit unsure where I should best do that, does someone else have opinions/suggestions?

  • An examples directory in tree
  • PR for the intended use case
  • Out of band

?

@blankdots
Copy link
Contributor

  • An examples directory in tree

i vote for that, though it might be a new issue we need to create and find people to work on

@pontus
Copy link
Contributor Author

pontus commented Aug 18, 2023

i vote for that, though it might be a new issue we need to create and find people to work on

I can commit to creating a few small demos. Should not be a large task but it does feel like a separate PR.

@blankdots blankdots requested a review from a team August 18, 2023 07:35
@pontus pontus merged commit c6719a4 into master Aug 23, 2023
6 checks passed
@pontus pontus deleted the random_access branch August 23, 2023 11:05
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.

4 participants