Upraviť

Zdieľať cez


IRecordSequence Interface

Definition

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
Derived
Implements

Remarks

The IRecordSequence interface provides an abstract interface to a record-oriented stream. A IRecordSequence instance can be used to read and write log records.

The IRecordSequence interface provides the following capabilities,

  • Append log records using the Append methods.

  • Read the appended records using the ReadLogRecords method.

  • Write a special restart record using the WriteRestartArea method.

  • Read restart records from the most recently written restart record using the ReadRestartAreas method.

  • 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.

  • Receive TailPinned event notifications to move the base of the log to free space.

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. A log record consists of opaque data, supplied to the IRecordSequence instance in an IList of ArraySegments of bytes.

The IRecordSequence interface also exposes a few basic properties which provides information about log boundaries.

  • The BaseSequenceNumber property contains the sequence number of the first valid record in the record sequence.

  • The LastSequenceNumber property contains a sequence number that is guaranteed to be larger than the sequence number of the last appended record.

  • The RestartSequenceNumber property contains the sequence number of the last written restart area.

  • The MaximumRecordLength property contains the size of the largest record that can be appended to, or read from the sequence.

  • The ReservedBytes property contains the total size of all reservations made in this record sequence.

  • 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.

Properties

BaseSequenceNumber

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.

Methods

AdvanceBaseSequenceNumber(SequenceNumber)

Moves the base sequence number of the log forward.

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

When overridden in a derived class, writes a log record to the IRecordSequence.

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

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)

When overridden in a derived class, appends a log record to the IRecordSequence.

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

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()

When overridden in a derived class, creates a new ReservationCollection.

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

(Inherited from 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>)

When overridden in a derived class, writes a restart area to the IRecordSequence.

WriteRestartArea(ArraySegment<Byte>, SequenceNumber)

When overridden in a derived class, writes a restart area to the IRecordSequence and updates the base sequence number.

WriteRestartArea(ArraySegment<Byte>, SequenceNumber, ReservationCollection)

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>>)

When overridden in a derived class, writes a restart area to the IRecordSequence.

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

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)

When overridden in a derived class, writes a restart area to the IRecordSequence using a reservation, and updates the base sequence number.

Events

TailPinned

Occurs when the record sequence determines that the tail must be moved forward.

Applies to