CompactVault Method

Compacts the vault.

Syntax

ANSI (Cross Platform)
int CompactVault();

Unicode (Windows)
INT CompactVault();
- (BOOL)compactVault;
#define MID_CBVAULT_COMPACTVAULT 7

CBFSVAULT_EXTERNAL int CBFSVAULT_CALL CBFSVault_CBVault_Do(void *lpObj, int methid, int cparam, void *param[], int cbparam[], int64 *lpllVal);

Remarks

This method triggers vault compaction, a process that shrinks a vault's overall size by truncating its free space. If the compacting operation completes successfully, this method returns true; otherwise it returns false.

Compaction involves physically moving a vault's occupied pages to the beginning of the vault, and then truncating the unoccupied pages from the end of the vault. The runtime of a compacting operation depends on a number of factors, and it's possible for it to be interrupted by other vault operations.

Compaction occurs automatically when the vault's free space percentage exceeds the threshold specified by the AutoCompactAt property. Applications can also use the AutoCompactDelay configuration setting to add a delay to the automatic compaction trigger.

Note that a vault opened in ReadOnly mode cannot be compacted, automatically or explicitly.

Note: This method can only be called when Active is true, and cannot be called within events.

Error Handling (C++)

This method returns a Boolean value; after it returns, call the GetLastErrorCode() method to obtain its result code; 0 indicates success, while a non-zero error code indicates that this method encountered an error during its execution. If an error occurs, the GetLastError() method can be called to retrieve the associated error message.

Copyright (c) 2021 Callback Technologies, Inc. - All rights reserved.
CBFS Vault 2020 C++ Edition - Version 20.0 [Build 7986]