LogPolicy Klass
Definition
Viktigt
En del information gäller för förhandsversionen av en produkt och kan komma att ändras avsevärt innan produkten blir allmänt tillgänglig. Microsoft lämnar inga garantier, uttryckliga eller underförstådda, avseende informationen som visas här.
Representerar principen som är associerad med en LogStore.
public ref class LogPolicy sealed
public sealed class LogPolicy
type LogPolicy = class
Public NotInheritable Class LogPolicy
- Arv
-
LogPolicy
Exempel
Det här exemplet visar hur du använder LogPolicy klassen för att ange en princip för en loggpostsekvens.
// 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
'
Kommentarer
En princip är en uppsättning regler som ska följas av en LogStore instans och dess klienter. En LogPolicy instans används för att undersöka och ändra principen som är associerad med en specifik LogStore. En princip kan beskriva minsta och högsta tillåtna loggstorlekar eller hur instansen LogStore tillåts växa. Dessutom kan du även styra om en LogStore instans kan arkiveras.
När du har ändrat någon av egenskaperna bör du använda Commit metoden för att säkerställa att ändringarna tillämpas på LogStore. Du kan anropa Refresh metoden för att ignorera ändringar eller för att hämta den senaste principen.
Egenskaper
| Name | Description |
|---|---|
| AutoGrow |
Hämtar eller anger ett värde som anger om LogStore kan växa automatiskt. |
| AutoShrinkPercentage |
Hämtar eller anger procentandelen ledigt utrymme som LogStore kan krympas. |
| GrowthRate |
Hämtar eller anger hastigheten för automatisk tillväxt för LogStore. |
| MaximumExtentCount |
Hämtar eller anger det maximala antalet LogExtent instanser som LogStore kan innehålla. |
| MinimumExtentCount |
Hämtar eller anger det minsta antalet LogExtent instanser som LogStore kan innehålla. |
| NewExtentPrefix |
Hämtar eller anger prefixsträngen för automatiskt skapade omfattningar. |
| NextExtentSuffix |
Hämtar eller anger suffixnumret för nya omfattningar. |
| PinnedTailThreshold |
Hämtar eller anger mängden utrymme som händelsen kräver för att TailPinned flytta fram loggens bas. |
Metoder
| Name | Description |
|---|---|
| Commit() |
Anger den här principen som den aktuella principen för LogStore. |
| Equals(Object) |
Avgör om det angivna objektet är lika med det aktuella objektet. (Ärvd från Object) |
| GetHashCode() |
Fungerar som standard-hash-funktion. (Ärvd från Object) |
| GetType() |
Hämtar den aktuella instansen Type . (Ärvd från Object) |
| MemberwiseClone() |
Skapar en ytlig kopia av den aktuella Object. (Ärvd från Object) |
| Refresh() |
Läser den aktuella principen för LogStoreoch tar bort eventuella ändringar som kan ha gjorts. |
| ToString() |
Returnerar en sträng som representerar det aktuella objektet. (Ärvd från Object) |