public void SerializeToString(HashType hashType, string expected)
        {
            var hashLength = HashInfoLookup.Find(hashType).ByteLength;
            var hash       = new ContentHash(hashType, Enumerable.Range(0, hashLength).Select(i => (byte)i).ToArray());

            Assert.Equal(expected, hash.Serialize());
        }
Exemplo n.º 2
0
        /// <summary>
        /// Serializes <see cref="GraphAgnosticIncrementalSchedulingStateId" />.
        /// </summary>
        public void Serialize(BuildXLWriter writer)
        {
            Contract.Requires(writer != null);

            writer.Write(m_machineName);
            writer.Write(m_substSource);
            writer.Write(m_substTarget);
            m_preserveOutputSalt.Serialize(writer);
        }
Exemplo n.º 3
0
 public void SerializeFull(ContentHash contentHash)
 {
     contentHash.Serialize(_buffer, _offset, ContentHash.SerializeHashBytesMethod.Full);
     _offset += ContentHash.SerializedLength;
 }
Exemplo n.º 4
0
 public void Serialize(ContentHash contentHash)
 {
     contentHash.Serialize(_buffer, _offset);
     _offset += contentHash.ByteLength + 1;
 }
Exemplo n.º 5
0
 /// <summary>
 ///     Serialize whole value to a binary writer.
 /// </summary>
 public void Serialize(BuildXLWriter writer)
 {
     ContentHash.Serialize(writer);
     ContentHashList.WriteNullableArray(Output, writer);
 }
Exemplo n.º 6
0
        private async Task StoreBuildManifestHashAsync(ContentHash hash, ContentHash manifestHash)
        {
            (var wf, var sf) = GetBuildManifestHashKey(hash);

            var result = await m_engineCache.TwoPhaseFingerprintStore.TryPublishCacheEntryAsync(wf, hash, sf, new CacheEntry(manifestHash, "", ArrayView <ContentHash> .Empty));

            if (!result.Succeeded)
            {
                Tracing.Logger.Log.ApiServerStoreBuildManifestHashToCacheFailed(m_loggingContext, hash.Serialize(), manifestHash.Serialize(), result.Failure.DescribeIncludingInnerFailures());
            }
        }
Exemplo n.º 7
0
        private async Task <ContentHash?> TryGetBuildManifestHashAsync(ContentHash hash)
        {
            (var wf, var sf) = GetBuildManifestHashKey(hash);

            var result = await m_engineCache.TwoPhaseFingerprintStore.TryGetCacheEntryAsync(wf, hash, sf);

            if (result.Succeeded)
            {
                return(result.Result?.MetadataHash);
            }

            Tracing.Logger.Log.ErrorApiServerGetBuildManifestHashFromCacheFailed(m_loggingContext, hash.Serialize(), result.Failure.DescribeIncludingInnerFailures());
            return(null);
        }