From 898bcf0f5d2cce3ac8e5aedcb6362743bcb0c27b Mon Sep 17 00:00:00 2001 From: Vincent Batts Date: Thu, 21 Aug 2014 16:12:52 -0400 Subject: [PATCH] TarSum: versioning This introduces Versions for TarSum checksums. Fixes: https://github.com/docker/docker/issues/7526 It preserves current functionality and abstracts the interface for future flexibility of hashing algorithms. As a POC, the VersionDev Tarsum does not include the mtime in the checksum calculation, and would solve https://github.com/docker/docker/issues/7387 though this is not a settled Version is subject to change until a version number is assigned. Signed-off-by: Vincent Batts --- docs/session.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/docs/session.go b/docs/session.go index c78e559b4..58263ef6e 100644 --- a/docs/session.go +++ b/docs/session.go @@ -407,7 +407,10 @@ func (r *Session) PushImageLayerRegistry(imgID string, layer io.Reader, registry log.Debugf("[registry] Calling PUT %s", registry+"images/"+imgID+"/layer") - tarsumLayer := &tarsum.TarSum{Reader: layer} + tarsumLayer, err := tarsum.NewTarSum(layer, false, tarsum.Version0) + if err != nil { + return "", "", err + } h := sha256.New() h.Write(jsonRaw) h.Write([]byte{'\n'})