Configuration

Configuration objects can be used when creating a TileDB context, or when using consolidation and virtual filesystem (VFS) functionality. See Configuration Parameters for a summary of all TileDB configuration options.

Basic Usage

You can create and set configuration objects as follows:

// Create a configuration object
tiledb_config_t *config;
tiledb_config_alloc(&config, NULL);

// Set a configuration parameter
tiledb_config_set(config, "sm.tile_cache_size", "5000", &error);

// Get a configuration parameter
const char* value;
tiledb_config_get(config, "sm.tile_cache_size", &value, &error);

// Unset a configuration parameter
tiledb_config_unset(config, "sm.tile_cache_size", &error);

// Clean up
tiledb_config_free(&config);

Saving To / Loading From File

You can save a configuration object into a text file, as well as load a configuration object from a text file, as follows:

// Create a TileDB config
tiledb_config_t* config;
tiledb_config_alloc(&config, NULL);
tiledb_config_set(config, "sm.tile_cache_size", "0", &error);

// Save to file
tiledb_config_save_to_file(config, "tiledb_config.txt", &error);

// Load from file
tiledb_config_t* config_load;
tiledb_config_alloc(&config_load, &error);
tiledb_config_load_from_file(config_load, "tiledb_config.txt", &error);
const char* value;
tiledb_config_get(config_load, "sm.tile_cache_size", &value, &error);

// Clean up
tiledb_config_free(&config);
tiledb_config_free(&config_load);

Configuration Iterator

You can also use a configuration iterator as follows:

 // Create a TileDB config
tiledb_config_t* config;
tiledb_config_alloc(&config, NULL);

// Create a TileDB config iterator
// You can use any prefix instead of "vfs.s3."
tiledb_config_iter_t* config_iter;
tiledb_config_iter_alloc(config, "vfs.s3.", &config_iter, &error);

// Print all configuration parameters that start with "vfs.s3"
// Note that the prefix is exluded from the results
printf("\nVFS S3 settings:\n");
int done = 0;
const char *param, *value;
tiledb_config_iter_done(config_iter, &done, &error);
while (!done) {
  tiledb_config_iter_here(config_iter, &param, &value, &error);
  printf("\"%s\" : \"%s\"\n", param, value);
  tiledb_config_iter_next(config_iter, &error);
  tiledb_config_iter_done(config_iter, &done, &error);
}

// You can reset the iterator as follows
tiledb_config_iter_reset(config, config_iter, NULL, NULL);

// Clean up
tiledb_config_free(&config);
tiledb_config_iter_free(&config_iter);

Configuration Parameters

Below we provide a table with all the TileDB configuration parameters, along with their description and default values. See Configuration for information on how to set them.

Last updated