Compression

The CBFS Vault filesystem stores data in a vault as a series of one or more pages. To reduce space usage, CBFS Vault can compress files and alternate streams with an application-selected compression algorithm using the following mechanism, which is optimized to provide optimal performance for both sequential and random data access:

  1. A block of data composed of a specific number of pages is passed to the compression routine, which attempts to compress the data.
  2. If the compressed data can be stored using fewer pages than before, it is written to the vault. Otherwise, the original (uncompressed) data is written instead.
  3. Steps 1 and 2 are repeated until all of the data pages associated with the file or alternate stream have been processed.

Compressing Files and Alternate Streams

To specify a default compression mode for files and alternate streams, applications can set the DefaultFileCompression property (and, if applicable, the DefaultFileCompressionLevel configuration setting). Additionally, the following methods allow applications to set a file or alternate stream's compression mode explicitly:

Using Custom Compression

CBFS Vault includes built-in support for zlib and RLE data compression. However, applications can also choose to provide their own custom compression implementation using the DataCompress and DataDecompress events.

Supported Compression Modes

CBFS Vault supports the following compression modes:

CBFSSTORAGE_CM_NONE0Don't use compression.

CBFSSTORAGE_CM_DEFAULT1Use default compression (zlib).

CBFSSTORAGE_CM_CUSTOM2Use event-based custom compression.

Compression level is not used.

CBFSSTORAGE_CM_ZLIB3Use zlib compression.

Valid compression levels are 1-9.

CBFSSTORAGE_CM_RLE4Use RLE compression.

Compression level is not used.

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