Beispiel #1
0
        private async Task <Possible <FullCacheRecordWithDeterminism, Failure> > AddToCache(ICacheSession session, params string[] thePaths)
        {
            WeakFingerprintHash weak    = FakeStrongFingerprint.CreateWeak(session.CacheId);
            CasHash             casHash = await AddPathSet(session, thePaths);

            Hash simpleHash = FakeStrongFingerprint.CreateHash(session.CacheSessionId);

            return(await session.AddOrGetAsync(weak, casHash, simpleHash, CasEntries.FromCasHashes(casHash)));
        }
Beispiel #2
0
        /// <summary>
        /// This will do a build into the session with a given name
        /// and output count.
        /// </summary>
        /// <param name="session">The cache session to work with</param>
        /// <param name="pipName">Some text that acts as a base element in the output</param>
        /// <param name="pipSize">Number of elements in the output.  Must be enough to cover the variants</param>
        /// <param name="accessMethod">Method (File or stream) for how files are materialized from the cache</param>
        /// <param name="determinism">Determinism to provide for new build records</param>
        /// <param name="generateVerifiablePip">Indicates that the pip generated should be verfiiable by CheckContentAsync</param>
        /// <returns>The FullCacheRecord of the build</returns>
        /// <remarks>
        /// This will do a "fake build" including a cache lookup via weak fingerprints
        /// and then return either the existing FullCacheRecord or add the build as a new
        /// one.  A new FullCacheRecord will have the StrongFingerprint.CacheId set to NewRecordCacheId.
        ///
        /// The outputs of this pip will be unique for each call, but have the same strong fingerprint.
        ///
        /// The WeakFingerprint and input hash element are derived from the pipName.
        /// </remarks>
        public static Task <FullCacheRecord> DoNonDeterministicPipAsync(
            ICacheSession session,
            string pipName,
            bool generateVerifiablePip = false,
            int pipSize = DefaultFakeBuildSize,
            CacheDeterminism determinism = default(CacheDeterminism),
            CasAccessMethod accessMethod = CasAccessMethod.Stream)
        {
            Contract.Requires(session != null);
            Contract.Requires(pipName != null);
            Contract.Requires(pipSize > 0);

            FakeStrongFingerprint fakePrint = FakeStrongFingerprint.Create(pipName, generateVerifiablePip, pipSize);

            return(DoPipAsyncImpl(session, fakePrint.WeakFingerprint, fakePrint.HashElement, fakePrint.FakeBuild, determinism, accessMethod));
        }