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

Support updating from an archive #11

Open
inconshreveable opened this issue Jan 19, 2015 · 4 comments
Open

Support updating from an archive #11

inconshreveable opened this issue Jan 19, 2015 · 4 comments

Comments

@inconshreveable
Copy link
Owner

go-update is currently targeted at only updating a single file. And while it's possible to call it repeatedly to update many files, it makes more sense for an archive of many files that compromise an update to be checksummed and verified all at once. Come up with an API or easy example on how to accomplish this.
cc: @lukechampine

@lukechampine
Copy link
Contributor

This would be cleaner if Go had a standard compression interface, like a compress.Deflater(io.Reader) io.Reader. Then you could just pass in a compress.Deflater to the update and it would handle the decompression behind the scenes.

As it stands, I don't see an easy way to do the decompression automatically. You'd need to return the archive to the user and have them decompress it. You also need a way to track the contents of the archive, probably by unpacking it into a specially named hidden folder.

Honestly, I think it would be a huge headache to make compression+archives pluggable. Instead, I would manually support zip and tar.gz. If the user wants to do otherwise, it's still possible to build out of the update primitives.

With that out of the way, the API extensions should be fairly straightforward: just add a FromZip option or equivalent. You don't even need to change the checksum/signature semantics, because they'll still be called on the supplied stream.

@inconshreveable
Copy link
Owner Author

It seems like these are two orthogonal problems. One is compression and the other is unarchiving. Since wrapping a decompressor like gzip.NewReader or flate.NewReader is pretty easy in Go (and because it can often be taken care of for you via Content-Encoding over HTTP, I'm okay leaving that to the application to solve.

Solving the unarchiving problem is much harder, I think. When dealing with multi-file updates, you need to actually start thinking about how to add new files, how to delete files that shouldn't . Is the archive all new files, or all patches to existing files? Or a mixture? Is signing done on each file, or the whole archive? etc.

I'm inclined to leave this problem for last since it's going to require the most changes from both an API and implementation standpoint. It may even be worth it to just scope it out and say 'go-update is only about updating single files'.

@joeblew99
Copy link

did this get put into main code ?

I need it :)

@inconshreveable
Copy link
Owner Author

sorry, there's been no work been done on this yet

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants