neuray API Programmer's Manual

mi::neuraylib::IDatabase_configuration Class Reference

[Configuration Interfaces]

Description

This interface is used to query and change the database configuration.

Public Member Functions

virtual const char* get_disk_swapping() const =0
Returns the configured directory for disk swapping. More...
virtual void get_memory_limits( Size* low_water, Size* high_water) const =0
Returns the limits for memory usage of the database. More...
virtual Sint32 set_disk_swapping( const char* path) =0
Configures the directory for disk swapping. More...
virtual Sint32 set_memory_limits( Size low_water, Size high_water) =0
Sets the limits for memory usage of the database. More...

Member Functions

virtual const char* mi::​neuraylib::​IDatabase_configuration::get_disk_swapping() const [pure virtual]

Returns the configured directory for disk swapping.

See also:

set_disk_swapping(), set_memory_limits(), get_memory_limits()

Returns

The configured directory, or NULL if disabled.

virtual void mi::​neuraylib::​IDatabase_configuration::get_memory_limits( Size* low_water, Size* high_water) const [pure virtual]

Returns the limits for memory usage of the database.

See also:

set_memory_limits(), set_disk_swapping(), get_disk_swapping()

Parameters

low_water
The current low water mark (in bytes).
high_water
The current high water mark (in bytes).
virtual Sint32 mi::​neuraylib::​IDatabase_configuration::set_disk_swapping( const char* path) [pure virtual]

Configures the directory for disk swapping. If no directory is configured (the default) disk swapping is disabled.

Note:

The configured directory must be used exclusively from one instance of this API component. Sharing the directory between multiple nodes in a network, or between different instances of this API component on the same node (same or different processes) leads to wrong behavior.

See also:

get_disk_swapping(), set_memory_limits(), get_memory_limits()

Parameters

path
The path to the directory to use for disk swapping.

Returns

0, in case of success, -1 in case of failure.

virtual Sint32 mi::​neuraylib::​IDatabase_configuration::set_memory_limits( Size low_water, Size high_water) [pure virtual]

Sets the limits for memory usage of the database. The database attempts to keep the total amount of memory used by database elements and jobs below a configurable limit called high water mark. If that limit is exceeded the database takes actions to reduce the memory usage until another limit, the low water mark, is reached (or no further memory reduction is possible). An internal binary format is used which can be read into the database again very fast. This method can be called at any time from any thread but no guarantee can be given if and when the new memory limits will be reached.

Possible actions taken by the database to reduce memory usage are:

  • Discarding results of database jobs.

  • Discarding local copies of elements and jobs that are not required (some copies might be required to meet the configured redundancy level).

  • If disk swapping is enabled, offload database elements to disk.

See also:

get_memory_limits(), set_disk_swapping(), get_disk_swapping(), mi::neuraylib::INetwork_configuration::set_redundancy_level(), mi::neuraylib::INetwork_configuration::get_redundancy_level()

Parameters

low_water
Flushing stops when memory usage (in bytes) drops below this value.
high_water
Flushing starts when memory usage (in bytes) exceeds this value. The value 0 disables flushing completely.

Returns

0 in case of success, -1 in case of failure ( low_water not less than high_water unless high_water equals zero).