LogPolicy Clase
Definición
Importante
Parte de la información hace referencia a la versión preliminar del producto, que puede haberse modificado sustancialmente antes de lanzar la versión definitiva. Microsoft no otorga ninguna garantía, explícita o implícita, con respecto a la información proporcionada aquí.
Representa la directiva asociada a .LogStore
public ref class LogPolicy sealed
public sealed class LogPolicy
type LogPolicy = class
Public NotInheritable Class LogPolicy
- Herencia
-
LogPolicy
Ejemplos
En este ejemplo se muestra cómo usar la clase para establecer la LogPolicy directiva para una secuencia de registros de registro.
// 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
'
Comentarios
Una directiva es un conjunto de reglas que deben ir seguidas de una LogStore instancia y sus clientes. Una LogPolicy instancia se usa para examinar y modificar la directiva asociada a un específico LogStore. Una directiva puede describir los tamaños de registro mínimos y máximos permitidos, o cómo puede crecer la LogStore instancia. Además, también puede controlar si se puede archivar una LogStore instancia de .
Después de cambiar cualquiera de las propiedades, debe usar el Commit método para asegurarse de que los cambios se aplican a .LogStore Puede llamar al Refresh método para descartar los cambios o para obtener la directiva más actual.
Propiedades
| Nombre | Description |
|---|---|
| AutoGrow |
Obtiene o establece un valor que indica si puede LogStore crecer automáticamente. |
| AutoShrinkPercentage |
Obtiene o establece el porcentaje de espacio libre que LogStore puede reducirse. |
| GrowthRate |
Obtiene o establece la tasa de crecimiento automático de LogStore. |
| MaximumExtentCount |
Obtiene o establece el número máximo de LogExtent instancias que LogStore puede contener. |
| MinimumExtentCount |
Obtiene o establece el número mínimo de LogExtent instancias que LogStore puede contener. |
| NewExtentPrefix |
Obtiene o establece la cadena de prefijo para extensiones creadas automáticamente. |
| NextExtentSuffix |
Obtiene o establece el número de sufijo para las nuevas extensiones. |
| PinnedTailThreshold |
Obtiene o establece la cantidad de espacio que requiere el TailPinned evento para avanzar en la base del registro. |
Métodos
| Nombre | Description |
|---|---|
| Commit() |
Establece esta directiva como directiva actual para .LogStore |
| Equals(Object) |
Determina si el objeto especificado es igual al objeto actual. (Heredado de Object) |
| GetHashCode() |
Actúa como función hash predeterminada. (Heredado de Object) |
| GetType() |
Obtiene el Type de la instancia actual. (Heredado de Object) |
| MemberwiseClone() |
Crea una copia superficial del Objectactual. (Heredado de Object) |
| Refresh() |
Lee la directiva actual para , LogStoredescartando los cambios que se puedan haber realizado. |
| ToString() |
Devuelve una cadena que representa el objeto actual. (Heredado de Object) |