Vault Size
By default, a vault grows automatically as more data is written to it, and shrinks automatically when its free space percentage reaches the threshold defined by the auto_compact_at property.
Applications can use the following properties to both control, and obtain information about, a vault's size. Please refer to each one's documentation for more information.
- vault_size_max: Specifies the maximum size a vault can be; 0 (unlimited) by default.
- vault_size_min: Specifies the minimum size a vault can be; 0 by default.
- vault_size: Reflects a vault's actual size; and can also be used to explicitly resize a vault, keeping in mind the following:
- A vault cannot shrink more than its available free space allows (i.e., not by more than vault_free_space bytes).
- A vault cannot shrink beyond vault_size_min bytes.
- If vault_size_max is not 0 (unlimited), a vault cannot grow beyond vault_size_max bytes.
- If a vault grows enough to reach/exceed its auto_compact_at threshold, it will automatically shrink again when the next automatic compaction occurs.
- vault_free_space: Reflects the actual amount of free space a vault has available.
- possible_size: Reflects the maximum size a vault could possibly be.
- possible_free_space: Reflects the maximum amount of free space a vault could possibly have available.
(Note: All API members discussed in this topic are available in both CBDrive, CBMemDrive, and CBVault, unless otherwise noted.)
For CBDrive, please note that the size of a vault backed by a storage volume or partition (i.e., one created/opened using the format_volume/open_volume methods) is identical to the size of said storage volume or partition itself. Such vaults, once created, cannot be resized using any of the properties or methods discussed above.