LogExtentCollection LogExtentCollection LogExtentCollection LogExtentCollection Class

定義

LogExtent に関連付けられた LogStore オブジェクトのコレクションを表します。Represents the collection of LogExtent objects associated with a LogStore.

public ref class LogExtentCollection sealed : System::Collections::Generic::IEnumerable<System::IO::Log::LogExtent ^>
public sealed class LogExtentCollection : System.Collections.Generic.IEnumerable<System.IO.Log.LogExtent>
type LogExtentCollection = class
    interface seq<LogExtent>
    interface IEnumerable
Public NotInheritable Class LogExtentCollection
Implements IEnumerable(Of LogExtent)
継承
LogExtentCollectionLogExtentCollectionLogExtentCollectionLogExtentCollection
実装

この例では、LogExtent クラスおよび LogExtentCollection クラスを使用して、エクステントをログ シーケンスに追加およびエミュレートする方法を示します。This example shows how to use the LogExtent and LogExtentCollection classes to add and emulate extents in a log sequence.

using System;
using System.IO;
using System.Collections.Generic;
using System.Text;
using System.IO.Log;

namespace MyLogRecordSequence
{
    public class MyLog
    {
        string logName = "test.log";
        string logContainer = "MyExtent0";
        int containerSize = 32 * 1024;
        LogRecordSequence sequence = null;
        bool delete = true;

        // These are used in the TailPinned event handler.
        public static LogRecordSequence MySequence = null;
        public static bool AdvanceBase = true;

        public MyLog()
        {
            // Create a LogRecordSequence.
            sequence = new LogRecordSequence(this.logName,
                                              FileMode.CreateNew,
                                              FileAccess.ReadWrite,
                                              FileShare.None);

            // At least one container/extent must be added for Log Record Sequence.
            sequence.LogStore.Extents.Add(this.logContainer, this.containerSize);
     
            MySequence = sequence;

        }

        public void AddExtents()
        {
            // Add two additional extents. The extents are 
            // of the same size as the first extent.
            sequence.LogStore.Extents.Add("MyExtent1");
            sequence.LogStore.Extents.Add("MyExtent2");
        }

        public void EnumerateExtents()
        {
            LogStore store = sequence.LogStore;

            Console.WriteLine("Enumerating Log Extents...");
            Console.WriteLine("    Extent Count: {0} extents", store.Extents.Count);
            Console.WriteLine("    Extents Are...");
            foreach (LogExtent extent in store.Extents)
            {
                Console.WriteLine("      {0} ({1}, {2})",
                                  Path.GetFileName(extent.Path),
                                  extent.Size,
                                  extent.State);
            }
            Console.WriteLine("    Free Extents: {0} Free", store.Extents.FreeCount);   
        }

        public void SetLogPolicy()
        {
            Console.WriteLine();
            Console.WriteLine("Setting current log policy...");

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

            //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
            // Setting up IO.Log provided capabilities...
            // 

            // SET RETRY APPEND

            // IO.Log provides a mechanism similar to AutoGrow.
            // If the existing log is full and an append fails, setting RetryAppend
            // invokes the CLFS policy engine to add new extents and re-tries
            // record appends. If MaximumExtent count has been reached, 
            // a SequenceFullException is thrown. 
            // 

            sequence.RetryAppend = true;

            // RETRY APPEND END

            // REGISTER FOR TAILPINNED EVENT NOTIFICATIONS

            // Register for TailPinned Event by passing in an event handler.
            // An event is raised when the log full condition is reached.
            // The user should either advance the base sequence number to the 
            // nearest valid sequence number recommended in the tail pinned event or
            // report a failure that it is not able to advance the base sequence 
            // number. 
            //

            sequence.TailPinned += new EventHandler<TailPinnedEventArgs>(HandleTailPinned);  

            Console.WriteLine("Done...");
        }

        public void ShowLogPolicy()
        {
            Console.WriteLine();
            Console.WriteLine("Showing current log policy...");

            LogPolicy policy = sequence.LogStore.Policy;

            Console.WriteLine("    Minimum extent count:  {0}", policy.MinimumExtentCount);
            Console.WriteLine("    Maximum extent count:  {0}", policy.MaximumExtentCount);
            Console.WriteLine("    Growth rate:           {0}", policy.GrowthRate);
            Console.WriteLine("    Pinned tail threshold: {0}", policy.PinnedTailThreshold);
            Console.WriteLine("    Auto shrink percent:   {0}", policy.AutoShrinkPercentage);
            Console.WriteLine("    Auto grow enabled:     {0}", policy.AutoGrow);
            Console.WriteLine("    New extent prefix:     {0}", policy.NewExtentPrefix);
            Console.WriteLine("    Next extent suffix:    {0}", policy.NextExtentSuffix);

	}

        // Append records. Appending three records.  
        public void AppendRecords()
        {
            Console.WriteLine("Appending Log Records...");
            SequenceNumber previous = SequenceNumber.Invalid;

            previous = sequence.Append(CreateData("Hello World!"), SequenceNumber.Invalid, SequenceNumber.Invalid, RecordAppendOptions.ForceFlush);
            previous = sequence.Append(CreateData("This is my first Logging App"), SequenceNumber.Invalid, SequenceNumber.Invalid, RecordAppendOptions.ForceFlush);
            previous = sequence.Append(CreateData("Using LogRecordSequence..."), SequenceNumber.Invalid, SequenceNumber.Invalid, RecordAppendOptions.ForceFlush);
	    
            Console.WriteLine("Done...");
        }


        // Read the records added to the log. 
        public void ReadRecords()
        {
            Encoding enc = Encoding.Unicode;

            Console.WriteLine();

            Console.WriteLine("Reading Log Records...");
            try
            {
                foreach (LogRecord record in this.sequence.ReadLogRecords(this.sequence.BaseSequenceNumber, LogRecordEnumeratorType.Next))
                {
                    byte[] data = new byte[record.Data.Length];
                    record.Data.Read(data, 0, (int)record.Data.Length);
                    string mystr = enc.GetString(data);
                    Console.WriteLine("    {0}", mystr);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception {0} {1}", e.GetType(), e.Message);
            }

            Console.WriteLine();
        }

        public void FillLog()
        {
            bool append = true;

            while (append)
            {
                try
                {
                    sequence.Append(CreateData(16 * 1024), SequenceNumber.Invalid, SequenceNumber.Invalid, RecordAppendOptions.ForceFlush);
                }

                catch (SequenceFullException)
                {
                    Console.WriteLine("Log is Full...");
                    append = false;
                }
            }
        }

        // Dispose the record sequence and delete the log file. 
        public void Cleanup()
        {
            // Dispose the sequence
            sequence.Dispose();

            // Delete the log file.
            if (delete)
            {
                try
                {
                    // This deletes the base log file and all the extents associated with the log.
                    LogStore.Delete(this.logName);
                }
                catch (Exception e)
                {
                    Console.WriteLine("Exception {0} {1}", e.GetType(), e.Message);
                }
            }
        }

        // Converts the given data to an Array of ArraySegment<byte> 
        public static IList<ArraySegment<byte>> CreateData(string str)
        {
            Encoding enc = Encoding.Unicode;

            byte[] array = enc.GetBytes(str);

            ArraySegment<byte>[] segments = new ArraySegment<byte>[1];
            segments[0] = new ArraySegment<byte>(array);

            return Array.AsReadOnly<ArraySegment<byte>>(segments);
        }

        public static IList<ArraySegment<byte>> CreateData(int size)
        {
            byte[] array = new byte[size];

            Random rnd = new Random();
            rnd.NextBytes(array);

            ArraySegment<byte>[] segments = new ArraySegment<byte>[1];
            segments[0] = new ArraySegment<byte>(array);

            return Array.AsReadOnly<ArraySegment<byte>>(segments);
        }

        public static SequenceNumber GetAdvanceBaseSeqNumber(SequenceNumber recTargetSeqNum)
        {
            SequenceNumber targetSequenceNumber = SequenceNumber.Invalid;

            Console.WriteLine("Getting actual target sequence number...");
            
            // 
            // Implement the logic for returning a valid sequence number closer to
            // recommended target sequence number. 
            //

            return targetSequenceNumber;
        }

        public static void HandleTailPinned(object arg, TailPinnedEventArgs tailPinnedEventArgs)
        {
            Console.WriteLine("TailPinned has fired");

            // Based on the implementation of a logging application, the log base can be moved
            // to free up more log space and if it is not possible to move the 
            // base, the application should report by throwing an exception.

            if(MyLog.AdvanceBase)
            {
                try
                {
                    // TailPnnedEventArgs has the recommended sequence number and its generated 
                    // based on PinnedTailThreshold policy. 
                    // This does not map to an actual sequence number in the record sequence
                    // but an approximation and potentially frees up the threshold % log space
                    // when the log base is advanced to a valid sequence number closer to the 
                    // recommended sequence number. 
                    // The user should use this sequence number to locate a closest valid sequence
                    // number to advance the base of the log.

                    SequenceNumber recommendedTargetSeqNum = tailPinnedEventArgs.TargetSequenceNumber; 
                    
                    // Get the actual Target sequence number.
                    SequenceNumber actualTargetSeqNum = MyLog.GetAdvanceBaseSeqNumber(recommendedTargetSeqNum);

                    MySequence.AdvanceBaseSequenceNumber(actualTargetSeqNum);
                }
                catch (Exception e)
                {
                    Console.WriteLine("Exception thrown {0} {1}", e.GetType(), e.Message);
                }
            }
            else
            {
                // Report back Error if under some conditions the log cannot
                // advance the base sequence number.

                Console.WriteLine("Reporting Error! Unable to move the base sequence number!");
                throw new IOException();
            }
        }
    }

    class LogSample
    {
        static void Main(string[] args)
        {
            // Create log record sequence.
            MyLog log = new MyLog();

            // Add additional extents.
            log.AddExtents();

            // Enumerate the current log extents.
            log.EnumerateExtents();

            // Set log policies and register for TailPinned event notifications. 
            log.SetLogPolicy();

            log.ShowLogPolicy();
            
            // Append a few records and read the appended records. 
            log.AppendRecords();
            log.ReadRecords();

            // Fill the Log to trigger log growth...and subsequent TailPinned notifications.
            log.FillLog();

            log.EnumerateExtents();

            log.Cleanup();
        }
    }
}


Imports System.IO
Imports System.Collections.Generic
Imports System.Text
Imports System.IO.Log

Namespace MyLogRecordSequence
	Public Class MyLog
		Private logName As String = "test.log"
		Private logContainer As String = "MyExtent0"
		Private containerSize As Integer = 32 * 1024
		Private sequence As LogRecordSequence = Nothing
		Private delete As Boolean = True

		' These are used in the TailPinned event handler.
		Public Shared MySequence As LogRecordSequence = Nothing
		Public Shared AdvanceBase As Boolean = True

		Public Sub New()
			' Create a LogRecordSequence.
			sequence = New LogRecordSequence(Me.logName, FileMode.CreateNew, FileAccess.ReadWrite, FileShare.None)

			' At least one container/extent must be added for Log Record Sequence.
			sequence.LogStore.Extents.Add(Me.logContainer, Me.containerSize)

			MySequence = sequence

		End Sub

		Public Sub AddExtents()
			' Add two additional extents. The extents are 
			' of the same size as the first extent.
			sequence.LogStore.Extents.Add("MyExtent1")
			sequence.LogStore.Extents.Add("MyExtent2")
		End Sub

		Public Sub EnumerateExtents()
			Dim store As LogStore = sequence.LogStore

			Console.WriteLine("Enumerating Log Extents...")
			Console.WriteLine("    Extent Count: {0} extents", store.Extents.Count)
			Console.WriteLine("    Extents Are...")
            For Each extent In store.Extents
                Console.WriteLine("      {0} ({1}, {2})", Path.GetFileName(extent.Path), extent.Size, extent.State)
            Next extent
			Console.WriteLine("    Free Extents: {0} Free", store.Extents.FreeCount)
		End Sub

		Public Sub SetLogPolicy()
			Console.WriteLine()
			Console.WriteLine("Setting current log policy...")

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

			'+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
			' Setting up IO.Log provided capabilities...
			' 

			' SET RETRY APPEND

			' IO.Log provides a mechanism similar to AutoGrow.
			' If the existing log is full and an append fails, setting RetryAppend
			' invokes the CLFS policy engine to add new extents and re-tries
			' record appends. If MaximumExtent count has been reached, 
			' a SequenceFullException is thrown. 
			' 

			sequence.RetryAppend = True

			' RETRY APPEND END

			' REGISTER FOR TAILPINNED EVENT NOTIFICATIONS

			' Register for TailPinned Event by passing in an event handler.
			' An event is raised when the log full condition is reached.
			' The user should either advance the base sequence number to the 
			' nearest valid sequence number recommended in the tail pinned event or
			' report a failure that it is not able to advance the base sequence 
			' number. 
			'

			AddHandler sequence.TailPinned, AddressOf HandleTailPinned

			Console.WriteLine("Done...")
		End Sub

		Public Sub ShowLogPolicy()
			Console.WriteLine()
			Console.WriteLine("Showing current log policy...")

			Dim policy As LogPolicy = sequence.LogStore.Policy

			Console.WriteLine("    Minimum extent count:  {0}", policy.MinimumExtentCount)
			Console.WriteLine("    Maximum extent count:  {0}", policy.MaximumExtentCount)
			Console.WriteLine("    Growth rate:           {0}", policy.GrowthRate)
			Console.WriteLine("    Pinned tail threshold: {0}", policy.PinnedTailThreshold)
			Console.WriteLine("    Auto shrink percent:   {0}", policy.AutoShrinkPercentage)
			Console.WriteLine("    Auto grow enabled:     {0}", policy.AutoGrow)
			Console.WriteLine("    New extent prefix:     {0}", policy.NewExtentPrefix)
			Console.WriteLine("    Next extent suffix:    {0}", policy.NextExtentSuffix)

		End Sub

		' Append records. Appending three records.  
		Public Sub AppendRecords()
			Console.WriteLine("Appending Log Records...")
			Dim previous As SequenceNumber = SequenceNumber.Invalid

			previous = sequence.Append(CreateData("Hello World!"), SequenceNumber.Invalid, SequenceNumber.Invalid, RecordAppendOptions.ForceFlush)
			previous = sequence.Append(CreateData("This is my first Logging App"), SequenceNumber.Invalid, SequenceNumber.Invalid, RecordAppendOptions.ForceFlush)
			previous = sequence.Append(CreateData("Using LogRecordSequence..."), SequenceNumber.Invalid, SequenceNumber.Invalid, RecordAppendOptions.ForceFlush)

			Console.WriteLine("Done...")
		End Sub


		' Read the records added to the log. 
		Public Sub ReadRecords()
			Dim enc As Encoding = Encoding.Unicode

			Console.WriteLine()

			Console.WriteLine("Reading Log Records...")
			Try
				For Each record As LogRecord In Me.sequence.ReadLogRecords(Me.sequence.BaseSequenceNumber, LogRecordEnumeratorType.Next)
					Dim data(record.Data.Length - 1) As Byte
					record.Data.Read(data, 0, CInt(Fix(record.Data.Length)))
					Dim mystr As String = enc.GetString(data)
					Console.WriteLine("    {0}", mystr)
				Next record
			Catch e As Exception
				Console.WriteLine("Exception {0} {1}", e.GetType(), e.Message)
			End Try

			Console.WriteLine()
		End Sub

		Public Sub FillLog()
			Dim append As Boolean = True

			Do While append
				Try
					sequence.Append(CreateData(16 * 1024), SequenceNumber.Invalid, SequenceNumber.Invalid, RecordAppendOptions.ForceFlush)

				Catch e1 As SequenceFullException
					Console.WriteLine("Log is Full...")
					append = False
				End Try
			Loop
		End Sub

		' Dispose the record sequence and delete the log file. 
		Public Sub Cleanup()
			' Dispose the sequence
			sequence.Dispose()

			' Delete the log file.
			If delete Then
				Try
					' This deletes the base log file and all the extents associated with the log.
					LogStore.Delete(Me.logName)
				Catch e As Exception
					Console.WriteLine("Exception {0} {1}", e.GetType(), e.Message)
				End Try
			End If
		End Sub

		' Converts the given data to an Array of ArraySegment<byte> 
		Public Shared Function CreateData(ByVal str As String) As IList(Of ArraySegment(Of Byte))
			Dim enc As Encoding = Encoding.Unicode

			Dim array() As Byte = enc.GetBytes(str)

			Dim segments(0) As ArraySegment(Of Byte)
			segments(0) = New ArraySegment(Of Byte)(array)

            Return System.Array.AsReadOnly(Of ArraySegment(Of Byte))(segments)
		End Function

		Public Shared Function CreateData(ByVal size As Integer) As IList(Of ArraySegment(Of Byte))
			Dim array(size - 1) As Byte

			Dim rand As New Random()
			rand.NextBytes(array)

			Dim segments(0) As ArraySegment(Of Byte)
			segments(0) = New ArraySegment(Of Byte)(array)

            Return System.Array.AsReadOnly(Of ArraySegment(Of Byte))(segments)
		End Function

		Public Shared Function GetAdvanceBaseSeqNumber(ByVal recTargetSeqNum As SequenceNumber) As SequenceNumber
			Dim targetSequenceNumber As SequenceNumber = SequenceNumber.Invalid

			Console.WriteLine("Getting actual target sequence number...")

			' 
			' Implement the logic for returning a valid sequence number closer to
			' recommended target sequence number. 
			'

			Return targetSequenceNumber
		End Function

		Public Shared Sub HandleTailPinned(ByVal arg As Object, ByVal tailPinnedEventArgs As TailPinnedEventArgs)
			Console.WriteLine("TailPinned has fired")

			' Based on the implementation of a logging application, the log base can be moved
			' to free up more log space and if it is not possible to move the 
			' base, the application should report by throwing an exception.

			If MyLog.AdvanceBase Then
				Try
					' TailPnnedEventArgs has the recommended sequence number and its generated 
					' based on PinnedTailThreshold policy. 
					' This does not map to an actual sequence number in the record sequence
					' but an approximation and potentially frees up the threshold % log space
					' when the log base is advanced to a valid sequence number closer to the 
					' recommended sequence number. 
					' The user should use this sequence number to locate a closest valid sequence
					' number to advance the base of the log.

					Dim recommendedTargetSeqNum As SequenceNumber = tailPinnedEventArgs.TargetSequenceNumber

					' Get the actual Target sequence number.
					Dim actualTargetSeqNum As SequenceNumber = MyLog.GetAdvanceBaseSeqNumber(recommendedTargetSeqNum)

					MySequence.AdvanceBaseSequenceNumber(actualTargetSeqNum)
				Catch e As Exception
					Console.WriteLine("Exception thrown {0} {1}", e.GetType(), e.Message)
				End Try
			Else
				' Report back Error if under some conditions the log cannot
				' advance the base sequence number.

				Console.WriteLine("Reporting Error! Unable to move the base sequence number!")
				Throw New IOException()
			End If
		End Sub
	End Class

	Friend Class LogSample
		Shared Sub Main(ByVal args() As String)
			' Create log record sequence.
			Dim log As New MyLog()

			' Add additional extents.
			log.AddExtents()

			' Enumerate the current log extents.
			log.EnumerateExtents()

			' Set log policies and register for TailPinned event notifications. 
			log.SetLogPolicy()

			log.ShowLogPolicy()

			' Append a few records and read the appended records. 
			log.AppendRecords()
			log.ReadRecords()

			' Fill the Log to trigger log growth...and subsequent TailPinned notifications.
			log.FillLog()

			log.EnumerateExtents()

			log.Cleanup()
		End Sub
	End Class
End Namespace

注釈

このクラスは、LogExtent に関連付けられている LogStore オブジェクトのコレクションを格納します。This class contains a collection of LogExtent objects associated with a LogStore. LogStore インスタンスは、LogExtent により表されるディスク エクステントのコレクションにデータを保存します。A LogStore instance stores its data in a collection of disk extents, represented by LogExtent instances. 個々の LogExtent は 1 つの LogStore に関連付けられ、同一の LogExtent 内の LogStore オブジェクトのサイズはすべて同じです。A particular LogExtent is associated with one LogStore, and LogExtent objects in the same LogStore are of identical size. 領域が追加され、エクステント増加分が LogStore インスタンスから削除されます。Space is added to and removed from a LogStore instance in extent increments.

LogExtent オブジェクトはディスク上でファイルとして表されますが、通常のファイルとして移動したり削除したりすることはできません。Although LogExtent objects are represented on disk as files, they should not be moved or deleted as normal files. LogExtent インスタンスを直接追加または削除する場合は、このクラスのメソッドを使用する必要があります。Rather, you should use the methods provided by this class for adding and deleting LogExtent instances directly. 通常、アクティブなデータがなくなったエクステントは削除されます。Extents are usually removed when they no longer contain any active data. ただし、force メソッドの Remove パラメーターが true の場合、エクステントを直ちに削除できないときは例外がスローされます。However, if the force parameter in the Remove method is true, an exception is thrown if they cannot be removed immediately.

LogExtentCollection 内の最後のエクステントを削除することはできません。つまり、エクステントの追加後に Count プロパティが 0 になることはありません。You cannot remove the last extent in the LogExtentCollection, which means that the Count property cannot be zero after an extent is added.

プロパティ

Count Count Count Count

コレクション内のログ エクステントの数を取得します。Gets the number of log extents in the collection.

FreeCount FreeCount FreeCount FreeCount

コレクション内の解放されている LogExtent インスタンスの数 (データが存在しない LogExtent インスタンスの数) を取得します。Gets the number of free LogExtent instances in the collection, that is, the number of LogExtent instances that do not contain any data.

メソッド

Add(String) Add(String) Add(String) Add(String)

LogExtent のインスタンスをコレクションに追加します。Adds a LogExtent instance to the collection.

Add(String, Int64) Add(String, Int64) Add(String, Int64) Add(String, Int64)

指定されたサイズで新しい LogExtent を作成し、コレクションに追加します。Creates a new LogExtent with the specified size and adds it to the collection.

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

指定したオブジェクトが、現在のオブジェクトと等しいかどうかを判断します。Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetEnumerator() GetEnumerator() GetEnumerator() GetEnumerator()

このコレクション内の LogExtent インスタンスの列挙子を取得します。Gets an enumerator for the LogExtent instances in this collection. このメソッドは継承できません。This method cannot be inherited.

GetHashCode() GetHashCode() GetHashCode() GetHashCode()

既定のハッシュ関数として機能します。Serves as the default hash function.

(Inherited from Object)
GetType() GetType() GetType() GetType()

現在のインスタンスの Type を取得します。Gets the Type of the current instance.

(Inherited from Object)
MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

現在の Object の簡易コピーを作成します。Creates a shallow copy of the current Object.

(Inherited from Object)
Remove(LogExtent, Boolean) Remove(LogExtent, Boolean) Remove(LogExtent, Boolean) Remove(LogExtent, Boolean)

指定した LogExtent インスタンスをコレクションから削除します。Removes the specified LogExtent instance from the collection.

Remove(String, Boolean) Remove(String, Boolean) Remove(String, Boolean) Remove(String, Boolean)

指定したパスの LogExtent インスタンスをコレクションから削除します。Removes the LogExtent instance with the specified path from the collection.

ToString() ToString() ToString() ToString()

現在のオブジェクトを表す文字列を返します。Returns a string that represents the current object.

(Inherited from Object)

明示的なインターフェイスの実装

IEnumerable.GetEnumerator() IEnumerable.GetEnumerator() IEnumerable.GetEnumerator() IEnumerable.GetEnumerator()

このコレクション内の LogExtent インスタンスの列挙子を取得します。Gets an enumerator for the LogExtent instances in this collection. このメソッドは継承できません。This method cannot be inherited.

拡張メソッド

CopyToDataTable<T>(IEnumerable<T>) CopyToDataTable<T>(IEnumerable<T>) CopyToDataTable<T>(IEnumerable<T>) CopyToDataTable<T>(IEnumerable<T>)

指定した入力 DataTable オブジェクトに応じて (ジェネリック パラメーター TDataRow)、IEnumerable<T> オブジェクトのコピーを格納する DataRow を返します。Returns a DataTable that contains copies of the DataRow objects, given an input IEnumerable<T> object where the generic parameter T is DataRow.

CopyToDataTable<T>(IEnumerable<T>, DataTable, LoadOption) CopyToDataTable<T>(IEnumerable<T>, DataTable, LoadOption) CopyToDataTable<T>(IEnumerable<T>, DataTable, LoadOption) CopyToDataTable<T>(IEnumerable<T>, DataTable, LoadOption)

指定した入力 DataRow オブジェクトに応じて (ジェネリック パラメーター TDataTable)、指定した IEnumerable<T>DataRow オブジェクトをコピーします。Copies DataRow objects to the specified DataTable, given an input IEnumerable<T> object where the generic parameter T is DataRow.

CopyToDataTable<T>(IEnumerable<T>, DataTable, LoadOption, FillErrorEventHandler) CopyToDataTable<T>(IEnumerable<T>, DataTable, LoadOption, FillErrorEventHandler) CopyToDataTable<T>(IEnumerable<T>, DataTable, LoadOption, FillErrorEventHandler) CopyToDataTable<T>(IEnumerable<T>, DataTable, LoadOption, FillErrorEventHandler)

指定した入力 DataRow オブジェクトに応じて (ジェネリック パラメーター TDataTable)、指定した IEnumerable<T>DataRow オブジェクトをコピーします。Copies DataRow objects to the specified DataTable, given an input IEnumerable<T> object where the generic parameter T is DataRow.

Cast<TResult>(IEnumerable) Cast<TResult>(IEnumerable) Cast<TResult>(IEnumerable) Cast<TResult>(IEnumerable)

IEnumerable の要素を、指定した型にキャストします。Casts the elements of an IEnumerable to the specified type.

OfType<TResult>(IEnumerable) OfType<TResult>(IEnumerable) OfType<TResult>(IEnumerable) OfType<TResult>(IEnumerable)

指定された型に基づいて IEnumerable の要素をフィルター処理します。Filters the elements of an IEnumerable based on a specified type.

AsParallel(IEnumerable) AsParallel(IEnumerable) AsParallel(IEnumerable) AsParallel(IEnumerable)

クエリの並列化を有効にします。Enables parallelization of a query.

AsQueryable(IEnumerable) AsQueryable(IEnumerable) AsQueryable(IEnumerable) AsQueryable(IEnumerable)

IEnumerableIQueryable に変換します。Converts an IEnumerable to an IQueryable.

Ancestors<T>(IEnumerable<T>) Ancestors<T>(IEnumerable<T>) Ancestors<T>(IEnumerable<T>) Ancestors<T>(IEnumerable<T>)

ソース コレクション内のすべてのノードの先祖が格納された、要素のコレクションを返します。Returns a collection of elements that contains the ancestors of every node in the source collection.

Ancestors<T>(IEnumerable<T>, XName) Ancestors<T>(IEnumerable<T>, XName) Ancestors<T>(IEnumerable<T>, XName) Ancestors<T>(IEnumerable<T>, XName)

ソース コレクション内のすべてのノードの先祖が格納され、フィルター処理された要素のコレクションを返します。Returns a filtered collection of elements that contains the ancestors of every node in the source collection. 一致する XName を持つ要素のみがコレクションに含められます。Only elements that have a matching XName are included in the collection.

DescendantNodes<T>(IEnumerable<T>) DescendantNodes<T>(IEnumerable<T>) DescendantNodes<T>(IEnumerable<T>) DescendantNodes<T>(IEnumerable<T>)

ソース コレクション内のすべてのドキュメントおよび要素の子孫ノードのコレクションを返します。Returns a collection of the descendant nodes of every document and element in the source collection.

Descendants<T>(IEnumerable<T>) Descendants<T>(IEnumerable<T>) Descendants<T>(IEnumerable<T>) Descendants<T>(IEnumerable<T>)

ソース コレクション内のすべての要素とドキュメントの子孫要素が格納された要素のコレクションを返します。Returns a collection of elements that contains the descendant elements of every element and document in the source collection.

Descendants<T>(IEnumerable<T>, XName) Descendants<T>(IEnumerable<T>, XName) Descendants<T>(IEnumerable<T>, XName) Descendants<T>(IEnumerable<T>, XName)

ソース コレクション内のすべての要素とドキュメントの子孫要素が格納され、フィルター処理された要素のコレクションを返します。Returns a filtered collection of elements that contains the descendant elements of every element and document in the source collection. 一致する XName を持つ要素のみがコレクションに含められます。Only elements that have a matching XName are included in the collection.

Elements<T>(IEnumerable<T>) Elements<T>(IEnumerable<T>) Elements<T>(IEnumerable<T>) Elements<T>(IEnumerable<T>)

ソース コレクション内のすべての要素およびドキュメントの子要素のコレクションを返します。Returns a collection of the child elements of every element and document in the source collection.

Elements<T>(IEnumerable<T>, XName) Elements<T>(IEnumerable<T>, XName) Elements<T>(IEnumerable<T>, XName) Elements<T>(IEnumerable<T>, XName)

ソース コレクション内のすべての要素およびドキュメントの、フィルター処理された子要素のコレクションを返します。Returns a filtered collection of the child elements of every element and document in the source collection. 一致する XName を持つ要素のみがコレクションに含められます。Only elements that have a matching XName are included in the collection.

InDocumentOrder<T>(IEnumerable<T>) InDocumentOrder<T>(IEnumerable<T>) InDocumentOrder<T>(IEnumerable<T>) InDocumentOrder<T>(IEnumerable<T>)

ソース コレクション内のすべてのノードがドキュメント順に並べ替えて格納された、ノードのコレクションを返します。Returns a collection of nodes that contains all nodes in the source collection, sorted in document order.

Nodes<T>(IEnumerable<T>) Nodes<T>(IEnumerable<T>) Nodes<T>(IEnumerable<T>) Nodes<T>(IEnumerable<T>)

ソース コレクション内のすべてのドキュメントおよび要素の子ノードのコレクションを返します。Returns a collection of the child nodes of every document and element in the source collection.

Remove<T>(IEnumerable<T>) Remove<T>(IEnumerable<T>) Remove<T>(IEnumerable<T>) Remove<T>(IEnumerable<T>)

ソース コレクション内の親ノードからすべてのノードを削除します。Removes every node in the source collection from its parent node.

適用対象

こちらもご覧ください