Beispiel #1
0
        public static Snapshot DecodeSnapshot(Stream input)
        {
            using var decoder = new DSDecoderV2(input);
            var ds = DeleteSet.Read(decoder);
            var sv = EncodingUtils.ReadStateVector(decoder);

            return(new Snapshot(ds, sv));
        }
Beispiel #2
0
        /// <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);
        }