Table of Contents

Method OptimizeDataSource

Namespace
LMKit.Data
Assembly
LM-Kit.NET.dll

OptimizeDataSource(string, CancellationToken)

Synchronously optimizes a file-based DataSource by compacting its data and updating its internal format to the latest version.

public static void OptimizeDataSource(string path, CancellationToken cancellationToken = default)

Parameters

path string

The file path to the DataSource that will be optimized. This must be a valid path pointing to an existing file.

cancellationToken CancellationToken

A CancellationToken that can be used to cancel the asynchronous optimization process.

Remarks

This method wraps an asynchronous optimization operation and waits for its completion. It reduces file fragmentation and updates the file's internal structure to enhance performance and ensure compatibility with the latest system updates.

If the underlying asynchronous operation fails, the inner exception is rethrown to the caller.

Exceptions

ArgumentNullException

Thrown if path is null, empty, or consists solely of whitespace.

FileNotFoundException

Thrown if no file exists at the specified path.