LogPolicy Klasa

Definicja

Reprezentuje zasady skojarzone z elementem LogStore.

public ref class LogPolicy sealed
public sealed class LogPolicy
type LogPolicy = class
Public NotInheritable Class LogPolicy
Dziedziczenie
LogPolicy

Przykłady

W tym przykładzie pokazano, jak używać LogPolicy klasy do ustawiania zasad dla sekwencji rekordów dziennika.

// 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
'

Uwagi

Zasady są zestawem reguł, które mają być przestrzegane przez LogStore wystąpienie i jego klientów. Wystąpienie LogPolicy służy do sprawdzania i modyfikowania zasad skojarzonych z określonym LogStoreelementem . Zasady mogą opisywać minimalne i maksymalne dozwolone rozmiary dzienników lub sposób, w LogStore jaki wystąpienie może rosnąć. Ponadto można również kontrolować, czy LogStore można zarchiwizować wystąpienie.

Po zmianie dowolnej właściwości należy użyć Commit metody , aby upewnić się, że zmiany są stosowane do obiektu LogStore. Metodę można wywołać, Refresh aby odrzucić zmiany lub uzyskać najbardziej aktualne zasady.

Właściwości

AutoGrow

Pobiera lub ustawia wartość wskazującą LogStore , czy wartość może rosnąć automatycznie.

AutoShrinkPercentage

Pobiera lub ustawia wartość procentową wolnego miejsca, które LogStore może zmniejszyć.

GrowthRate

Pobiera lub ustawia szybkość automatycznego wzrostu liczby LogStore.

MaximumExtentCount

Pobiera lub ustawia maksymalną liczbę wystąpieńLogStore, LogExtent które może zawierać.

MinimumExtentCount

Pobiera lub ustawia minimalną liczbę wystąpieńLogStore, LogExtent które może zawierać.

NewExtentPrefix

Pobiera lub ustawia ciąg prefiksu dla automatycznie utworzonych zakresów.

NextExtentSuffix

Pobiera lub ustawia numer sufiksu dla nowych zakresów.

PinnedTailThreshold

Pobiera lub ustawia ilość miejsca wymaganego TailPinned przez zdarzenie do postępu bazy dziennika.

Metody

Commit()

Ustawia te zasady jako bieżące zasady dla elementu LogStore.

Equals(Object)

Określa, czy dany obiekt jest taki sam, jak bieżący obiekt.

(Odziedziczone po Object)
GetHashCode()

Służy jako domyślna funkcja skrótu.

(Odziedziczone po Object)
GetType()

Type Pobiera wartość bieżącego wystąpienia.

(Odziedziczone po Object)
MemberwiseClone()

Tworzy płytkią kopię bieżącego Objectelementu .

(Odziedziczone po Object)
Refresh()

Odczytuje bieżące zasady dla LogStoreelementu , odrzucając wszelkie zmiany, które mogły zostać wprowadzone.

ToString()

Zwraca ciąg reprezentujący bieżący obiekt.

(Odziedziczone po Object)

Dotyczy