IRecordSequence 接口

定义

提供一系列记录的泛型接口。Provides a generic interface to a sequence of records.

public interface class IRecordSequence : IDisposable
public interface IRecordSequence : IDisposable
type IRecordSequence = interface
    interface IDisposable
Public Interface IRecordSequence
Implements IDisposable
派生
实现

注解

IRecordSequence 接口提供了面向记录的流的抽象接口。The IRecordSequence interface provides an abstract interface to a record-oriented stream. IRecordSequence 实例可用于读取和写入日志记录。A IRecordSequence instance can be used to read and write log records.

IRecordSequence 接口提供以下功能:The IRecordSequence interface provides the following capabilities,

  • 使用 Append 方法追加日志记录。Append log records using the Append methods.

  • 使用 ReadLogRecords 方法读取追加的记录。Read the appended records using the ReadLogRecords method.

  • 使用 WriteRestartArea 方法写入特殊的重新开始记录。Write a special restart record using the WriteRestartArea method.

  • 使用 ReadRestartAreas 方法从最近写入的重新开始记录中读取重新开始记录。Read restart records from the most recently written restart record using the ReadRestartAreas method.

  • 使用 Flush 方法将记录刷新到持久存储区。Flush the records to durable store using the Flush method.

  • 为要追加的记录保留空间。Reserve space for appending records.

  • 通过前调日志基数来释放日志空间。Free log space by advancing the base of the log.

  • 接收 TailPinned 事件通知,移动日志的基数以释放空间。Receive TailPinned event notifications to move the base of the log to free space.

日志记录被追加到 IRecordSequence 实例,每条日志记录都分配有一个唯一的序号。Log records are appended to a IRecordSequence instance, and each log record is given a unique sequence number. 在给定的记录序列中,序号是严格递增的。Sequence numbers are strictly monotonically increasing within a given record sequence. 日志记录由不透明数据组成,它们以字节数组段的 IRecordSequence 的形式提供给 IList 实例。A log record consists of opaque data, supplied to the IRecordSequence instance in an IList of ArraySegments of bytes.

IRecordSequence 接口还公开一些基本属性,这些属性提供有关日志边界的信息。The IRecordSequence interface also exposes a few basic properties which provides information about log boundaries.

  • BaseSequenceNumber 属性包含记录序列中第一条有效记录的序列号。The BaseSequenceNumber property contains the sequence number of the first valid record in the record sequence.

  • LastSequenceNumber 属性包含一个序列号,并且保证它大于最后追加的记录的序列号。The LastSequenceNumber property contains a sequence number that is guaranteed to be larger than the sequence number of the last appended record.

  • RestartSequenceNumber 属性包含最后写入的重新开始区域的序列号。The RestartSequenceNumber property contains the sequence number of the last written restart area.

  • MaximumRecordLength 属性包含可以追加到序列或从序列中读取的最大记录的大小。The MaximumRecordLength property contains the size of the largest record that can be appended to, or read from the sequence.

  • ReservedBytes 属性包含在此记录序列中做出的所有预留的总大小。The ReservedBytes property contains the total size of all reservations made in this record sequence.

  • 如果将 RetryAppend 属性设置为 true,且 Append 操作因为序列中没有空间而失败,则记录序列将尝试释放空间,然后重试追加操作。If the RetryAppend property is set to true, and an Append operation fails because there is no space in the sequence, the record sequence will attempt to free space, and retry the Append operation.

属性

BaseSequenceNumber

在派生类中重写时,获取当前 IRecordSequence 中第一条有效记录的序列号。When overridden in a derived class, gets the sequence number of the first valid record in the current IRecordSequence.

LastSequenceNumber

在派生类中重写时,获取比追加的最新记录大的序列号。When overridden in a derived class, gets the sequence number which is greater than the last record appended.

MaximumRecordLength

在派生类中重写时,获取可以追加到此序列或者从此序列中读取的最大记录的大小(以字节为单位)。When overridden in a derived class, gets the size of the largest record that can be appended to or read from this sequence, in bytes.

ReservedBytes

在派生类中重写时,获取已保留的总字节数。When overridden in a derived class, gets the total number of bytes that have been reserved.

RestartSequenceNumber

在派生类中重写时,获取最近写入的重新开始区域的序列号。When overridden in a derived class, gets the sequence number of the most recently written restart area.

RetryAppend

获取或设置一个值,该值指示如果日志已满,是否自动重试追加操作。Gets or sets a value indicating whether appends are automatically retried if the log is full.

方法

AdvanceBaseSequenceNumber(SequenceNumber)

前移日志的基序列号。Moves the base sequence number of the log forward.

Append(ArraySegment<Byte>, SequenceNumber, SequenceNumber, RecordAppendOptions)

在派生类中重写时,向 IRecordSequence 写入一条日志记录。When overridden in a derived class, writes a log record to the IRecordSequence.

Append(ArraySegment<Byte>, SequenceNumber, SequenceNumber, RecordAppendOptions, ReservationCollection)

在派生类中重写时,将使用序列中先前保留的空间向 IRecordSequence 中追加一条日志记录。When overridden in a derived class, appends a log record to the IRecordSequence, using space previously reserved in the sequence.

Append(IList<ArraySegment<Byte>>, SequenceNumber, SequenceNumber, RecordAppendOptions)

在派生类中重写时,向 IRecordSequence 中追加一条日志记录。When overridden in a derived class, appends a log record to the IRecordSequence.

Append(IList<ArraySegment<Byte>>, SequenceNumber, SequenceNumber, RecordAppendOptions, ReservationCollection)

在派生类中重写时,将使用序列中先前保留的空间向 IRecordSequence 中追加一条日志记录。When overridden in a derived class, appends a log record to the IRecordSequence, using space previously reserved in the sequence.

BeginAppend(ArraySegment<Byte>, SequenceNumber, SequenceNumber, RecordAppendOptions, AsyncCallback, Object)

在派生类中重写时,开始异步追加操作。When overridden in a derived class, begins an asynchronous append operation.

BeginAppend(ArraySegment<Byte>, SequenceNumber, SequenceNumber, RecordAppendOptions, ReservationCollection, AsyncCallback, Object)

在派生类中重写时,将使用序列中先前保留的空间来开始异步追加操作。When overridden in a derived class, begins an asynchronous append operation using space previously reserved in the sequence.

BeginAppend(IList<ArraySegment<Byte>>, SequenceNumber, SequenceNumber, RecordAppendOptions, AsyncCallback, Object)

在派生类中重写时,将使用序列中先前保留的空间来开始异步追加操作。When overridden in a derived class, begins an asynchronous append operation, using space previously reserved in the sequence.

BeginAppend(IList<ArraySegment<Byte>>, SequenceNumber, SequenceNumber, RecordAppendOptions, ReservationCollection, AsyncCallback, Object)

在派生类中重写时,将使用序列中先前保留的空间来开始异步追加操作。When overridden in a derived class, begins an asynchronous append operation, using space previously reserved in the sequence.

BeginFlush(SequenceNumber, AsyncCallback, Object)

在派生类中重写时,将使用序列中先前保留的空间来开始异步刷新操作。When overridden in a derived class, begins an asynchronous flush operation, using space previously reserved in the sequence.

BeginReserveAndAppend(ArraySegment<Byte>, SequenceNumber, SequenceNumber, RecordAppendOptions, ReservationCollection, Int64[], AsyncCallback, Object)

在派生类中重写时,开始异步保留和追加操作。When overridden in a derived class, begins an asynchronous reserve and append operation.

BeginReserveAndAppend(IList<ArraySegment<Byte>>, SequenceNumber, SequenceNumber, RecordAppendOptions, ReservationCollection, Int64[], AsyncCallback, Object)

在派生类中重写时,开始异步保留和追加操作。When overridden in a derived class, begins an asynchronous reserve and append operation.

BeginWriteRestartArea(ArraySegment<Byte>, SequenceNumber, ReservationCollection, AsyncCallback, Object)

在派生类中重写时,将使用序列中先前保留的空间来开始异步重新开始区域写入操作。When overridden in a derived class, begins an asynchronous restart area write operation, using space previously reserved in the sequence.

BeginWriteRestartArea(IList<ArraySegment<Byte>>, SequenceNumber, ReservationCollection, AsyncCallback, Object)

在派生类中重写时,将使用序列中先前保留的空间来开始异步重新开始区域写入操作。When overridden in a derived class, begins an asynchronous restart area write operation, using space previously reserved in the sequence.

CreateReservationCollection()

在派生的类中重写时,创建一个新的 ReservationCollectionWhen overridden in a derived class, creates a new ReservationCollection.

Dispose()

执行与释放或重置非托管资源关联的应用程序定义的任务。Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

(继承自 IDisposable)
EndAppend(IAsyncResult)

在派生类中重写时,结束异步追加操作。When overridden in a derived class, ends an asynchronous append operation.

EndFlush(IAsyncResult)

在派生类中重写时,结束异步刷新操作。When overridden in a derived class, ends an asynchronous flush operation.

EndReserveAndAppend(IAsyncResult)

在派生类中重写时,结束异步保留和追加操作。When overridden in a derived class, ends an asynchronous reserve and append operation.

EndWriteRestartArea(IAsyncResult)

在派生类中重写时,结束异步重新开始区域写入操作。When overridden in a derived class, ends an asynchronous restart area write operation.

Flush()

在派生类中重写时,确保所有追加的记录都已写入。When overridden in a derived class, ensures that all appended records have been written.

Flush(SequenceNumber)

在派生类中重写时,确保其序列号不高于指定序列号的所有记录都已持久写入。When overridden in a derived class, ensures that all appended records up to and including the record with the specified sequence number have been durably written.

ReadLogRecords(SequenceNumber, LogRecordEnumeratorType)

在派生类中重写时,返回序列中记录的可枚举集合。When overridden in a derived class, returns an enumerable collection of records in the sequence.

ReadRestartAreas()

在派生类中重写时,返回序列中重新开始区域的可枚举集合。When overridden in a derived class, returns an enumerable collection of the restart areas in 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.

WriteRestartArea(ArraySegment<Byte>)

在派生类中重写时,向 IRecordSequence 中写入一个重新开始区域。When overridden in a derived class, writes a restart area to the IRecordSequence.

WriteRestartArea(ArraySegment<Byte>, SequenceNumber)

在派生类中重写时,向 IRecordSequence 中写入一个重新开始区域,并更新基序列号。When overridden in a derived class, writes a restart area to the IRecordSequence and updates the base sequence number.

WriteRestartArea(ArraySegment<Byte>, SequenceNumber, ReservationCollection)

在派生类中重写时,利用预留向 IRecordSequence 中写入一个重新开始区域,并更新基序列号。When overridden in a derived class, writes a restart area to the IRecordSequence using a reservation, and updates the base sequence number.

WriteRestartArea(IList<ArraySegment<Byte>>)

在派生类中重写时,向 IRecordSequence 中写入一个重新开始区域。When overridden in a derived class, writes a restart area to the IRecordSequence.

WriteRestartArea(IList<ArraySegment<Byte>>, SequenceNumber)

在派生类中重写时,向 IRecordSequence 中写入一个重新开始区域,并更新基序列号。When overridden in a derived class, writes a restart area to the IRecordSequence and updates the base sequence number.

WriteRestartArea(IList<ArraySegment<Byte>>, SequenceNumber, ReservationCollection)

在派生类中重写时,利用预留向 IRecordSequence 中写入一个重新开始区域,并更新基序列号。When overridden in a derived class, writes a restart area to the IRecordSequence using a reservation, and updates the base sequence number.

事件

TailPinned

当记录序列确定必须前移尾数据时发生。Occurs when the record sequence determines that the tail must be moved forward.

适用于