Share via


LogPolicy Kelas

Definisi

Mewakili kebijakan yang terkait dengan LogStore.

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

Contoh

Contoh ini menunjukkan cara menggunakan LogPolicy kelas untuk mengatur kebijakan untuk urutan catatan log.

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

Keterangan

Kebijakan adalah seperangkat aturan yang akan diikuti oleh LogStore instans dan kliennya. Instans LogPolicy digunakan untuk memeriksa dan memodifikasi kebijakan yang terkait dengan .LogStore Kebijakan dapat menjelaskan ukuran log minimum dan maksimum yang diizinkan, atau bagaimana LogStore instans diizinkan untuk tumbuh. Selain itu, Anda juga dapat mengontrol apakah LogStore instans dapat diarsipkan.

Setelah mengubah salah satu properti, Anda harus menggunakan Commit metode untuk memastikan bahwa perubahan diterapkan ke LogStore. Anda dapat memanggil Refresh metode untuk membuang perubahan atau untuk mendapatkan kebijakan terbaru.

Properti

AutoGrow

Mendapatkan atau menetapkan nilai yang menunjukkan apakah LogStore dapat tumbuh secara otomatis.

AutoShrinkPercentage

Mendapatkan atau mengatur persentase ruang kosong yang LogStore dapat menyusut.

GrowthRate

Mendapatkan atau menetapkan tingkat pertumbuhan LogStoreotomatis .

MaximumExtentCount

Mendapatkan atau mengatur jumlah LogExtent maksimum instans yang dapat dimuat LogStore .

MinimumExtentCount

Mendapatkan atau mengatur jumlah LogExtent minimum instans yang dapat dimuat LogStore .

NewExtentPrefix

Mendapatkan atau mengatur string awalan untuk jangkauan yang dibuat secara otomatis.

NextExtentSuffix

Mendapatkan atau mengatur nomor akhiran untuk jangkauan baru.

PinnedTailThreshold

Mendapatkan atau mengatur jumlah ruang yang TailPinned diperlukan peristiwa untuk memajukan dasar log.

Metode

Commit()

Menetapkan kebijakan ini sebagai kebijakan saat ini untuk LogStore.

Equals(Object)

Menentukan apakah objek yang ditentukan sama dengan objek saat ini.

(Diperoleh dari Object)
GetHashCode()

Berfungsi sebagai fungsi hash default.

(Diperoleh dari Object)
GetType()

Mendapatkan instans Type saat ini.

(Diperoleh dari Object)
MemberwiseClone()

Membuat salinan dangkal dari yang saat ini Object.

(Diperoleh dari Object)
Refresh()

Membaca kebijakan saat ini untuk LogStore, membuang perubahan apa pun yang mungkin telah dibuat.

ToString()

Mengembalikan string yang mewakili objek saat ini.

(Diperoleh dari Object)

Berlaku untuk