1
0
Fork 0
forked from mirrors/tar-split

tar/asm: DiscardFilePutter and stub disassemble

Have a bit-bucket FilePutter, for when it does not matter.

Beginning thoughts on disassembly, but it has things that need thought.
Mostly comments in the function for now.
This commit is contained in:
Vincent Batts 2015-03-02 15:25:03 -05:00
parent ccf6fa61a6
commit 4e27d04b0b
5 changed files with 83 additions and 1 deletions

View file

@ -6,7 +6,18 @@ import (
"github.com/vbatts/tar-split/tar/storage"
)
func NewTarStream(fg FileGetter, up storage.Unpacker) io.ReadCloser {
// NewOutputTarStream returns an io.ReadCloser that is an assemble tar archive
// stream.
//
// It takes a FileGetter, for mapping the file payloads that are to be read in,
// and a storage.Unpacker, which has access to the rawbytes and file order
// metadata. With the combination of these two items, a precise assembled Tar
// archive is possible.
func NewOutputTarStream(fg FileGetter, up storage.Unpacker) io.ReadCloser {
// ... Since these are interfaces, this is possible, so let's not have a nil pointer
if fg == nil || up == nil {
return nil
}
pr, pw := io.Pipe()
go func() {
for {