Ejemplo n.º 1
0
        /// <summary>
        /// Adds a gtid value to the GtidSet.
        /// </summary>
        public bool AddGtid(IGtid value)
        {
            var     gtid = (Gtid)value;
            UuidSet uuidSet;

            if (!UuidSets.TryGetValue(gtid.SourceId, out uuidSet))
            {
                uuidSet = new UuidSet(gtid.SourceId, new List <Interval>());
                UuidSets[gtid.SourceId] = uuidSet;
            }
            return(uuidSet.AddGtid(gtid));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Parses <see cref="PreviousGtidsEvent"/> from the buffer.
        /// </summary>
        public IBinlogEvent ParseEvent(EventHeader header, ref PacketReader reader)
        {
            long uuidSetNumber = reader.ReadInt64LittleEndian();
            var  gtidSet       = new GtidSet();

            for (long i = 0; i < uuidSetNumber; i++)
            {
                var sourceId = new Uuid(reader.ReadByteArraySlow(16));
                var uuidSet  = new UuidSet(sourceId, new List <Interval>());

                long intervalNumber = reader.ReadInt64LittleEndian();
                for (long y = 0; y < intervalNumber; y++)
                {
                    long start = reader.ReadInt64LittleEndian();
                    long end   = reader.ReadInt64LittleEndian();
                    uuidSet.Intervals.Add(new Interval(start, end));
                }
                gtidSet.UuidSets[sourceId] = uuidSet;
            }

            return(new PreviousGtidsEvent(header, gtidSet));
        }