共用方式為


PolicyUnit 結構

定義

表示記錄存放區原則中的大小度量單位。

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

範例

這個範例將示範如何使用 LogPolicy 類別和 PolicyUnit 結構來為記錄檔記錄順序設定原則。

// 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 結構表示記錄存放區原則中的大小度量單位。 PolicyUnitType 列舉型別 (Enumeration) 列出可以表示的度量單位。

您可以使用 Value 屬性判斷度量單位的大小。 若要判斷度量的單位,請使用 Type 屬性。 您可以使用 PolicyUnitPercentage 方法,將其他資料型別轉換為 Extents

建構函式

PolicyUnit(Int64, PolicyUnitType)

使用指定的值和型別,初始化 PolicyUnit 結構的新執行個體。

屬性

Type

取得 PolicyUnit 的單位類型。

Value

取得 PolicyUnit 的值。

方法

Equals(Object)

指示這個執行個體和指定的物件是否相等。

Extents(Int64)

根據指定的數字,建立類型為 PolicyUnitExtents

GetHashCode()

提供此物件的唯一雜湊程式碼。

Percentage(Int64)

根據指定的數字,建立類型為 PolicyUnitPercentage

ToString()

傳回這個物件的字串表示。

運算子

Equality(PolicyUnit, PolicyUnit)

比較兩個 PolicyUnit 執行個體,判斷它們是否相等。

Inequality(PolicyUnit, PolicyUnit)

比較兩個 PolicyUnit 執行個體,判斷它們是否不相等。

適用於

另請參閱