Module: Groonga::Flushable

Included in:
Column, Database, Table
Defined in:
ext/groonga/rb-grn-flushable.c,
ext/groonga/rb-grn-flushable.c

Overview

It provides the ability to flush data on memory to disk.

Instance Method Summary collapse

Instance Method Details

#flush(options = {}) ⇒ void

Flush memory mapped data to disk.

This method returns an undefined value.

Parameters:

  • options (::Hash) (defaults to: {})

Options Hash (options):

  • :recursive (Boolean) — default: true

    Whether to flush objects which a target object has recursively.



40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# File 'ext/groonga/rb-grn-flushable.c', line 40

static VALUE
rb_grn_flushable_flush (int argc, VALUE *argv, VALUE self)
{
    grn_ctx *context = NULL;
    grn_obj *object = NULL;
    VALUE rb_recursive_p;
    VALUE rb_options;

    rb_scan_args(argc, argv, "01", &rb_options);
    rb_grn_scan_options(rb_options,
                        "recursive", &rb_recursive_p,
                        NULL);
    if (NIL_P(rb_recursive_p)) {
        rb_recursive_p = Qtrue;
    }

    rb_grn_object_deconstruct(SELF(self), &object, &context,
                              NULL, NULL, NULL, NULL);
    if (!object) {
        rb_raise(rb_eGrnClosed,
                 "can't access already closed Groonga object: <%s>",
                 rb_grn_inspect(self));
    }

    if (RVAL2CBOOL(rb_recursive_p)) {
        grn_obj_flush_recursive(context, object);
    } else {
        grn_obj_flush(context, object);
    }
    rb_grn_context_check(context, self);

    return Qnil;
}