LogPolicy Classe

Définition

Représente la stratégie associée à un LogStore.

public ref class LogPolicy sealed
public sealed class LogPolicy
type LogPolicy = class
Public NotInheritable Class LogPolicy
Héritage
LogPolicy

Exemples

Cet exemple montre comment utiliser la classe pour définir une LogPolicy stratégie pour une séquence d’enregistrements de journal.

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

Remarques

Une stratégie est un ensemble de règles à suivre par une LogStore instance et ses clients. Une LogPolicy instance est utilisée pour examiner et modifier la stratégie associée à un élément spécifique LogStore. Une stratégie peut décrire les tailles minimales et maximales autorisées des journaux, ou la façon dont l’instance LogStore est autorisée à croître. En outre, vous pouvez également contrôler si une LogStore instance peut être archivée.

Après avoir modifié l’une des propriétés, vous devez utiliser la Commit méthode pour vous assurer que les modifications sont appliquées au LogStore. Vous pouvez appeler la Refresh méthode pour ignorer les modifications ou obtenir la stratégie la plus actuelle.

Propriétés

Nom Description
AutoGrow

Obtient ou définit une valeur indiquant si l’objet LogStore peut croître automatiquement.

AutoShrinkPercentage

Obtient ou définit le pourcentage d’espace libre que l’espace LogStore peut réduire.

GrowthRate

Obtient ou définit le taux de croissance automatique du LogStore.

MaximumExtentCount

Obtient ou définit le nombre maximal d’instances qu’il LogExtentLogStore peut contenir.

MinimumExtentCount

Obtient ou définit le nombre minimal d’instances qu’il LogExtentLogStore peut contenir.

NewExtentPrefix

Obtient ou définit la chaîne de préfixe pour les étendues créées automatiquement.

NextExtentSuffix

Obtient ou définit le nombre de suffixes pour les nouvelles étendues.

PinnedTailThreshold

Obtient ou définit la quantité d’espace nécessaire à l’événement TailPinned pour avancer la base du journal.

Méthodes

Nom Description
Commit()

Définit cette stratégie comme stratégie actuelle pour le LogStore.

Equals(Object)

Détermine si l’objet spécifié est égal à l’objet actuel.

(Hérité de Object)
GetHashCode()

Sert de fonction de hachage par défaut.

(Hérité de Object)
GetType()

Obtient la Type de l’instance actuelle.

(Hérité de Object)
MemberwiseClone()

Crée une copie superficielle du Objectactuel.

(Hérité de Object)
Refresh()

Lit la stratégie actuelle pour le LogStore, en ignorant les modifications qui ont pu être apportées.

ToString()

Retourne une chaîne qui représente l’objet actuel.

(Hérité de Object)

S’applique à