RecordAppendOptions 枚举

定义

指定如何追加记录。Specifies how records are appended.

此枚举有一个 FlagsAttribute 属性,允许按位组合成员值。

public enum class RecordAppendOptions
[System.Flags]
public enum RecordAppendOptions
type RecordAppendOptions = 
Public Enum RecordAppendOptions
继承
RecordAppendOptions
属性

字段

ForceAppend 1

追加此记录后,记录序列应开始刷新内部缓冲区的过程。The record sequence should begin the process of flushing internal buffers after this record is appended. 这并不表示在追加操作完成之前应持久写入该记录。This does not indicate that the record should be durably written before the Append operation completes. 若要获得该行为,请指定 ForceFlush 标志。To get that behavior, specify the ForceFlush flag.

ForceFlush 2

追加此记录后,记录序列应刷新所有内部缓冲区。The record sequence should flush any internal buffers after this record is appended. 在追加操作完成时,已持久写入指定的记录。When the Append operation completes, the specified record has been durably written.

None 0

被动地写入数据。Data is written lazily.

示例

下面的示例演示如何结合使用此枚举与 Append 方法,向日志序列追加记录。The following example shows how to use this enumeration with the Append method to append a record to a log sequence.

// Append records. Appending three records.  
public void AppendRecords()
{
    Console.WriteLine("Appending Log Records...");
    SequenceNumber previous = SequenceNumber.Invalid;

    previous = sequence.Append(CreateData("Hello World!"), SequenceNumber.Invalid, SequenceNumber.Invalid, RecordAppendOptions.ForceFlush);
    previous = sequence.Append(CreateData("This is my first Logging App"), SequenceNumber.Invalid, SequenceNumber.Invalid, RecordAppendOptions.ForceFlush);
    previous = sequence.Append(CreateData("Using LogRecordSequence..."), SequenceNumber.Invalid, SequenceNumber.Invalid, RecordAppendOptions.ForceFlush);

    Console.WriteLine("Done...");
}
' Append records. Appending three records.  
Public Sub AppendRecords()
    Console.WriteLine("Appending Log Records...")
    Dim previous As SequenceNumber = SequenceNumber.Invalid

    previous = sequence.Append(CreateData("Hello World!"), SequenceNumber.Invalid, SequenceNumber.Invalid, RecordAppendOptions.ForceFlush)
    previous = sequence.Append(CreateData("This is my first Logging App"), SequenceNumber.Invalid, SequenceNumber.Invalid, RecordAppendOptions.ForceFlush)
    previous = sequence.Append(CreateData("Using LogRecordSequence..."), SequenceNumber.Invalid, SequenceNumber.Invalid, RecordAppendOptions.ForceFlush)

    Console.WriteLine("Done...")
End Sub

适用于