Kuzu::

Config class

Kùzu system config options container class.

Constants

INSPECT_FORMAT

The printf pattern used for inspect output

INSPECT_PARTS

The detail fragments that make up the inspect output, in the order they should appear.

Public Class Methods

from_options( source_options=nil, **options )

Return a default Config object with the specified options overridden. If source_options is a Kuzu::Config, the returned object will be a clone of it with the options applied.

# File lib/kuzu/config.rb, line 35
def self::from_options( source_options=nil, **options )
        config = source_options.dup || new()

        config.set( **options )

        return config
end
new() → config

Create a Kuzu::Config with default values.

static VALUE
rkuzu_config_initialize( VALUE self )
{
        kuzu_system_config *ptr = CHECK_CONFIG( self );

        if ( !ptr ) {
                ptr = ALLOC( kuzu_system_config );
                kuzu_system_config defaults = kuzu_default_system_config();

                ptr->buffer_pool_size     = defaults.buffer_pool_size;
                ptr->max_num_threads      = defaults.max_num_threads;
                ptr->enable_compression   = defaults.enable_compression;
                ptr->read_only            = defaults.read_only;
                ptr->max_db_size          = defaults.max_db_size;
                ptr->auto_checkpoint      = defaults.auto_checkpoint;
                ptr->checkpoint_threshold = defaults.checkpoint_threshold;

                RTYPEDDATA_DATA( self ) = ptr;
        } else {
                rb_raise( rb_eRuntimeError, "cannot reinit config" );
        }

        rb_call_super( 0, 0 );

        return Qtrue;
}

Public Instance Methods

auto_checkpoint() → true or false

Return the auto_checkpoint config value.

static VALUE
rkuzu_config_auto_checkpoint( VALUE self )
{
        kuzu_system_config *config = CHECK_CONFIG( self );
        return config->auto_checkpoint ? Qtrue : Qfalse;
}
auto_checkpoint = true or false

Set the auto_checkpoint config value.

static VALUE
rkuzu_config_auto_checkpoint_eq( VALUE self, VALUE value )
{
        kuzu_system_config *config = CHECK_CONFIG( self );
        config->auto_checkpoint = RTEST( value );

        return Qtrue;
}
buffer_pool_size() → integer

Return the buffer_pool_size config value.

static VALUE
rkuzu_config_buffer_pool_size( VALUE self )
{
        kuzu_system_config *config = CHECK_CONFIG( self );
        return ULONG2NUM( config->buffer_pool_size );
}
buffer_pool_size = integer

Set the buffer_pool_size config value.

static VALUE
rkuzu_config_buffer_pool_size_eq( VALUE self, VALUE value )
{
        kuzu_system_config *config = CHECK_CONFIG( self );
        config->buffer_pool_size = NUM2ULONG( value );

        return Qtrue;
}
checkpoint_threshold() → integer

Return the checkpoint_threshold config value.

static VALUE
rkuzu_config_checkpoint_threshold( VALUE self )
{
        kuzu_system_config *config = CHECK_CONFIG( self );
        return ULONG2NUM( config->checkpoint_threshold );
}
checkpoint_threshold = integer

Set the checkpoint_threshold config value.

static VALUE
rkuzu_config_checkpoint_threshold_eq( VALUE self, VALUE value )
{
        kuzu_system_config *config = CHECK_CONFIG( self );
        config->checkpoint_threshold = NUM2ULONG( value );

        return Qtrue;
}
enable_compression() → true or false

Return the enable_compression config value.

static VALUE
rkuzu_config_enable_compression( VALUE self )
{
        kuzu_system_config *config = CHECK_CONFIG( self );
        return config->enable_compression ? Qtrue : Qfalse;
}
enable_compression = true or false

Set the enable_compression config value.

static VALUE
rkuzu_config_enable_compression_eq( VALUE self, VALUE value )
{
        kuzu_system_config *config = CHECK_CONFIG( self );
        config->enable_compression = RTEST( value );

        return Qtrue;
}
inspect()

Return a human-readable representation of the object suitable for debugging.

# File lib/kuzu/config.rb, line 53
def inspect
        details = INSPECT_FORMAT % [
                self.buffer_pool_size,
                self.max_num_threads,
                self.enable_compression,
                self.read_only,
                self.max_db_size,
                self.auto_checkpoint,
                self.checkpoint_threshold,
        ]

        default = super
        return default.sub( />/, details + '>' )
end
max_db_size() → integer

Return the max_db_size config value.

static VALUE
rkuzu_config_max_db_size( VALUE self )
{
        kuzu_system_config *config = CHECK_CONFIG( self );
        return ULONG2NUM( config->max_db_size );
}
max_db_size = integer

Set the max_db_size config value.

static VALUE
rkuzu_config_max_db_size_eq( VALUE self, VALUE value )
{
        kuzu_system_config *config = CHECK_CONFIG( self );
        config->max_db_size = NUM2ULONG( value );

        return Qtrue;
}
max_num_threads() → integer

Return the max_num_threads config value.

static VALUE
rkuzu_config_max_num_threads( VALUE self )
{
        kuzu_system_config *config = CHECK_CONFIG( self );
        return ULONG2NUM( config->max_num_threads );
}
max_num_threads = integer

Set the max_num_threads config value.

static VALUE
rkuzu_config_max_num_threads_eq( VALUE self, VALUE value )
{
        kuzu_system_config *config = CHECK_CONFIG( self );
        config->max_num_threads = NUM2ULONG( value );

        return Qtrue;
}
read_only() → true or false

Return the read_only config value.

static VALUE
rkuzu_config_read_only( VALUE self )
{
        kuzu_system_config *config = CHECK_CONFIG( self );
        return config->read_only ? Qtrue : Qfalse;
}
read_only = true or false

Set the read_only config value.

static VALUE
rkuzu_config_read_only_eq( VALUE self, VALUE value )
{
        kuzu_system_config *config = CHECK_CONFIG( self );
        config->read_only = RTEST( value );

        return Qtrue;
}
set( **options )

Set one or more options.

# File lib/kuzu/config.rb, line 45
def set( **options )
        options.each do |opt, val|
                self.public_send( "#{opt}=", val )
        end
end