internal LogAppendAsyncResult(LogRecordSequence recordSequence, AsyncCallback callback, object state) : base(callback, state) { this.state = new LogReserveAndAppendState(); this.state.RecordSequence = recordSequence; this.state.AsyncResult = this; }
public SequenceNumber ReserveAndAppend( IList <ArraySegment <byte> > data, SequenceNumber userRecord, SequenceNumber previousRecord, RecordAppendOptions recordAppendOptions, ReservationCollection reservationCollection, params long[] reservations) { long totalRecordSize; LogReservationCollection lrc; this.store.ValidateSequenceNumber( ref userRecord, SequenceNumberConstraint.Arbitrary, "userRecord"); this.store.ValidateSequenceNumber( ref previousRecord, SequenceNumberConstraint.Arbitrary, "previousRecord"); totalRecordSize = ValidateData(data); lrc = ValidateReservationCollection(reservationCollection); if (lrc == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(Error.ArgumentNull("reservationCollection")); } if (reservations == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(Error.ArgumentNull("reservations")); } ValidateReservations(reservations); EnsureMarshalContext(); LogReserveAndAppendState state = new LogReserveAndAppendState(); state.RecordSequence = this; state.Data = data; state.TotalRecordSize = totalRecordSize; state.UserLsn = userRecord.High; state.PreviousLsn = previousRecord.High; state.RecordAppendOptions = recordAppendOptions; state.ReservationCollection = lrc; state.Reservations = reservations; state.Start(); return(new SequenceNumber(state.ResultLsn)); }
public SequenceNumber Append( IList <ArraySegment <byte> > data, SequenceNumber userRecord, SequenceNumber previousRecord, RecordAppendOptions recordAppendOptions, ReservationCollection reservations) { long totalRecordSize; LogReservationCollection lrc; if ((this.store.Access & FileAccess.Write) == 0) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(Error.NotSupported(SR.NotSupported_ReadOnly)); } if (recordAppendOptions > (RecordAppendOptions.ForceAppend | RecordAppendOptions.ForceFlush) || recordAppendOptions < RecordAppendOptions.None) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(Error.ArgumentOutOfRange("recordAppendOptions")); } this.store.ValidateSequenceNumber( ref userRecord, SequenceNumberConstraint.Arbitrary, "userRecord"); this.store.ValidateSequenceNumber( ref previousRecord, SequenceNumberConstraint.Arbitrary, "previousRecord"); totalRecordSize = ValidateData(data); lrc = ValidateReservationCollection(reservations); EnsureMarshalContext(); LogReserveAndAppendState state = new LogReserveAndAppendState(); state.RecordSequence = this; state.Data = data; state.TotalRecordSize = totalRecordSize; state.UserLsn = userRecord.High; state.PreviousLsn = previousRecord.High; state.RecordAppendOptions = recordAppendOptions; state.ReservationCollection = lrc; state.Start(); return(new SequenceNumber(state.ResultLsn)); }