class Aerospike::Exp::Operation

Expression operations.

Public Class Methods

create_operation(type, name, exp, flags) click to toggle source
# File lib/aerospike/exp/operation.rb, line 46
def self.create_operation(type, name, exp, flags)
  Packer.use do |packer|
    packer.write_array_header(2)
    exp.pack(packer)
    packer.write(flags)

    return Operation.new(type, name, BytesValue.new(packer.bytes))
  end
end
read(name, exp, flags = Aerospike::Exp::ReadFlags::DEFAULT) click to toggle source

Create operation that performs a read expression. Requires server version 5.6.0+.

@param name variable name of read expression result. This name can be used as the

bin name when retrieving bin results from the record.

@param exp expression to evaluate @param flags expression read flags. See {Exp::ExpReadFlags}

# File lib/aerospike/exp/operation.rb, line 40
def self.read(name, exp, flags = Aerospike::Exp::ReadFlags::DEFAULT)
  create_operation(Aerospike::Operation::EXP_READ, name, exp, flags)
end
write(bin_name, exp, flags = Aerospike::Exp::WriteFlags::DEFAULT) click to toggle source

Create operation that performs an expression that writes to a record bin. Requires server version 5.6.0+.

@param bin_name name of bin to store expression result @param exp expression to evaluate @param flags expression write flags. See {Exp::WriteFlags}

# File lib/aerospike/exp/operation.rb, line 28
def self.write(bin_name, exp, flags = Aerospike::Exp::WriteFlags::DEFAULT)
  create_operation(Aerospike::Operation::EXP_MODIFY, bin_name, exp, flags)
end