update vendored archive/tar to lower allocations
Docker-DCO-1.1-Signed-off-by: Cristian Staretu <cristian.staretu@gmail.com> (github: unclejack)
This commit is contained in:
parent
6eda9f3207
commit
b885f61a61
|
@ -53,9 +53,9 @@ clone hg code.google.com/p/go.net 84a4013f96e0
|
||||||
|
|
||||||
clone hg code.google.com/p/gosqlite 74691fb6f837
|
clone hg code.google.com/p/gosqlite 74691fb6f837
|
||||||
|
|
||||||
# get Go tip's archive/tar, for xattr support
|
# get Go tip's archive/tar, for xattr support and improved performance
|
||||||
# TODO after Go 1.3 drops, bump our minimum supported version and drop this vendored dep
|
# TODO after Go 1.4 drops, bump our minimum supported version and drop this vendored dep
|
||||||
clone hg code.google.com/p/go 3458ba248590
|
clone hg code.google.com/p/go 17404efd6b02
|
||||||
mv src/code.google.com/p/go/src/pkg/archive/tar tmp-tar
|
mv src/code.google.com/p/go/src/pkg/archive/tar tmp-tar
|
||||||
rm -rf src/code.google.com/p/go
|
rm -rf src/code.google.com/p/go
|
||||||
mkdir -p src/code.google.com/p/go/src/pkg/archive
|
mkdir -p src/code.google.com/p/go/src/pkg/archive
|
||||||
|
|
|
@ -29,10 +29,11 @@ const maxNanoSecondIntSize = 9
|
||||||
// The Next method advances to the next file in the archive (including the first),
|
// The Next method advances to the next file in the archive (including the first),
|
||||||
// and then it can be treated as an io.Reader to access the file's data.
|
// and then it can be treated as an io.Reader to access the file's data.
|
||||||
type Reader struct {
|
type Reader struct {
|
||||||
r io.Reader
|
r io.Reader
|
||||||
err error
|
err error
|
||||||
pad int64 // amount of padding (ignored) after current file entry
|
pad int64 // amount of padding (ignored) after current file entry
|
||||||
curr numBytesReader // reader for current file entry
|
curr numBytesReader // reader for current file entry
|
||||||
|
hdrBuff [blockSize]byte // buffer to use in readHeader
|
||||||
}
|
}
|
||||||
|
|
||||||
// A numBytesReader is an io.Reader with a numBytes method, returning the number
|
// A numBytesReader is an io.Reader with a numBytes method, returning the number
|
||||||
|
@ -426,7 +427,9 @@ func (tr *Reader) verifyChecksum(header []byte) bool {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (tr *Reader) readHeader() *Header {
|
func (tr *Reader) readHeader() *Header {
|
||||||
header := make([]byte, blockSize)
|
header := tr.hdrBuff[:]
|
||||||
|
copy(header, zeroBlock)
|
||||||
|
|
||||||
if _, tr.err = io.ReadFull(tr.r, header); tr.err != nil {
|
if _, tr.err = io.ReadFull(tr.r, header); tr.err != nil {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,8 +37,9 @@ type Writer struct {
|
||||||
nb int64 // number of unwritten bytes for current file entry
|
nb int64 // number of unwritten bytes for current file entry
|
||||||
pad int64 // amount of padding to write after current file entry
|
pad int64 // amount of padding to write after current file entry
|
||||||
closed bool
|
closed bool
|
||||||
usedBinary bool // whether the binary numeric field extension was used
|
usedBinary bool // whether the binary numeric field extension was used
|
||||||
preferPax bool // use pax header instead of binary numeric header
|
preferPax bool // use pax header instead of binary numeric header
|
||||||
|
hdrBuff [blockSize]byte // buffer to use in writeHeader
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewWriter creates a new Writer writing to w.
|
// NewWriter creates a new Writer writing to w.
|
||||||
|
@ -160,7 +161,8 @@ func (tw *Writer) writeHeader(hdr *Header, allowPax bool) error {
|
||||||
// subsecond time resolution, but for now let's just capture
|
// subsecond time resolution, but for now let's just capture
|
||||||
// too long fields or non ascii characters
|
// too long fields or non ascii characters
|
||||||
|
|
||||||
header := make([]byte, blockSize)
|
header := tw.hdrBuff[:]
|
||||||
|
copy(header, zeroBlock)
|
||||||
s := slicer(header)
|
s := slicer(header)
|
||||||
|
|
||||||
// keep a reference to the filename to allow to overwrite it later if we detect that we can use ustar longnames instead of pax
|
// keep a reference to the filename to allow to overwrite it later if we detect that we can use ustar longnames instead of pax
|
||||||
|
|
Loading…
Reference in New Issue