Commands: StartCompact

StartCompact initializes the compaction of the indicated file system. This operation makes the file system offline for the time of compaction.

Syntax

Task<long> StartCompact(string filesystemName);
Parameters
filesystemName string The name of a file system to compact

Return Value
Task<long> A task that represents the asynchronous restore operation. The task result is the operation identifier.

Example

long compactOperationId = await store.AsyncFilesCommands.Admin
									.StartCompact("NorthwindFS");

If you need to wait until the operation finishes, you will have to initialize DocumentStore associated with <system> database and wait for the operation completion:

using (var sysDbStore = new DocumentStore
{
	Url = "http://localhost:8080/"
}.Initialize())
{
	await new Operation((AsyncServerClient)sysDbStore.AsyncDatabaseCommands, compactOperationId)
				.WaitForCompletionAsync();
}