Cette documentation est archivée et n’est pas conservée.

ReservationCollection, classe

Manages the collection of space reservations made in a record sequence.

Espace de noms: System.IO.Log
Assembly : System.IO.Log (dans system.io.log.dll)

public abstract class ReservationCollection : ICollection<long>, IEnumerable<long>, 
	IEnumerable
public abstract class ReservationCollection implements ICollection<long>, 
	IEnumerable<long>, IEnumerable
public abstract class ReservationCollection implements ICollection<long>, 
	IEnumerable<long>, IEnumerable
Non applicable.

This class represents a set of reservation areas that have been made in a record sequence. Adding items to the collection allocates new reservations. Removing items from the collection frees those reservations.

An application reserves space in the log when it has data that will be written to the log in the future, but cannot write it immediately. Reservations provide a guarantee that the data can be written to the log when the data is available to be written. When using logs, applications often reserve one or more log records in a marshalling area. You must reserve records prior to appending them.

Reservations can be used to guarantee that an operation can be completed before the data is committed; otherwise, the changes are rolled back. It can also be used to record an "undo action" in the log. During a rollback operation, a transactional resource manager (RM) must be able to recover its state if the RM is interrupted during the rollback operation. By using a reservation area, an RM can reserve space in a log before it is used.

The ReserveAndAppend method can either reserve space or append data, or both, depending on the parameters that are specified when making the call. As work progresses in a transaction, an application can append the undo information and reserve space for compensation records. During a rollback operation, compensation records that are created indicate what has been undone on the disk. The records are appended using space that has been previously reserved. This guarantees that an RM does not run out of log space, which is a fatal condition, while performing a rollback operation. If a log fills up during a transaction, an application can safely roll back a transaction without corrupting durable data.

CLFS is an ARIES-compliant logging system, meant for write-ahead logging. In write-ahead logging, an application writes an undo record before it performs the operation, reserving the amount of space it would take in the log to write a compensating record, which may be used during rollback. Later, the reserved space is used when the compensation record is actually written.

Applications can either reserve or consume long space at any given time (they are mutually exclusive operations). After a commit record is written to the log, an application can free up the reservations for the compensation records. This action can be done by calling either the FreeReservation or ReserveAndAppend method. Calling the ReserveAndAppend method guarantees that the operation is atomic, while calling the FreeReservation method does not.

When you free records, you must free the same records that you reserved together in a previous call to the ReserveAndAppend method.

RemarqueRemarque :

Your implementation of IRecordSequence must implement the MakeReservation and FreeReservation methods to perform the actual reservation allocation and deallocation. In addition, your implementation must also call ReservationFreed when a record is written into a reserved space.

System.Object
  System.IO.Log.ReservationCollection

Les membres statiques publics (Shared en Visual Basic) de ce type sont thread-safe. Il n'est pas garanti que les membres d'instance soient thread-safe.

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile pour Pocket PC, Windows Mobile pour Smartphone, Windows Server 2003, Windows XP Édition Media Center, Windows XP Professionnel Édition x64, Windows XP SP2, Windows XP Starter Edition

Microsoft .NET Framework 3.0 est pris en charge sur Windows Vista, Microsoft Windows XP SP2 et Windows Server 2003 SP1.

.NET Framework

Prise en charge dans : 3.0
Afficher: