예제 #1
0
        public async Task <object> HandleResponseAsync(HttpResponseMessage response)
        {
            if (!response.IsSuccessStatusCode)
            {
                throw new HttpResponseException(response);
            }
            blobSizeListener(response.Content.Headers.ContentLength ?? 0);

            using (Stream outputStream =
                       new NotifyingOutputStream(destinationOutputStream, writtenByteCountListener, true))
            {
                BlobDescriptor receivedBlobDescriptor;
                using (Stream contentStream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false))
                {
                    receivedBlobDescriptor = await Digests.ComputeDigestAsync(contentStream, outputStream).ConfigureAwait(false);
                }

                if (!blobDigest.Equals(receivedBlobDescriptor.GetDigest()))
                {
                    throw new UnexpectedBlobDigestException(
                              "The pulled BLOB has digest '"
                              + receivedBlobDescriptor.GetDigest()
                              + "', but the request digest was '"
                              + blobDigest
                              + "'");
                }
            }

            return(null);
        }
예제 #2
0
 public override bool Equals(object other)
 {
     if (this == other)
     {
         return(true);
     }
     if (!(other is FibContainer otherContainer))
     {
         return(false);
     }
     return(imageDigest.Equals(otherContainer.imageDigest) && imageId.Equals(otherContainer.imageId));
 }
예제 #3
0
 public override bool Equals(object other)
 {
     if (this == other)
     {
         return(true);
     }
     if (!(other is BuildResult otherBuildResult))
     {
         return(false);
     }
     return(imageDigest.Equals(otherBuildResult.imageDigest) &&
            imageId.Equals(otherBuildResult.imageId));
 }
예제 #4
0
        /**
         * Two {@link BlobDescriptor} objects are equal if their
         *
         * <ol>
         *   <li>{@code digest}s are not null and equal, and
         *   <li>{@code size}s are non-negative and equal
         * </ol>
         */

        public override bool Equals(object obj)
        {
            if (obj == this)
            {
                return(true);
            }
            if (size < 0 || !(obj is BlobDescriptor other))
            {
                return(false);
            }

            return(size == other.GetSize() && digest.Equals(other.GetDigest()));
        }