Class: AerospikeNative::Operation

Inherits:
Object
  • Object
show all
Defined in:
ext/aerospike_native/operation.c

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#new(operation_type, bin_name, bin_value) ⇒ AerospikeNative::Operation

initialize new operation for client.operate command



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'ext/aerospike_native/operation.c', line 11

VALUE operation_initialize(VALUE vSelf, VALUE vOpType, VALUE vBinName, VALUE vBinValue)
{
    int op_type = 0;

    Check_Type(vOpType, T_FIXNUM);
    op_type = NUM2INT(vOpType);

    if (op_type != OPERATION_TOUCH) {
        Check_Type(vBinName, T_STRING);
    } else {
        Check_Type(vBinName, T_NIL);
    }

    rb_iv_set(vSelf, "@op_type", vOpType);
    rb_iv_set(vSelf, "@bin_name", vBinName);
    rb_iv_set(vSelf, "@bin_value", vBinValue);

    return vSelf;
}

Instance Attribute Details

#bin_nameObject (readonly)

#bin_valueObject (readonly)

#op_typeObject (readonly)

Class Method Details

.append(bin_name, bin_value) ⇒ AerospikeNative::Operation

initialize new append operation



52
53
54
55
56
57
58
59
60
61
62
# File 'ext/aerospike_native/operation.c', line 52

VALUE operation_append(VALUE vSelf, VALUE vBinName, VALUE vBinValue)
{
    VALUE vArgs[3];

    Check_Type(vBinValue, T_STRING);

    vArgs[0] = INT2NUM(OPERATION_APPEND);
    vArgs[1] = vBinName;
    vArgs[2] = vBinValue;
    return rb_class_new_instance(3, vArgs, vSelf);
}

.increment(bin_name, bin_value) ⇒ AerospikeNative::Operation

initialize new increment operation



88
89
90
91
92
93
94
95
96
97
98
# File 'ext/aerospike_native/operation.c', line 88

VALUE operation_increment(VALUE vSelf, VALUE vBinName, VALUE vBinValue)
{
    VALUE vArgs[3];

    Check_Type(vBinValue, T_FIXNUM);

    vArgs[0] = INT2NUM(OPERATION_INCREMENT);
    vArgs[1] = vBinName;
    vArgs[2] = vBinValue;
    return rb_class_new_instance(3, vArgs, vSelf);
}

.prepend(bin_name, bin_value) ⇒ AerospikeNative::Operation

initialize new prepend operation



70
71
72
73
74
75
76
77
78
79
80
# File 'ext/aerospike_native/operation.c', line 70

VALUE operation_prepend(VALUE vSelf, VALUE vBinName, VALUE vBinValue)
{
    VALUE vArgs[3];

    Check_Type(vBinValue, T_STRING);

    vArgs[0] = INT2NUM(OPERATION_PREPEND);
    vArgs[1] = vBinName;
    vArgs[2] = vBinValue;
    return rb_class_new_instance(3, vArgs, vSelf);
}

.read(bin_name) ⇒ AerospikeNative::Operation

initialize new read operation



122
123
124
125
126
127
128
129
130
# File 'ext/aerospike_native/operation.c', line 122

VALUE operation_read(VALUE vSelf, VALUE vBinName)
{
    VALUE vArgs[3];

    vArgs[0] = INT2NUM(OPERATION_READ);
    vArgs[1] = vBinName;
    vArgs[2] = Qnil;
    return rb_class_new_instance(3, vArgs, vSelf);
}

.touchAerospikeNative::Operation

initialize new touch operation



106
107
108
109
110
111
112
113
114
# File 'ext/aerospike_native/operation.c', line 106

VALUE operation_touch(VALUE vSelf)
{
    VALUE vArgs[3];

    vArgs[0] = INT2NUM(OPERATION_TOUCH);
    vArgs[1] = Qnil;
    vArgs[2] = Qnil;
    return rb_class_new_instance(3, vArgs, vSelf);
}

.write(bin_name, bin_value) ⇒ AerospikeNative::Operation

initialize new write operation



37
38
39
40
41
42
43
44
# File 'ext/aerospike_native/operation.c', line 37

VALUE operation_write(VALUE vSelf, VALUE vBinName, VALUE vBinValue)
{
    VALUE vArgs[3];
    vArgs[0] = INT2NUM(OPERATION_WRITE);
    vArgs[1] = vBinName;
    vArgs[2] = vBinValue;
    return rb_class_new_instance(3, vArgs, vSelf);
}