PolicyUnit PolicyUnit PolicyUnit PolicyUnit Struct

定義

表示記錄存放區原則中的大小度量單位。Represents a size measurement in a log store policy.

public value class PolicyUnit
public struct PolicyUnit
type PolicyUnit = struct
Public Structure PolicyUnit
繼承
PolicyUnitPolicyUnitPolicyUnitPolicyUnit

範例

這個範例將示範如何使用 LogPolicy 類別和 PolicyUnit 結構來為記錄檔記錄順序設定原則。This example shows how to use the LogPolicy class and PolicyUnit structure to set policy for a log record sequence.

// SET LOG POLICY

LogPolicy policy = sequence.LogStore.Policy;

// Set AutoGrow policy. This enables the log to automatically grow
// when the existing extents are full. New extents are added until
// we reach the MaximumExtentCount extents.
// AutoGrow policy is supported only in Windows Vista and not available in R2.

//policy.AutoGrow = true;

// Set the Growth Rate in terms of extents. This policy specifies
// "how much" the log should grow. 
policy.GrowthRate = new PolicyUnit(2, PolicyUnitType.Extents);

// Set the AutoShrink policy. This enables the log to automatically
// shrink if the available free space exceeds the shrink percentage. 
// AutoGrow/shrink policy is supported only in Windows Vista and not available in R2.

//policy.AutoShrinkPercentage = new PolicyUnit(30, PolicyUnitType.Percentage);

// Set the PinnedTailThreshold policy.
// A tail pinned event is triggered when there is no
// log space available and log space may be freed by advancing the base.
// The user must handle the tail pinned event by advancing the base of the log. 
// If the user is not able to move the base of the log, the user should report with exception in
// the tail pinned handler.
// PinnedTailThreashold policy dictates the amount of space that the TailPinned event requests 
// for advancing the base of the log. The amount of space can be in percentage or in terms of bytes 
// which is rounded off to the nearest containers in CLFS. The default is 35 percent.


policy.PinnedTailThreshold = new PolicyUnit(10, PolicyUnitType.Percentage);

// Set the maximum extents the log can have.
policy.MaximumExtentCount = 6;

// Set the minimum extents the log can have.
policy.MinimumExtentCount = 2;

// Set the prefix for new containers that are added. 
// when AutoGrow is enabled.
//policy.NewExtentPrefix = "MyLogPrefix";

// Set the suffix number for new containers that are added.
// when AutoGrow is enabled. 
policy.NextExtentSuffix = 3;

// Commit the log policy.
policy.Commit();

// Refresh updates the IO.Log policy properties with current log policy 
// set in the log. 
policy.Refresh();

// LOG POLICY END
// 
' SET LOG POLICY

Dim policy As LogPolicy = sequence.LogStore.Policy

' Set AutoGrow policy. This enables the log to automatically grow
' when the existing extents are full. New extents are added until
' we reach the MaximumExtentCount extents.
' AutoGrow policy is supported only in Windows Vista and not available in R2.

'policy.AutoGrow = true;

' Set the Growth Rate in terms of extents. This policy specifies
' "how much" the log should grow. 
policy.GrowthRate = New PolicyUnit(2, PolicyUnitType.Extents)

' Set the AutoShrink policy. This enables the log to automatically
' shrink if the available free space exceeds the shrink percentage. 
' AutoGrow/shrink policy is supported only in Windows Vista and not available in R2.

'policy.AutoShrinkPercentage = new PolicyUnit(30, PolicyUnitType.Percentage);

' Set the PinnedTailThreshold policy.
' A tail pinned event is triggered when there is no
' log space available and log space may be freed by advancing the base.
' The user must handle the tail pinned event by advancing the base of the log. 
' If the user is not able to move the base of the log, the user should report with exception in
' the tail pinned handler.
' PinnedTailThreashold policy dictates the amount of space that the TailPinned event requests 
' for advancing the base of the log. The amount of space can be in percentage or in terms of bytes 
' which is rounded off to the nearest containers in CLFS. The default is 35 percent.


policy.PinnedTailThreshold = New PolicyUnit(10, PolicyUnitType.Percentage)

' Set the maximum extents the log can have.
policy.MaximumExtentCount = 6

' Set the minimum extents the log can have.
policy.MinimumExtentCount = 2

' Set the prefix for new containers that are added. 
' when AutoGrow is enabled.
'policy.NewExtentPrefix = "MyLogPrefix";

' Set the suffix number for new containers that are added.
' when AutoGrow is enabled. 
policy.NextExtentSuffix = 3

' Commit the log policy.
policy.Commit()

' Refresh updates the IO.Log policy properties with current log policy 
' set in the log. 
policy.Refresh()

' LOG POLICY END
' 

備註

PolicyUnit 結構表示記錄存放區原則中的大小度量單位。The PolicyUnit structure represents a size measurement in a log store policy. PolicyUnitType 列舉型別 (Enumeration) 列出可以表示的度量單位。The PolicyUnitType enumeration lists the units of measurement that can be represented.

您可以使用 Value 屬性判斷度量單位的大小。You can use the Value property to determine the size of the measurement. 若要判斷度量的單位,請使用 Type 屬性。To determine the unit of measurement, use the Type property. 您可以使用 PolicyUnitPercentage 方法,將其他資料型別轉換為 ExtentsYou can convert other data types to a PolicyUnit by using the Percentage and Extents methods.

建構函式

PolicyUnit(Int64, PolicyUnitType) PolicyUnit(Int64, PolicyUnitType) PolicyUnit(Int64, PolicyUnitType) PolicyUnit(Int64, PolicyUnitType)

使用指定的值和型別,初始化 PolicyUnit 結構的新執行個體。Initializes a new instance of the PolicyUnit structure with the specified value and type.

屬性

Type Type Type Type

取得 PolicyUnit 的單位類型。Gets the unit type of the PolicyUnit.

Value Value Value Value

取得 PolicyUnit 的值。Gets the value of the PolicyUnit.

方法

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

指示這個執行個體和指定的物件是否相等。Indicates whether this instance and a specified object are equal.

Extents(Int64) Extents(Int64) Extents(Int64) Extents(Int64)

根據指定的數字,建立類型為 PolicyUnitExtentsCreates a PolicyUnit of type Extents from the specified number.

GetHashCode() GetHashCode() GetHashCode() GetHashCode()

提供此物件的唯一雜湊程式碼。Provides a unique hash code for this object.

Percentage(Int64) Percentage(Int64) Percentage(Int64) Percentage(Int64)

根據指定的數字,建立類型為 PolicyUnitPercentageCreates a PolicyUnit of type Percentage from the specified number.

ToString() ToString() ToString() ToString()

傳回這個物件的字串表示。Returns a string representation of this object.

運算子

Equality(PolicyUnit, PolicyUnit) Equality(PolicyUnit, PolicyUnit) Equality(PolicyUnit, PolicyUnit) Equality(PolicyUnit, PolicyUnit)

比較兩個 PolicyUnit 執行個體,判斷它們是否相等。Compares two PolicyUnit instances to determine whether they are equal.

Inequality(PolicyUnit, PolicyUnit) Inequality(PolicyUnit, PolicyUnit) Inequality(PolicyUnit, PolicyUnit) Inequality(PolicyUnit, PolicyUnit)

比較兩個 PolicyUnit 執行個體,判斷它們是否不相等。Compares two PolicyUnit instances to determine whether they are not equal.

適用於

另請參閱