예제 #1
0
파일: Transaction.cs 프로젝트: alex521/ycs
        /// <returns>Whether the data was written.</returns>
        internal bool WriteUpdateMessageFromTransaction(IUpdateEncoder encoder)
        {
            if (DeleteSet.Clients.Count == 0 && !AfterState.Any(kvp => !BeforeState.TryGetValue(kvp.Key, out var clockB) || kvp.Value != clockB))
            {
                return(false);
            }

            DeleteSet.SortAndMergeDeleteSet();
            EncodingUtils.WriteClientsStructs(encoder, Doc.Store, BeforeState);
            DeleteSet.Write(encoder);

            return(true);
        }
예제 #2
0
파일: Transaction.cs 프로젝트: alex521/ycs
        /// <summary>
        /// If 'type.parent' was added in current transaction, 'type' technically did not change,
        /// it was just added and we should not fire events for 'type'.
        /// </summary>
        internal void AddChangedTypeToTransaction(AbstractType type, string parentSub)
        {
            var item = type._item;

            if (item == null || (BeforeState.TryGetValue(item.Id.Client, out int clock) && item.Id.Clock < clock && !item.Deleted))
            {
                if (!Changed.TryGetValue(type, out var set))
                {
                    set           = new HashSet <string>();
                    Changed[type] = set;
                }

                set.Add(parentSub);
            }
        }