Esempio n. 1
0
        /// <summary>
        /// TBD
        /// </summary>
        /// <param name="from">TBD</param>
        /// <param name="pruningPerformed"></param>
        /// <exception cref="ArgumentException">TBD</exception>
        /// <returns>TBD</returns>
        internal DataEnvelope Prune(UniqueAddress from, PruningPerformed pruningPerformed)
        {
            if (Data is IRemovedNodePruning dataWithRemovedNodePruning)
            {
                if (!Pruning.TryGetValue(from, out var state))
                {
                    throw new ArgumentException($"Can't prune {@from} since it's not found in DataEnvelope");
                }

                if (state is PruningInitialized initialized)
                {
                    var prunedData = dataWithRemovedNodePruning.Prune(from, initialized.Owner);
                    return(new DataEnvelope(data: prunedData, pruning: Pruning.SetItem(from, pruningPerformed), deltaVersions: CleanedDeltaVersions(from)));
                }
            }
            return(this);
        }
Esempio n. 2
0
        /// <summary>
        /// TBD
        /// </summary>
        /// <param name="from">TBD</param>
        /// <param name="pruningPerformed"></param>
        /// <exception cref="ArgumentException">TBD</exception>
        /// <returns>TBD</returns>
        internal DataEnvelope Prune(UniqueAddress from, PruningPerformed pruningPerformed)
        {
            var dataWithRemovedNodePruning = Data as IRemovedNodePruning;

            if (dataWithRemovedNodePruning != null)
            {
                IPruningState state;
                if (!Pruning.TryGetValue(from, out state))
                {
                    throw new ArgumentException($"Can't prune {@from} since it's not found in DataEnvelope");
                }

                var initialized = state as PruningInitialized;
                if (initialized != null)
                {
                    var prunedData = dataWithRemovedNodePruning.Prune(from, initialized.Owner);
                    return(new DataEnvelope(data: prunedData, pruning: Pruning.SetItem(from, pruningPerformed), deltaVersions: CleanedDeltaVersions(from)));
                }
            }
            return(this);
        }
Esempio n. 3
0
 /// <summary>
 /// TBD
 /// </summary>
 /// <param name="removed">TBD</param>
 /// <param name="owner">TBD</param>
 /// <returns>TBD</returns>
 internal DataEnvelope InitRemovedNodePruning(UniqueAddress removed, UniqueAddress owner) =>
 new DataEnvelope(Data, Pruning.SetItem(removed, new PruningInitialized(owner, ImmutableHashSet <Address> .Empty)));