Пример #1
0
        private DataEnvelope DataEnvelopeFromProto(Proto.Msg.DataEnvelope proto)
        {
            var data    = (IReplicatedData)_ser.OtherMessageFromProto(proto.Data);
            var pruning = PruningFromProto(proto.Pruning);
            var vvector =
                proto.DeltaVersions != null
                ? _ser.VersionVectorFromProto(proto.DeltaVersions)
                : VersionVector.Empty;

            return(new DataEnvelope(data, pruning, vvector));
        }
Пример #2
0
        private Proto.Msg.DataEnvelope DataEnvelopeToProto(DataEnvelope msg)
        {
            var proto = new Proto.Msg.DataEnvelope
            {
                Data = this.OtherMessageToProto(msg.Data)
            };

            foreach (var entry in msg.Pruning)
            {
                proto.Pruning.Add(PruningToProto(entry.Key, entry.Value));
            }

            if (!msg.DeltaVersions.IsEmpty)
            {
                proto.DeltaVersions = SerializationSupport.VersionVectorToProto(msg.DeltaVersions);
            }

            return(proto);
        }