IRecordSequence.ReserveAndAppend 方法

定义

在派生类中重写时,自动生成一个预留,并向序列中追加一条记录。When overridden in a derived class, automatically makes a single reservation and appends a record to the sequence.

重载

ReserveAndAppend(ArraySegment<Byte>, SequenceNumber, SequenceNumber, RecordAppendOptions, ReservationCollection, Int64[])

在派生类中重写时,自动生成一个预留,并向序列中追加一条记录。When overridden in a derived class, automatically makes a single reservation and appends a record to the sequence.

ReserveAndAppend(IList<ArraySegment<Byte>>, SequenceNumber, SequenceNumber, RecordAppendOptions, ReservationCollection, Int64[])

在派生类中重写时,自动生成一个预留,并向序列中追加一条记录。When overridden in a derived class, automatically makes a single reservation and appends a record to the sequence.

ReserveAndAppend(ArraySegment<Byte>, SequenceNumber, SequenceNumber, RecordAppendOptions, ReservationCollection, Int64[])

在派生类中重写时,自动生成一个预留,并向序列中追加一条记录。When overridden in a derived class, automatically makes a single reservation and appends a record to the sequence.

public:
 System::IO::Log::SequenceNumber ReserveAndAppend(ArraySegment<System::Byte> data, System::IO::Log::SequenceNumber nextUndoRecord, System::IO::Log::SequenceNumber previousRecord, System::IO::Log::RecordAppendOptions recordAppendOptions, System::IO::Log::ReservationCollection ^ reservationCollection, ... cli::array <long> ^ reservations);
public System.IO.Log.SequenceNumber ReserveAndAppend (ArraySegment<byte> data, System.IO.Log.SequenceNumber nextUndoRecord, System.IO.Log.SequenceNumber previousRecord, System.IO.Log.RecordAppendOptions recordAppendOptions, System.IO.Log.ReservationCollection reservationCollection, params long[] reservations);
abstract member ReserveAndAppend : ArraySegment<byte> * System.IO.Log.SequenceNumber * System.IO.Log.SequenceNumber * System.IO.Log.RecordAppendOptions * System.IO.Log.ReservationCollection * int64[] -> System.IO.Log.SequenceNumber
Public Function ReserveAndAppend (data As ArraySegment(Of Byte), nextUndoRecord As SequenceNumber, previousRecord As SequenceNumber, recordAppendOptions As RecordAppendOptions, reservationCollection As ReservationCollection, ParamArray reservations As Long()) As SequenceNumber

参数

data
ArraySegment<Byte>

将连接在一起并以记录形式追加的字节数组段的列表。A list of byte array segments that will be concatenated and appended as the record.

nextUndoRecord
SequenceNumber

用户指定顺序中下一条记录的序列号。The sequence number of the next record in the user-specified order.

previousRecord
SequenceNumber

“上一个”顺序中下一条记录的序列号。The sequence number of the next record in Previous order.

recordAppendOptions
RecordAppendOptions

RecordAppendOptions 的一个有效值,用于指定应如何写入数据。A valid value of RecordAppendOptions that specifies how the data should be written.

reservationCollection
ReservationCollection

一个 ReservationCollection,它包含要在其中生成预留的集合。A ReservationCollection that contains the collection to make reservations in.

reservations
Int64[]

要生成的预留(以字节为单位)。The reservations to make, in bytes.

返回

SequenceNumber

追加的日志记录的序列号。The sequence number of the appended log record.

例外

一个或多个自变量无效。One or more of the arguments is invalid.

追加记录时,发生了 I/O 错误。An I/O error occurred while appending the record.

记录序列无法获得足够的可用空间来容纳新记录或生成预留。The record sequence could not make enough free space to contain the new record, or to make the reservation.

该方法是在序列已释放之后调用的。The method was called after the sequence has been disposed of.

注解

包含在 data 参数中的数据将连接成单个字节数组,以便以记录形式追加。Data contained in the data parameter will be concatenated into a single byte array for appending as the record. 但在读取记录时,无法将数据重新拆分为数组段。However, no provision is made for splitting data back into array segments when the record is read.

在原子操作中,使用记录追加操作将指定的预留添加到所提供的预留集合。The specified reservations are added to the provided reservation collection in an atomic operation with a record append operation. 如果追加失败,将不保留任何空间。If the append fails, no space is reserved.

通常,此方法可以在写入记录之前完成。Normally, this method may complete before the record has been written. 若要确保记录已写入,请使用 ForceFlush 参数指定 recordAppendOptions 标志,或者调用 Flush 方法。To ensure that a record has been written, either specify the ForceFlush flag using the recordAppendOptions parameter, or call the Flush method.

适用于

ReserveAndAppend(IList<ArraySegment<Byte>>, SequenceNumber, SequenceNumber, RecordAppendOptions, ReservationCollection, Int64[])

在派生类中重写时,自动生成一个预留,并向序列中追加一条记录。When overridden in a derived class, automatically makes a single reservation and appends a record to the sequence.

public:
 System::IO::Log::SequenceNumber ReserveAndAppend(System::Collections::Generic::IList<ArraySegment<System::Byte>> ^ data, System::IO::Log::SequenceNumber nextUndoRecord, System::IO::Log::SequenceNumber previousRecord, System::IO::Log::RecordAppendOptions recordAppendOptions, System::IO::Log::ReservationCollection ^ reservationCollection, ... cli::array <long> ^ reservations);
public System.IO.Log.SequenceNumber ReserveAndAppend (System.Collections.Generic.IList<ArraySegment<byte>> data, System.IO.Log.SequenceNumber nextUndoRecord, System.IO.Log.SequenceNumber previousRecord, System.IO.Log.RecordAppendOptions recordAppendOptions, System.IO.Log.ReservationCollection reservationCollection, params long[] reservations);
abstract member ReserveAndAppend : System.Collections.Generic.IList<ArraySegment<byte>> * System.IO.Log.SequenceNumber * System.IO.Log.SequenceNumber * System.IO.Log.RecordAppendOptions * System.IO.Log.ReservationCollection * int64[] -> System.IO.Log.SequenceNumber
Public Function ReserveAndAppend (data As IList(Of ArraySegment(Of Byte)), nextUndoRecord As SequenceNumber, previousRecord As SequenceNumber, recordAppendOptions As RecordAppendOptions, reservationCollection As ReservationCollection, ParamArray reservations As Long()) As SequenceNumber

参数

data
IList<ArraySegment<Byte>>

将连接在一起并以记录形式追加的字节数组段的列表。A list of byte array segments that will be concatenated and appended as the record.

nextUndoRecord
SequenceNumber

用户指定顺序中下一条记录的序列号。The sequence number of the next record in the user-specified order.

previousRecord
SequenceNumber

“上一个”顺序中下一条记录的序列号。The sequence number of the next record in Previous order.

recordAppendOptions
RecordAppendOptions

RecordAppendOptions 的一个有效值,用于指定应如何写入数据。A valid value of RecordAppendOptions that specifies how the data should be written.

reservationCollection
ReservationCollection

要在其中生成预留的预留集合。The reservation collection to make reservations in.

reservations
Int64[]

要生成的预留(以字节为单位)。The reservations to make, in bytes.

返回

SequenceNumber

追加的日志记录的序列号。The sequence number of the appended log record.

例外

一个或多个自变量无效。One or more of the arguments is invalid.

追加记录时,发生了 I/O 错误。An I/O error occurred while appending the record.

记录序列无法获得足够的可用空间来容纳新记录或生成预留。The record sequence could not make enough free space to contain the new record, or to make the reservation.

该方法是在序列已释放之后调用的。The method was called after the sequence has been disposed of.

注解

包含在 data 参数中的数据将连接成单个字节数组,以便以记录形式追加。Data contained in the data parameter will be concatenated into a single byte array for appending as the record. 但在读取记录时,无法将数据重新拆分为数组段。However, no provision is made for splitting data back into array segments when the record is read.

在原子操作中,使用记录追加操作将指定的预留添加到所提供的预留集合。The specified reservations are added to the provided reservation collection in an atomic operation with a record append operation. 如果追加失败,将不保留任何空间。If the append fails, no space is reserved.

通常,此方法可以在写入记录之前完成。Normally, this method may complete before the record has been written. 若要确保记录已写入,请使用 ForceFlush 参数指定 recordAppendOptions 标志,或者调用 Flush 方法。To ensure that a record has been written, either specify the ForceFlush flag using the recordAppendOptions parameter, or call the Flush method.

适用于