Share via


Common Log File System Functions

The following functions are used to manage logs.

Function Description
AlignReservedLog Calculates the sector-aligned reservation size for a set of records.
AllocReservedLog Allocates sector-aligned space for a set of reserved records.
CloseAndResetLogFile Resets the log file and then shuts the log.
CreateLogFile Creates or opens a log.
DeleteLogByHandle Marks the specified log for deletion.
DeleteLogFile Marks a log for deletion.
DumpLogRecords Scans a specified log, filters log records based on record type, and places the records in an output file stream that the caller opens.
FlushLogBuffers Forces all records that are appended to this marshaling area to be flushed to disk.
FlushLogToLsn Forces all records that are appended to this marshaling area up to the record with the specified log sequence number (LSN) to be flushed to the disk.
FreeReservedLog Reduces the number of reserved log records in a marshaling area made by calling ReserveAndAppendLog, ReserveAndAppendLogAligned, or AllocReservedLog.
GetLogFileInformation Returns a buffer that contains metadata about a specified log and its current state, as defined by the CLFS_INFORMATION structure.
GetLogIoStatistics Retrieves log I/O statistics for a dedicated or multiplexed log that is associated with the specified handle.
ReadLogRecord Initiates a sequence of reads from a specified log sequence number (LSN) in one of three modes, and returns the first of the specified log records and a read context.
ReadNextLogRecord Reads the next record in a sequence that is initiated by a call to ReadLogRecord or ReadLogRestartArea.
ReserveAndAppendLog Reserves space for log buffers, appends a log record to the log, or does both.
ReserveAndAppendLogAligned Reserves space for log buffers, appends a log record to the log, or both. This function is like ReserveAndAppendLog, but ReserveAndAppendLogAligned aligns the write entries of the record to the specified byte alignment.
SetEndOfLog This function has been deprecated. Use TruncateLog instead.
TerminateReadLog Terminates a read context. This function frees system-allocated resources that are associated with the specified read context.
TruncateLog Truncates the log.

 

The following functions are used to manage containers.

Function Description
AddLogContainer Adds a container to the physical log that is associated with the log handle, if the calling process has write access to the .blf file and the ability to create files in the target directory of the container.
AddLogContainerSet Adds multiple log containers to the physical log that is associated with the log handle, if the calling process has access to the log handle.
CreateLogContainerScanContext Creates a scan context to use with ScanLogContainers to enumerate all log containers that are associated with a log, and performs the first scan.
GetLogContainerName Retrieves the full path name of a container when given its container identifier.
RemoveLogContainer Removes a single container from a log that is associated with a dedicated or multiplexed log handle.
RemoveLogContainerSet Removes multiple containers from a log that is associated with a dedicated or multiplexed log handle.
ScanLogContainers Enumerates log containers. Call this function repeatedly to iterate over all log containers.

 

The following functions are used for crash restart.

Function Description
AdvanceLogBase Advances the base log sequence number (LSN) of a log stream to the specified LSN.
ReadLogRestartArea Returns the last restart area that was written successfully to the log associated with the marshaling area of WriteLogRestartArea. The function also returns a read context that allows the caller to cursor backward or forward through the log from the restart record.
ReadPreviousLogRestartArea Reads the previous log restart area that is relative to the current restart record specified in the read context.
WriteLogRestartArea Appends a new client restart area to a log and optionally advances the base log sequence number (LSN) of the log.

 

The following functions are used for archiving.

Function Description
GetNextLogArchiveExtent Retrieves the next set of archive extents in a log archive context.
PrepareLogArchive Prepares a physical log for archiving.
ReadLogArchiveMetadata Copies a range of the archive view of the metadata to the specified buffer.
SetLogArchiveMode Enables or disables log archive support for a specified log.
SetLogArchiveTail Sets the last archived log sequence number (LSN) or archive tail of an archivable log.
TerminateLogArchive Deallocates system resources that are allocated originally for a log archive context by PrepareLogArchive.
ValidateLog Validates the consistency of the log metadata and data before log archive and after log restore.

 

The following functions are used for marshaling.

Function Description
CreateLogMarshallingArea Creates a marshaling area for a log, and when successful it returns a marshaling context.
DeleteLogMarshallingArea Deletes a marshaling area that is created by a successful call to CreateLogMarshallingArea.

 

The following functions are used to work with LSNs.

Function Description
LsnBlockOffset Returns the sector-aligned block offset that is contained in the specified LSN.
LsnContainer Retrieves the logical container ID that is contained in a specified LSN.
LsnCreate Creates a log sequence number (LSN), given a container ID, a block offset, and a record sequence number.
LsnEqual Determines whether two LSNs from the same stream are equal.
LsnGreater Determines whether one LSN is greater than another LSN. The two LSNs must be from the same stream.
LsnLess Determines whether one LSN is less than another LSN. The two LSNs must be from the same stream.
LsnNull Determines whether a specified LSN is equal to the smallest possible LSN, which is CLFS_LSN_NULL.
LsnRecordSequence Retrieves the record sequence number that is contained in a specified LSN.