Exemplo n.º 1
0
        /// <inheritdoc />
        public virtual DirectoryArtifact AddSealDirectory([NotNull] SealDirectory sealDirectory, PipId valuePip)
        {
            AddPip(sealDirectory);
            DirectoryArtifact artifactForNewSeal;

            if (sealDirectory.Kind == SealDirectoryKind.SharedOpaque)
            {
                Contract.Assume(sealDirectory.Directory.IsSharedOpaque);
                artifactForNewSeal = sealDirectory.Directory;
            }
            else
            {
                // For the regular dynamic case, the directory artifact is always
                // created with sealId 0. For other cases, we reserve it
                artifactForNewSeal = sealDirectory.Kind == SealDirectoryKind.Opaque
                    ? DirectoryArtifact.CreateWithZeroPartialSealId(sealDirectory.DirectoryRoot)
                    : SealDirectoryTable.ReserveDirectoryArtifact(sealDirectory);
                sealDirectory.SetDirectoryArtifact(artifactForNewSeal);
            }

            SealDirectoryTable.AddSeal(sealDirectory);
            ComputeStaticFingerprint(sealDirectory);

            return(artifactForNewSeal);
        }
Exemplo n.º 2
0
        private void ReserveAndAddSeal(SealedDirectoryTable table, SealDirectory seal)
        {
            var directoryArtifact = table.ReserveDirectoryArtifact(seal);

            seal.SetDirectoryArtifact(directoryArtifact);
            table.AddSeal(seal);

            XAssert.IsTrue(seal.IsInitialized);

            XAssert.IsTrue(table.TryGetSealForDirectoryArtifact(directoryArtifact, out PipId pipId));
            XAssert.AreEqual(seal.PipId, pipId);
            XAssert.IsTrue(directoryArtifact.IsValid);
        }