Slice APIs

Most of the DB methods behave the same way with or without a sliced environment or database. Some small differences in behavior may result when using a sliced environment or database, and a few methods simply do not support slices. These differences are identified in the Berkeley DB C API Reference Guide when they occur.

In addition, sliced environments and databases offer the following methods:

  • [DB_ENV->get_slice_count()](https://docs.oracle.com/database/bdb181/html/api_reference/C/envget_slice_count.html)

    Returns the number of slices configured for the environment.

  • [DB_ENV->get_slices()](https://docs.oracle.com/database/bdb181/html/api_reference/C/envget_slices.html)

    Returns an array of pointers to sub-environments in use to support your sliced environment. Be aware that all these handles are automatically closed when you close the encompassing environment; you should not close them explicitly.

  • [DB->set_slice_callback()](https://docs.oracle.com/database/bdb181/html/api_reference/C/dbset_slice_callback.html)

    Sets an optional callback that is used to identify the slice-relevant portion of your records’ key. It allows a transaction to access many different keys, as long as the slice callback for those keys returns the same value.

  • [DB->get_slices()](https://docs.oracle.com/database/bdb181/html/api_reference/C/dbget_slices.html)

    Returns an array of pointers to databases in use to support your sliced environment. There is one such database for each slice that you configured for your environment. Be aware that all these handles are automatically closed when you close the top-level database handle; you should not close them explicitly.

  • [DB->slice_lookup()](https://docs.oracle.com/database/bdb181/html/api_reference/C/dbslice_lookup.html)

    Returns the slice database which contains the key that you provide to this method.