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

create pass-through writer and iowriter #182

Merged
merged 1 commit into from
Oct 27, 2020

Conversation

deitch
Copy link
Contributor

@deitch deitch commented Sep 30, 2020

As discussed with @SteveLasker , this is the first of 2-3 PRs expanding the capabilities of the store package.

There are two additions here:

  • PassthroughWriter that lets you wrap any other underlying store (e.g. file, memory) and have a processor function in the middle. Thus if I wanted to decrypt the content in transit, or uncompress, or any other action, I have a simple framework for doing so.
  • IoWriter is very similar to FileStore, except instead of taking a directory and opening files, it takes an actual io.Writer and passes it through. I have used it to, e.g. write directly to block devices, and to write to another stream over a network. It is more fine-grained control as you can pass it any io.Writer you want.

Once these are in, I have two more that take advantage of the PassthroughWriter: GunzipWriter and UntarWriter.

pkg/content/iowriter.go Outdated Show resolved Hide resolved
@deitch deitch force-pushed the pass-through-writer branch 3 times, most recently from 325cabd to bfb413b Compare October 1, 2020 07:53
@deitch
Copy link
Contributor Author

deitch commented Oct 3, 2020

Thanks for rebasing on master @jdolitsky . Any other comments on it?

@jdolitsky
Copy link
Contributor

@deitch code lgtm - can we add a few unit tests for these? Or I suppose they can be added w/ the Gunzip/Untar writers?

@deitch
Copy link
Contributor Author

deitch commented Oct 5, 2020

Yeah, that is a good idea. At least for the io.Writer one. I will find some time to do it.

@deitch
Copy link
Contributor Author

deitch commented Oct 5, 2020

A bit odd to do, but I think this works for the test.

@jdolitsky
Copy link
Contributor

@deitch can you check failing CI?

@deitch
Copy link
Contributor Author

deitch commented Oct 5, 2020

@jdolitsky I ran it multiple times locally, I cannot see the failure. Could be transient. I am repushing to kick off again

@deitch
Copy link
Contributor Author

deitch commented Oct 5, 2020

Nope that failed too. The failure doesn't appear to have anything to do with this PR, but I am not sure.

--- FAIL: TestORASTestSuite (0.27s)
    --- FAIL: TestORASTestSuite/Test_0_Push (0.09s)
    --- FAIL: TestORASTestSuite/Test_1_Pull (0.06s)
    --- PASS: TestORASTestSuite/Test_2_MediaType (0.05s)
    --- PASS: TestORASTestSuite/Test_3_Conditional_Pull (0.05s)

Any ideas? Here is the output https://github.com/deislabs/oras/pull/182/checks?check_run_id=1210937435

@deitch
Copy link
Contributor Author

deitch commented Oct 13, 2020

What is wrong with the CI run @jdolitsky ?

@deitch
Copy link
Contributor Author

deitch commented Oct 23, 2020

@jdolitsky I rebased onto master, but also took advantage to simplify the interface, which ended up simplifying the code and blocksize stuff materially, while hewing much more closely to the classic golang style. Take a look, and let's get this in? It has been open for a good few weeks.

@deitch
Copy link
Contributor Author

deitch commented Oct 23, 2020

And CI is all clean. Even better.

@deitch
Copy link
Contributor Author

deitch commented Oct 23, 2020

Shoot. It deleted all my changes! I have to recreate them!

@deitch
Copy link
Contributor Author

deitch commented Oct 23, 2020

Phew. Managed to recover it all. Back at you @jdolitsky

@deitch
Copy link
Contributor Author

deitch commented Oct 23, 2020

And CI is green.

@deitch deitch force-pushed the pass-through-writer branch 2 times, most recently from 85ad772 to a1a136f Compare October 24, 2020 17:43
Signed-off-by: Avi Deitcher <avi@deitcher.net>
Copy link
Contributor

@jdolitsky jdolitsky left a comment

Choose a reason for hiding this comment

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

lgtm!

@jdolitsky jdolitsky merged commit d1f055b into oras-project:master Oct 27, 2020
@deitch deitch deleted the pass-through-writer branch October 27, 2020 13:14
@deitch
Copy link
Contributor Author

deitch commented Oct 27, 2020

Excellent.

I have gunzip and untar writers ready to go based on this.

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