Exemple #1
0
        public IAsyncResult BeginWriteRestartArea(
            IList <ArraySegment <byte> > data,
            SequenceNumber newBaseSeqNum,
            ReservationCollection reservationCollection,
            AsyncCallback callback,
            object state)
        {
            long totalRecordSize;
            LogReservationCollection lrc;

            this.store.ValidateSequenceNumber(
                ref newBaseSeqNum,
                SequenceNumberConstraint.Arbitrary,
                "newBaseSeqNum");

            totalRecordSize = ValidateData(data);
            lrc             = ValidateReservationCollection(reservationCollection);

            EnsureMarshalContext();

            LogWriteRestartAreaAsyncResult result;

            result = new LogWriteRestartAreaAsyncResult(this,
                                                        callback,
                                                        state);
            result.Data                  = data;
            result.TotalRecordSize       = totalRecordSize;
            result.NewBaseLsn            = newBaseSeqNum.High;
            result.ReservationCollection = lrc;

            result.Start();

            return(result);
        }
Exemple #2
0
        public SequenceNumber EndWriteRestartArea(
            IAsyncResult result)
        {
            LogWriteRestartAreaAsyncResult lar = result as LogWriteRestartAreaAsyncResult;

            if (lar == null)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(Error.InvalidAsyncResult());
            }

            lar.End();

            return(new SequenceNumber(lar.ResultLsn));
        }