From e54c151fa7cce3e819be0b37d035e1eb422dc84d Mon Sep 17 00:00:00 2001 From: Khosrow Afroozeh Date: Fri, 9 Aug 2024 17:50:34 +0200 Subject: [PATCH] Cleanup documentation --- .github/workflows/development.yml | 8 +- lib/aerospike/batch_delete.rb | 4 +- lib/aerospike/batch_read.rb | 10 +- lib/aerospike/batch_record.rb | 14 +- lib/aerospike/batch_udf.rb | 4 +- lib/aerospike/batch_write.rb | 10 +- lib/aerospike/cdt/bit_operation.rb | 9 +- lib/aerospike/exp/exp.rb | 44 ++--- lib/aerospike/exp/exp_bit.rb | 48 ++--- lib/aerospike/exp/exp_hll.rb | 24 +-- lib/aerospike/exp/exp_list.rb | 164 ++++++++-------- lib/aerospike/exp/exp_map.rb | 204 ++++++++++---------- lib/aerospike/exp/operation.rb | 4 +- lib/aerospike/operation.rb | 1 + lib/aerospike/policy/batch_delete_policy.rb | 8 +- lib/aerospike/policy/batch_policy.rb | 4 +- lib/aerospike/policy/batch_read_policy.rb | 8 +- lib/aerospike/policy/batch_udf_policy.rb | 8 +- lib/aerospike/policy/batch_write_policy.rb | 8 +- lib/aerospike/policy/policy.rb | 2 +- 20 files changed, 285 insertions(+), 301 deletions(-) diff --git a/.github/workflows/development.yml b/.github/workflows/development.yml index 60acc9df..122c34c3 100644 --- a/.github/workflows/development.yml +++ b/.github/workflows/development.yml @@ -15,10 +15,10 @@ jobs: ruby: - "2.6" - - "2.7" - - "3.0" - - "3.1" - - "3.2" + #- "2.7" + #- "3.0" + #- "3.1" + #- "3.2" - "3.3" experimental: [false] diff --git a/lib/aerospike/batch_delete.rb b/lib/aerospike/batch_delete.rb index f67f1824..89af0403 100644 --- a/lib/aerospike/batch_delete.rb +++ b/lib/aerospike/batch_delete.rb @@ -27,14 +27,14 @@ def initialize(key, opt = {}) @policy = BatchRecord.create_policy(opt, BatchDeletePolicy, DEFAULT_BATCH_DELETE_POLICY) end - def ==(other) + def ==(other) # :nodoc: other && other.instance_of?(self.class) && @policy == other.policy end DEFAULT_BATCH_DELETE_POLICY = BatchDeletePolicy.new # Return wire protocol size. For internal use only. - def size + def size # :nodoc: size = 6 # gen(2) + exp(4) = 6 size += @policy&.filter_exp&.size if @policy&.filter_exp diff --git a/lib/aerospike/batch_read.rb b/lib/aerospike/batch_read.rb index 9a62cb7a..ef0f0934 100644 --- a/lib/aerospike/batch_read.rb +++ b/lib/aerospike/batch_read.rb @@ -25,12 +25,12 @@ class BatchRead < BatchRecord attr_accessor :policy # Bins to retrieve for this key. bin_names are mutually exclusive with - # {@link com.aerospike.client.BatchRead#ops}. + # {BatchRead#ops}. attr_accessor :bin_names # Optional operations for this key. ops are mutually exclusive with - # {@link com.aerospike.client.BatchRead#bin_names}. A bin_name can be emulated with - # {@link com.aerospike.client.Operation#get(String)} + # {BatchRead#bin_names}. A bin_name can be emulated with + # {Operation#get(bin_name)} attr_accessor :ops # If true, ignore bin_names and read all bins. @@ -66,7 +66,7 @@ def self.ops(key, ops, opt = {}) # Optimized reference equality check to determine batch wire protocol repeat flag. # For internal use only. - def ==(other) + def ==(other) # :nodoc: other && other.instance_of?(self.class) && @bin_names.sort == other.bin_names.sort && @ops.sort == other.ops.sort && @policy == other.policy && @read_all_bins == other.read_all_bins @@ -75,7 +75,7 @@ def ==(other) DEFAULT_BATCH_READ_POLICY = BatchReadPolicy.new # Return wire protocol size. For internal use only. - def size + def size # :nodoc: size = 0 size += @policy&.filter_exp&.size if @policy&.filter_exp diff --git a/lib/aerospike/batch_record.rb b/lib/aerospike/batch_record.rb index 898aa7ad..273af83e 100644 --- a/lib/aerospike/batch_record.rb +++ b/lib/aerospike/batch_record.rb @@ -22,11 +22,11 @@ class BatchRecord attr_reader :key # Record result after batch command has completed. Will be null if record was not found - # or an error occurred. See {@link BatchRecord#result_code}. + # or an error occurred. See {BatchRecord#result_code}. attr_reader :record - # Result code for this returned record. See {@link com.aerospike.client.ResultCode}. - # If not {@link com.aerospike.client.ResultCode#OK}, the record will be null. + # Result code for this returned record. See {ResultCode}. + # If not {ResultCode#OK}, the record will be null. attr_accessor :result_code # Is it possible that the write transaction may have completed even though an error @@ -46,7 +46,7 @@ def initialize(key, result_code: ResultCode::NO_RESPONSE, in_doubt: false, has_w @has_write = has_write end - def self.create_policy(policy, policy_klass, default_policy = nil) + def self.create_policy(policy, policy_klass, default_policy = nil) # :nodoc: case policy when nil default_policy || policy_klass.new @@ -61,20 +61,20 @@ def self.create_policy(policy, policy_klass, default_policy = nil) # Prepare for upcoming batch call. Reset result fields because this instance might be # reused. For internal use only. - def prepare + def prepare # :nodoc: @record = nil @result_code = ResultCode::NO_RESPONSE @in_doubt = false end # Set record result. For internal use only. - def record=(record) + def record=(record) # :nodoc: @record = record @result_code = ResultCode::OK end # Set error result. For internal use only. - def set_error(result_code, in_doubt) + def set_error(result_code, in_doubt) # :nodoc: @result_code = result_code @in_doubt = in_doubt end diff --git a/lib/aerospike/batch_udf.rb b/lib/aerospike/batch_udf.rb index 22bdddd0..40c1c6e2 100644 --- a/lib/aerospike/batch_udf.rb +++ b/lib/aerospike/batch_udf.rb @@ -49,7 +49,7 @@ def initialize(key, package_name, function_name, function_args, opt = {}) # Optimized reference equality check to determine batch wire protocol repeat flag. # For internal use only. - def equals(other) + def ==(other) # :nodoc: other && other.instance_of?(self.class) && @function_name == other.function_name && @function_args == other.function_args && @package_name == other.package_name && @policy == other.policy @@ -58,7 +58,7 @@ def equals(other) DEFAULT_BATCH_UDF_POLICY = BatchUDFPolicy.new # Return wire protocol size. For internal use only. - def size + def size # :nodoc: size = 6 # gen(2) + exp(4) = 6 size += @policy&.filter_exp&.size if @policy&.filter_exp diff --git a/lib/aerospike/batch_write.rb b/lib/aerospike/batch_write.rb index 74b5520b..5fa177a1 100644 --- a/lib/aerospike/batch_write.rb +++ b/lib/aerospike/batch_write.rb @@ -30,10 +30,10 @@ class BatchWrite < BatchRecord attr_accessor :ops # Initialize batch key and read/write operations. - #

- # {@link Operation#get()} is not allowed because it returns a variable number of bins and + # + # {Operation#get()} is not allowed because it returns a variable number of bins and # makes it difficult (sometimes impossible) to lineup operations with results. Instead, - # use {@link Operation#get(String)} for each bin name. + # use {Operation#get(bin_name)} for each bin name. def initialize(key, ops, opt = {}) super(key, has_write: true) @policy = BatchRecord.create_policy(opt, BatchWritePolicy, DEFAULT_BATCH_WRITE_POLICY) @@ -42,7 +42,7 @@ def initialize(key, ops, opt = {}) # Optimized reference equality check to determine batch wire protocol repeat flag. # For internal use only. - def ==(other) + def ==(other) # :nodoc: other && other.instance_of?(self.class) && @ops == other.ops && @policy == other.policy && (@policy.nil? || !@policy.send_key) end @@ -50,7 +50,7 @@ def ==(other) DEFAULT_BATCH_WRITE_POLICY = BatchWritePolicy.new # Return wire protocol size. For internal use only. - def size + def size # :nodoc: size = 6 # gen(2) + exp(4) = 6 size += @policy&.filter_exp&.size if @policy&.filter_exp diff --git a/lib/aerospike/cdt/bit_operation.rb b/lib/aerospike/cdt/bit_operation.rb index d0a70857..cb64685a 100644 --- a/lib/aerospike/cdt/bit_operation.rb +++ b/lib/aerospike/cdt/bit_operation.rb @@ -65,9 +65,8 @@ def initialize(op_type, bit_op, bin_name, *arguments, ctx: nil, policy: nil) @arguments = arguments end - # BitResizeOp creates byte "resize" operation. - # Server resizes byte[] to byte_size according to resize_flags (See {@link BitResizeFlags}). + # Server resizes byte[] to byte_size according to resize_flags (See {BitResizeFlags}). # Server does not return a value. # Example: # bin = [0b00000001, 0b01000010] @@ -195,7 +194,7 @@ def self.rshift(bin_name, bit_offset, bit_size, shift, ctx: nil, policy: BitPoli # BitAddOp creates bit "add" operation. # Server adds value to byte[] bin starting at bit_offset for bit_size. Bit_size must be <= 64. # Signed indicates if bits should be treated as a signed number. - # If add overflows/underflows, {@link BitOverflowAction} is used. + # If add overflows/underflows, {BitOverflowAction} is used. # Server does not return a value. # Example: # bin = [0b00000001, 0b01000010, 0b00000011, 0b00000100, 0b00000101] @@ -223,7 +222,7 @@ def self.add( # BitSubtractOp creates bit "subtract" operation. # Server subtracts value from byte[] bin starting at bit_offset for bit_size. Bit_size must be <= 64. # Signed indicates if bits should be treated as a signed number. - # If add overflows/underflows, {@link BitOverflowAction} is used. + # If add overflows/underflows, {BitOverflowAction} is used. # Server does not return a value. # Example: # bin = [0b00000001, 0b01000010, 0b00000011, 0b00000100, 0b00000101] @@ -351,7 +350,7 @@ def pack_bin_value bytes = nil args = arguments.dup Packer.use do |packer| - if @ctx != nil && @ctx.length > 0 + if !@ctx.nil? && @ctx.length > 0 packer.write_array_header(3) Value.of(0xff).pack(packer) diff --git a/lib/aerospike/exp/exp.rb b/lib/aerospike/exp/exp.rb index b3f3a099..4908c362 100644 --- a/lib/aerospike/exp/exp.rb +++ b/lib/aerospike/exp/exp.rb @@ -96,7 +96,7 @@ def self.key(type) end # Create expression that returns if the primary key is stored in the record meta data - # as a boolean expression. This would occur when {@link Policy#send_key} + # as a boolean expression. This would occur when {Policy#send_key} # is true on record write. This expression usually evaluates quickly because record # meta data is cached in memory. # @@ -214,7 +214,7 @@ def self.bin_exists(name) end # Create expression that returns bin's integer particle type:: - # See {@link ParticleType}. + # See {ParticleType}. # # ==== Examples # # Bin "a" particle type is a list @@ -225,8 +225,8 @@ def self.bin_type(name) # Create expression that returns the record size. This expression usually evaluates # quickly because record meta data is cached in memory. - # Requires server version 7.0+. This expression replaces {@link #deviceSize()} and - # {@link #memorySize()} since those older expressions are equivalent on server version 7.0+. + # Requires server version 7.0+. This expression replaces {#deviceSize()} and + # {#memorySize()} since those older expressions are equivalent on server version 7.0+. # # {@code # // Record size >= 100 KB @@ -347,7 +347,7 @@ def self.digest_modulo(mod) # Exp.regex_compare("prefix.*suffix", RegexFlags.ICASE | RegexFlags.NEWLINE, Exp.str_bin("a")) # # @param regex regular expression string - # @param flags regular expression bit flags. See {@link Exp::RegexFlags} + # @param flags regular expression bit flags. See {Exp::RegexFlags} # @param bin string bin or string value expression def self.regex_compare(regex, flags, bin) Regex.new(bin, regex, flags) @@ -873,7 +873,7 @@ def self.cond(*exps) # # ==== Examples # Args Format: , , ..., - # def: {@link Exp#def(String, Exp)} + # def: {Exp#def(String, Exp)} # exp: Scoped expression # # ==== Examples @@ -887,7 +887,7 @@ def self.let(*exps) Let.new(exps) end - # Assign variable to a {@link Exp#let(Exp...)} expression that can be accessed later. + # Assign variable to a {Exp#let(Exp...)} expression that can be accessed later. # Requires server version 5.6.0+. # # ==== Examples @@ -920,8 +920,8 @@ def self.var(name) #-------------------------------------------------- # Create unknown value. Used to intentionally fail an expression. - # The failure can be ignored with {@link Exp::WriteFlags#EVAL_NO_FAIL} - # or {@link Exp::ReadFlags#EVAL_NO_FAIL}. + # The failure can be ignored with {Exp::WriteFlags#EVAL_NO_FAIL} + # or {Exp::ReadFlags#EVAL_NO_FAIL}. # Requires server version 5.6.0+. # # ==== Examples @@ -1066,10 +1066,7 @@ def self.pack_ctx(packer, ctx) # For internal use only. class Module < Exp - attr_reader :bin - attr_reader :bytes - attr_reader :ret_type - attr_reader :module + attr_reader :bin, :bytes, :ret_type, :module def initialize(bin, bytes, ret_type, modul) @bin = bin @@ -1090,8 +1087,7 @@ def pack(packer) end class Bin < Exp - attr_reader :name - attr_reader :type + attr_reader :name, :type def initialize(name, type) @name = name @@ -1107,9 +1103,7 @@ def pack(packer) end class Regex < Exp - attr_reader :bin - attr_reader :regex - attr_reader :flags + attr_reader :bin, :regex, :flags def initialize(bin, regex, flags) @bin = bin @@ -1135,7 +1129,7 @@ def initialize(exps) def pack(packer) # Let wire format: LET , , , , ..., - count = (@exps.length - 1) * 2 + 2 + count = ((@exps.length - 1) * 2) + 2 packer.write_array_header(count) packer.write(LET) @@ -1146,8 +1140,7 @@ def pack(packer) end class Def < Exp - attr_reader :name - attr_reader :exp + attr_reader :name, :exp def initialize(name, exp) @name = name @@ -1161,8 +1154,7 @@ def pack(packer) end class CmdExp < Exp - attr_reader :exps - attr_reader :cmd + attr_reader :exps, :cmd def initialize(cmd, *exps) @exps = exps @@ -1179,8 +1171,7 @@ def pack(packer) end class CmdInt < Exp - attr_reader :cmd - attr_reader :val + attr_reader :cmd, :val def initialize(cmd, val) @cmd = cmd @@ -1195,8 +1186,7 @@ def pack(packer) end class CmdStr < Exp - attr_reader :str - attr_reader :cmd + attr_reader :str, :cmd def initialize(cmd, str) @str = str diff --git a/lib/aerospike/exp/exp_bit.rb b/lib/aerospike/exp/exp_bit.rb index 2824d313..30a702a7 100644 --- a/lib/aerospike/exp/exp_bit.rb +++ b/lib/aerospike/exp/exp_bit.rb @@ -15,7 +15,7 @@ # the License. module Aerospike - # Bit expression generator. See {@link Exp}. + # Bit expression generator. See {Exp}. # # The bin expression argument in these methods can be a reference to a bin or the # result of another expression. Expressions that modify bin values are only used @@ -42,7 +42,7 @@ class Exp::Bit # Exp.val(2)) def self.resize(byte_size, resize_flags, bin, policy: CDT::BitPolicy::DEFAULT) bytes = Exp.pack(nil, RESIZE, byte_size, policy.flags, resize_flags) - self.add_write(bin, bytes) + add_write(bin, bytes) end # Create expression that inserts value bytes into byte[] bin at byte_offset and returns byte[]. @@ -60,7 +60,7 @@ def self.resize(byte_size, resize_flags, bin, policy: CDT::BitPolicy::DEFAULT) # Exp.val(2)) def self.insert(byte_offset, value, bin, policy: CDT::BitPolicy::DEFAULT) bytes = Exp.pack(nil, INSERT, byte_offset, value, policy.flags) - self.add_write(bin, bytes) + add_write(bin, bytes) end # Create expression that removes bytes from byte[] bin at byte_offset for byte_size and returns byte[]. @@ -78,7 +78,7 @@ def self.insert(byte_offset, value, bin, policy: CDT::BitPolicy::DEFAULT) # Exp.val(2)) def self.remove(byte_offset, byte_size, bin, policy: CDT::BitPolicy::DEFAULT) bytes = Exp.pack(nil, REMOVE, byte_offset, byte_size, policy.flags) - self.add_write(bin, bytes) + add_write(bin, bytes) end # Create expression that sets value on byte[] bin at bit_offset for bit_size and returns byte[]. @@ -97,7 +97,7 @@ def self.remove(byte_offset, byte_size, bin, policy: CDT::BitPolicy::DEFAULT) # Exp.val(2)) def self.set(bit_offset, bit_size, value, bin, policy: CDT::BitPolicy::DEFAULT) bytes = Exp.pack(nil, SET, bit_offset, bit_size, value, policy.flags) - self.add_write(bin, bytes) + add_write(bin, bytes) end # Create expression that performs bitwise "or" on value and byte[] bin at bit_offset for bit_size @@ -111,7 +111,7 @@ def self.set(bit_offset, bit_size, value, bin, policy: CDT::BitPolicy::DEFAULT) # def self.or(bit_offset, bit_size, value, bin, policy: CDT::BitPolicy::DEFAULT) bytes = Exp.pack(nil, OR, bit_offset, bit_size, value, policy.flags) - self.add_write(bin, bytes) + add_write(bin, bytes) end # Create expression that performs bitwise "xor" on value and byte[] bin at bit_offset for bit_size @@ -125,7 +125,7 @@ def self.or(bit_offset, bit_size, value, bin, policy: CDT::BitPolicy::DEFAULT) # def self.xor(bit_offset, bit_size, value, bin, policy: CDT::BitPolicy::DEFAULT) bytes = Exp.pack(nil, XOR, bit_offset, bit_size, value, policy.flags) - self.add_write(bin, bytes) + add_write(bin, bytes) end # Create expression that performs bitwise "and" on value and byte[] bin at bit_offset for bit_size @@ -139,7 +139,7 @@ def self.xor(bit_offset, bit_size, value, bin, policy: CDT::BitPolicy::DEFAULT) # def self.and(bit_offset, bit_size, value, bin, policy: CDT::BitPolicy::DEFAULT) bytes = Exp.pack(nil, AND, bit_offset, bit_size, value, policy.flags) - self.add_write(bin, bytes) + add_write(bin, bytes) end # Create expression that negates byte[] bin starting at bit_offset for bit_size and returns byte[]. @@ -151,7 +151,7 @@ def self.and(bit_offset, bit_size, value, bin, policy: CDT::BitPolicy::DEFAULT) # def self.not(bit_offset, bit_size, bin, policy: CDT::BitPolicy::DEFAULT) bytes = Exp.pack(nil, NOT, bit_offset, bit_size, policy.flags) - self.add_write(bin, bytes) + add_write(bin, bytes) end # Create expression that shifts left byte[] bin starting at bit_offset for bit_size and returns byte[]. @@ -164,7 +164,7 @@ def self.not(bit_offset, bit_size, bin, policy: CDT::BitPolicy::DEFAULT) # def self.lshift(bit_offset, bit_size, shift, bin, policy: CDT::BitPolicy::DEFAULT) bytes = Exp.pack(nil, LSHIFT, bit_offset, bit_size, shift, policy.flags) - self.add_write(bin, bytes) + add_write(bin, bytes) end # Create expression that shifts right byte[] bin starting at bit_offset for bit_size and returns byte[]. @@ -177,12 +177,12 @@ def self.lshift(bit_offset, bit_size, shift, bin, policy: CDT::BitPolicy::DEFAUL # def self.rshift(bit_offset, bit_size, shift, bin, policy: CDT::BitPolicy::DEFAULT) bytes = Exp.pack(nil, RSHIFT, bit_offset, bit_size, shift, policy.flags) - self.add_write(bin, bytes) + add_write(bin, bytes) end # Create expression that adds value to byte[] bin starting at bit_offset for bit_size and returns byte[]. # BitSize must be <= 64. Signed indicates if bits should be treated as a signed number. - # If add overflows/underflows, {@link BitOverflowAction} is used. + # If add overflows/underflows, {BitOverflowAction} is used. # # bin = [0b00000001, 0b01000010, 0b00000011, 0b00000100, 0b00000101] # bit_offset = 24 @@ -192,13 +192,13 @@ def self.rshift(bit_offset, bit_size, shift, bin, policy: CDT::BitPolicy::DEFAUL # bin result = [0b00000001, 0b01000010, 0b00000011, 0b00000100, 0b10000101] # def self.add(bit_offset, bit_size, value, signed, bit_overflow_action, bin, policy: CDT::BitPolicy::DEFAULT) - bytes = self.pack_math(ADD, policy, bit_offset, bit_size, value, signed, bit_overflow_action) - self.add_write(bin, bytes) + bytes = pack_math(ADD, policy, bit_offset, bit_size, value, signed, bit_overflow_action) + add_write(bin, bytes) end # Create expression that subtracts value from byte[] bin starting at bit_offset for bit_size and returns byte[]. # BitSize must be <= 64. Signed indicates if bits should be treated as a signed number. - # If add overflows/underflows, {@link BitOverflowAction} is used. + # If add overflows/underflows, {BitOverflowAction} is used. # # bin = [0b00000001, 0b01000010, 0b00000011, 0b00000100, 0b00000101] # bit_offset = 24 @@ -208,8 +208,8 @@ def self.add(bit_offset, bit_size, value, signed, bit_overflow_action, bin, poli # bin result = [0b00000001, 0b01000010, 0b00000011, 0b0000011, 0b10000101] # def self.subtract(bit_offset, bit_size, value, signed, bit_overflow_action, bin, policy: CDT::BitPolicy::DEFAULT) - bytes = self.pack_math(SUBTRACT, policy, bit_offset, bit_size, value, signed, bit_overflow_action) - self.add_write(bin, bytes) + bytes = pack_math(SUBTRACT, policy, bit_offset, bit_size, value, signed, bit_overflow_action) + add_write(bin, bytes) end # Create expression that sets value to byte[] bin starting at bit_offset for bit_size and returns byte[]. @@ -223,7 +223,7 @@ def self.subtract(bit_offset, bit_size, value, signed, bit_overflow_action, bin, # def self.set_int(bit_offset, bit_size, value, bin, policy: CDT::BitPolicy::DEFAULT) bytes = Exp.pack(nil, SET_INT, bit_offset, bit_size, value, policy.flags) - self.add_write(bin, bytes) + add_write(bin, bytes) end # Create expression that returns bits from byte[] bin starting at bit_offset for bit_size. @@ -240,7 +240,7 @@ def self.set_int(bit_offset, bit_size, value, bin, policy: CDT::BitPolicy::DEFAU # Exp.val(new byte[] {(byte)0b10000000})) def self.get(bit_offset, bit_size, bin) bytes = Exp.pack(nil, GET, bit_offset, bit_size) - self.add_read(bin, bytes, Exp::Type::BLOB) + add_read(bin, bytes, Exp::Type::BLOB) end # Create expression that returns integer count of set bits from byte[] bin starting at @@ -256,7 +256,7 @@ def self.get(bit_offset, bit_size, bin) # Exp.le(BitExp.count(Exp.val(0), Exp.val(5), Exp.blobBin("a")), Exp.val(2)) def self.count(bit_offset, bit_size, bin) bytes = Exp.pack(nil, COUNT, bit_offset, bit_size) - self.add_read(bin, bytes, Exp::Type::INT) + add_read(bin, bytes, Exp::Type::INT) end # Create expression that returns integer bit offset of the first specified value bit in byte[] bin @@ -278,7 +278,7 @@ def self.count(bit_offset, bit_size, bin) # @param bin bin or blob value expression def self.lscan(bit_offset, bit_size, value, bin) bytes = Exp.pack(nil, LSCAN, bit_offset, bit_size, value) - self.add_read(bin, bytes, Exp::Type::INT) + add_read(bin, bytes, Exp::Type::INT) end # Create expression that returns integer bit offset of the last specified value bit in byte[] bin @@ -301,7 +301,7 @@ def self.lscan(bit_offset, bit_size, value, bin) # @param bin bin or blob value expression def self.rscan(bit_offset, bit_size, value, bin) bytes = Exp.pack(nil, RSCAN, bit_offset, bit_size, value) - self.add_read(bin, bytes, Exp::Type::INT) + add_read(bin, bytes, Exp::Type::INT) end # Create expression that returns integer from byte[] bin starting at bit_offset for bit_size. @@ -317,8 +317,8 @@ def self.rscan(bit_offset, bit_size, value, bin) # # getInt(a) == 16899 # Exp.eq(BitExp.getInt(Exp.val(8), Exp.val(16), false, Exp.blobBin("a")), Exp.val(16899)) def self.get_int(bit_offset, bit_size, signed, bin) - bytes = self.pack_get_int(bit_offset, bit_size, signed) - self.add_read(bin, bytes, Exp::Type::INT) + bytes = pack_get_int(bit_offset, bit_size, signed) + add_read(bin, bytes, Exp::Type::INT) end private diff --git a/lib/aerospike/exp/exp_hll.rb b/lib/aerospike/exp/exp_hll.rb index 16b4c53e..156c4414 100644 --- a/lib/aerospike/exp/exp_hll.rb +++ b/lib/aerospike/exp/exp_hll.rb @@ -15,7 +15,7 @@ # the License. module Aerospike - # HyperLogLog (HLL) expression generator. See {@link Exp}. + # HyperLogLog (HLL) expression generator. See {Exp}. # # The bin expression argument in these methods can be a reference to a bin or the # result of another expression. Expressions that modify bin values are only used @@ -25,14 +25,14 @@ class Exp::HLL # Create expression that creates a new HLL or resets an existing HLL with minhash bits. # - # @param policy write policy, use {@link HLLPolicy#Default} for default + # @param policy write policy, use {HLLPolicy#Default} for default # @param index_bit_count number of index bits. Must be between 4 and 16 inclusive. # @param min_hash_bit_count number of min hash bits. Must be between 4 and 51 inclusive. # Also, index_bit_count + min_hash_bit_count must be <= 64. Optional. # @param bin HLL bin or value expression def self.init(index_bit_count, bin, min_hash_bit_count: Exp.int_val(-1), policy: CDT::HLLPolicy::DEFAULT) bytes = Exp.pack(nil, INIT, index_bit_count, min_hash_bit_count, policy.flags) - self.add_write(bin, bytes) + add_write(bin, bytes) end # Create expression that adds values to a HLL set and returns HLL set. If HLL bin does not @@ -45,7 +45,7 @@ def self.init(index_bit_count, bin, min_hash_bit_count: Exp.int_val(-1), policy: # HLLExp.add(HLLPolicy.Default, Exp.val(list), Exp.val(10), Exp.val(20), Exp.hllBin("a"))), # Exp.val(7)) # - # @param policy write policy, use {@link HLLPolicy#Default} for default + # @param policy write policy, use {HLLPolicy#Default} for default # @param list list bin or value expression of values to be added # @param index_bit_count number of index bits expression. Must be between 4 and 16 inclusive. # @param min_hash_bit_count number of min hash bits expression. Must be between 4 and 51 inclusive. @@ -53,7 +53,7 @@ def self.init(index_bit_count, bin, min_hash_bit_count: Exp.int_val(-1), policy: # @param bin HLL bin or value expression def self.add(list, bin, policy: CDT::HLLPolicy::DEFAULT, index_bit_count: Exp.val(-1), min_hash_bit_count: Exp.val(-1)) bytes = Exp.pack(nil, ADD, list, index_bit_count, min_hash_bit_count, policy.flags) - self.add_write(bin, bytes) + add_write(bin, bytes) end # Create expression that returns estimated number of elements in the HLL bin. @@ -63,7 +63,7 @@ def self.add(list, bin, policy: CDT::HLLPolicy::DEFAULT, index_bit_count: Exp.va # Exp.gt(HLLExp.getCount(Exp.hllBin("a")), Exp.val(7)) def self.get_count(bin) bytes = Exp.pack(nil, COUNT) - self.add_read(bin, bytes, Exp::Type::INT) + add_read(bin, bytes, Exp::Type::INT) end # Create expression that returns a HLL object that is the union of all specified HLL objects @@ -77,7 +77,7 @@ def self.get_count(bin) # HLLExp.getUnion(Exp.val(list), Exp.hllBin("b")) def self.get_union(list, bin) bytes = Exp.pack(nil, UNION, list) - self.add_read(bin, bytes, Exp::Type::HLL) + add_read(bin, bytes, Exp::Type::HLL) end # Create expression that returns estimated number of elements that would be contained by @@ -91,7 +91,7 @@ def self.get_union(list, bin) # HLLExp.getUnionCount(Exp.val(list), Exp.hllBin("b")) def self.get_union_count(list, bin) bytes = Exp.pack(nil, UNION_COUNT, list) - self.add_read(bin, bytes, Exp::Type::INT) + add_read(bin, bytes, Exp::Type::INT) end # Create expression that returns estimated number of elements that would be contained by @@ -105,7 +105,7 @@ def self.get_union_count(list, bin) # HLLExp.getIntersectCount(Exp.val(list), Exp.hllBin("b")) def self.get_intersect_count(list, bin) bytes = Exp.pack(nil, INTERSECT_COUNT, list) - self.add_read(bin, bytes, Exp::Type::INT) + add_read(bin, bytes, Exp::Type::INT) end # Create expression that returns estimated similarity of these HLL objects as a @@ -116,7 +116,7 @@ def self.get_intersect_count(list, bin) # Exp.ge(HLLExp.getSimilarity(Exp.hllBin("a"), Exp.hllBin("b")), Exp.val(0.75)) def self.get_similarity(list, bin) bytes = Exp.pack(nil, SIMILARITY, list) - self.add_read(bin, bytes, Exp::Type::FLOAT) + add_read(bin, bytes, Exp::Type::FLOAT) end # Create expression that returns index_bit_count and min_hash_bit_count used to create HLL bin @@ -130,7 +130,7 @@ def self.get_similarity(list, bin) # Exp.val(10)) def self.describe(bin) bytes = Exp.pack(nil, DESCRIBE) - self.add_read(bin, bytes, Exp::Type::LIST) + add_read(bin, bytes, Exp::Type::LIST) end # Create expression that returns one if HLL bin may contain all items in the list. @@ -142,7 +142,7 @@ def self.describe(bin) # Exp.eq(HLLExp.mayContain(Exp.val(list), Exp.hllBin("a")), Exp.val(1)) def self.may_contain(list, bin) bytes = Exp.pack(nil, MAY_CONTAIN, list) - self.add_read(bin, bytes, Exp::Type::INT) + add_read(bin, bytes, Exp::Type::INT) end private diff --git a/lib/aerospike/exp/exp_list.rb b/lib/aerospike/exp/exp_list.rb index 70a03007..4985735d 100644 --- a/lib/aerospike/exp/exp_list.rb +++ b/lib/aerospike/exp/exp_list.rb @@ -16,7 +16,7 @@ module Aerospike - # List expression generator. See {@link Exp}. + # List expression generator. See {Exp}. # # The bin expression argument in these methods can be a reference to a bin or the # result of another expression. Expressions that modify bin values are only used @@ -50,74 +50,74 @@ class Exp::List # Create expression that appends value to end of list. def self.append(value, bin, ctx: nil, policy: CDT::ListPolicy::DEFAULT) bytes = Exp.pack(ctx, APPEND, value, policy.order, policy.flags) - self.add_write(bin, bytes, ctx) + add_write(bin, bytes, ctx) end # Create expression that appends list items to end of list. def self.append_items(list, bin, ctx: nil, policy: CDT::ListPolicy::DEFAULT) bytes = Exp.pack(ctx, APPEND_ITEMS, list, policy.order, policy.flags) - self.add_write(bin, bytes, ctx) + add_write(bin, bytes, ctx) end # Create expression that inserts value to specified index of list. def self.insert(index, value, bin, ctx: nil, policy: CDT::ListPolicy::DEFAULT) bytes = Exp.pack(ctx, INSERT, index, value, policy.flags) - self.add_write(bin, bytes, ctx) + add_write(bin, bytes, ctx) end # Create expression that inserts each input list item starting at specified index of list. def self.insert_items(index, list, bin, ctx: nil, policy: CDT::ListPolicy::DEFAULT) bytes = Exp.pack(ctx, INSERT_ITEMS, index, list, policy.flags) - self.add_write(bin, bytes, ctx) + add_write(bin, bytes, ctx) end # Create expression that increments list[index] by value. # Value expression should resolve to a number. def self.increment(index, value, bin, ctx: nil, policy: CDT::ListPolicy::DEFAULT) bytes = Exp.pack(ctx, INCREMENT, index, value, policy.order, policy.flags) - self.add_write(bin, bytes, ctx) + add_write(bin, bytes, ctx) end # Create expression that sets item value at specified index in list. def self.set(index, value, bin, ctx: nil, policy: CDT::ListPolicy::DEFAULT) bytes = Exp.pack(ctx, SET, index, value, policy.flags) - self.add_write(bin, bytes, ctx) + add_write(bin, bytes, ctx) end # Create expression that removes all items in list. def self.clear(bin, ctx: nil) bytes = Exp.pack(ctx, CLEAR) - self.add_write(bin, bytes, ctx) + add_write(bin, bytes, ctx) end # Create expression that sorts list according to sort_flags. # - # @param sort_flags sort flags. See {@link ListSortFlagsend. + # @param sort_flags sort flags. See {ListSortFlagsend. # @param bin bin or list value expression # @param ctx optional context path for nested CDT def self.sort(sort_flags, bin, ctx: nil) bytes = Exp.pack(ctx, SORT, sort_flags) - self.add_write(bin, bytes, ctx) + add_write(bin, bytes, ctx) end # Create expression that removes list items identified by value. def self.remove_by_value(value, bin, ctx: nil) bytes = Exp.pack(ctx, REMOVE_BY_VALUE, CDT::ListReturnType::NONE, value) - self.add_write(bin, bytes, ctx) + add_write(bin, bytes, ctx) end # Create expression that removes list items identified by values. def self.remove_by_value_list(values, bin, ctx: nil) bytes = Exp.pack(ctx, REMOVE_BY_VALUE_LIST, CDT::ListReturnType::NONE, values) - self.add_write(bin, bytes, ctx) + add_write(bin, bytes, ctx) end # Create expression that removes list items identified by value range (value_begin inclusive, value_end exclusive). # If value_begin is nil, the range is less than value_end. If value_end is nil, the range is # greater than equal to value_begin. def self.remove_by_value_range(value_begin, value_end, bin, ctx: nil) - bytes = self.pack_range_operation(REMOVE_BY_VALUE_INTERVAL, CDT::ListReturnType::NONE, value_begin, value_end, ctx) - self.add_write(bin, bytes, ctx) + bytes = pack_range_operation(REMOVE_BY_VALUE_INTERVAL, CDT::ListReturnType::NONE, value_begin, value_end, ctx) + add_write(bin, bytes, ctx) end # Create expression that removes list items nearest to value and greater by relative rank with a count limit if provided. @@ -132,44 +132,44 @@ def self.remove_by_value_range(value_begin, value_end, bin, ctx: nil) # (3,3,7) = [11,15] # (3,-3,2) = [] def self.remove_by_value_relative_rank_range(value, rank, bin, ctx: nil, count: nil) - unless count.nil? - bytes = Exp.pack(ctx, REMOVE_BY_VALUE_REL_RANK_RANGE, CDT::ListReturnType::NONE, value, rank, count) - else - bytes = Exp.pack(ctx, REMOVE_BY_VALUE_REL_RANK_RANGE, CDT::ListReturnType::NONE, value, rank) - end - self.add_write(bin, bytes, ctx) + bytes = if count.nil? + Exp.pack(ctx, REMOVE_BY_VALUE_REL_RANK_RANGE, CDT::ListReturnType::NONE, value, rank) + else + Exp.pack(ctx, REMOVE_BY_VALUE_REL_RANK_RANGE, CDT::ListReturnType::NONE, value, rank, count) + end + add_write(bin, bytes, ctx) end # Create expression that removes list item identified by index. def self.remove_by_index(index, bin, ctx: nil) bytes = Exp.pack(ctx, REMOVE_BY_INDEX, CDT::ListReturnType::NONE, index) - self.add_write(bin, bytes, ctx) + add_write(bin, bytes, ctx) end # Create expression that removes "count" list items starting at specified index. def self.remove_by_index_range(index, bin, ctx: nil, count: nil) - unless count.nil? - bytes = Exp.pack(ctx, REMOVE_BY_INDEX_RANGE, CDT::ListReturnType::NONE, index, count) - else - bytes = Exp.pack(ctx, REMOVE_BY_INDEX_RANGE, CDT::ListReturnType::NONE, index) - end - self.add_write(bin, bytes, ctx) + bytes = if count.nil? + Exp.pack(ctx, REMOVE_BY_INDEX_RANGE, CDT::ListReturnType::NONE, index) + else + Exp.pack(ctx, REMOVE_BY_INDEX_RANGE, CDT::ListReturnType::NONE, index, count) + end + add_write(bin, bytes, ctx) end # Create expression that removes list item identified by rank. def self.remove_by_rank(rank, bin, ctx: nil) bytes = Exp.pack(ctx, REMOVE_BY_RANK, CDT::ListReturnType::NONE, rank) - self.add_write(bin, bytes, ctx) + add_write(bin, bytes, ctx) end # Create expression that removes "count" list items starting at specified rank. def self.remove_by_rank_range(rank, bin, ctx: nil, count: nil) - unless count.nil? - bytes = Exp.pack(ctx, REMOVE_BY_RANK_RANGE, CDT::ListReturnType::NONE, rank, count) - else - bytes = Exp.pack(ctx, REMOVE_BY_RANK_RANGE, CDT::ListReturnType::NONE, rank) - end - self.add_write(bin, bytes, ctx) + bytes = if count.nil? + Exp.pack(ctx, REMOVE_BY_RANK_RANGE, CDT::ListReturnType::NONE, rank) + else + Exp.pack(ctx, REMOVE_BY_RANK_RANGE, CDT::ListReturnType::NONE, rank, count) + end + add_write(bin, bytes, ctx) end # Create expression that returns list size. @@ -180,7 +180,7 @@ def self.remove_by_rank_range(rank, bin, ctx: nil, count: nil) # end def self.size(bin, ctx: nil) bytes = Exp.pack(ctx, SIZE) - self.add_read(bin, bytes, Exp::Type::INT) + add_read(bin, bytes, Exp::Type::INT) end # Create expression that selects list items identified by value and returns selected @@ -193,13 +193,13 @@ def self.size(bin, ctx: nil) # Exp.val(0)) # end # - # @param return_type metadata attributes to return. See {@link CDT::ListReturnTypeend + # @param return_type metadata attributes to return. See {CDT::ListReturnType} # @param value search expression # @param bin list bin or list value expression # @param ctx optional context path for nested CDT def self.get_by_value(return_type, value, bin, ctx: nil) bytes = Exp.pack(ctx, GET_BY_VALUE, return_type, value) - self.add_read(bin, bytes, get_value_type(return_type)) + add_read(bin, bytes, get_value_type(return_type)) end # Create expression that selects list items identified by value range and returns selected data @@ -210,25 +210,25 @@ def self.get_by_value(return_type, value, bin, ctx: nil) # ListExp.getByValueRange(CDT::ListReturnType::VALUE, Exp.val(10), Exp.val(20), Exp.listBin("a")) # end # - # @param return_type metadata attributes to return. See {@link CDT::ListReturnTypeend + # @param return_type metadata attributes to return. See {CDT::ListReturnType} # @param value_begin begin expression inclusive. If nil, range is less than value_end. # @param value_end end expression exclusive. If nil, range is greater than equal to value_begin. # @param bin bin or list value expression # @param ctx optional context path for nested CDT def self.get_by_value_range(return_type, value_begin, value_end, bin, ctx: nil) - bytes = self.pack_range_operation(GET_BY_VALUE_INTERVAL, return_type, value_begin, value_end, ctx) - self.add_read(bin, bytes, get_value_type(return_type)) + bytes = pack_range_operation(GET_BY_VALUE_INTERVAL, return_type, value_begin, value_end, ctx) + add_read(bin, bytes, get_value_type(return_type)) end # Create expression that selects list items identified by values and returns selected data # specified by return_type. def self.get_by_value_list(return_type, values, bin, ctx: nil) bytes = Exp.pack(ctx, GET_BY_VALUE_LIST, return_type, values) - self.add_read(bin, bytes, get_value_type(return_type)) + add_read(bin, bytes, get_value_type(return_type)) end # Create expression that selects list items nearest to value and greater by relative rank with a count limit - # and returns selected data specified by return_type (See {@link CDT::ListReturnTypeend). + # and returns selected data specified by return_type (See {CDT::ListReturnType}). # # Examples for ordered list [0,4,5,9,11,15]: # @@ -240,12 +240,12 @@ def self.get_by_value_list(return_type, values, bin, ctx: nil) # (3,3,7) = [11,15] # (3,-3,2) = [] def self.get_by_value_relative_rank_range(return_type, value, rank, bin, ctx: nil, count: nil) - unless count.nil? - bytes = Exp.pack(ctx, GET_BY_VALUE_REL_RANK_RANGE, return_type, value, rank, count) - else - bytes = Exp.pack(ctx, GET_BY_VALUE_REL_RANK_RANGE, return_type, value, rank) - end - self.add_read(bin, bytes, get_value_type(return_type)) + bytes = if count.nil? + Exp.pack(ctx, GET_BY_VALUE_REL_RANK_RANGE, return_type, value, rank) + else + Exp.pack(ctx, GET_BY_VALUE_REL_RANK_RANGE, return_type, value, rank, count) + end + add_read(bin, bytes, get_value_type(return_type)) end # Create expression that selects list item identified by index and returns @@ -258,32 +258,32 @@ def self.get_by_value_relative_rank_range(return_type, value, rank, bin, ctx: ni # Exp.val(5)) # end # - # @param return_type metadata attributes to return. See {@link CDT::ListReturnTypeend + # @param return_type metadata attributes to return. See {CDT::ListReturnType} # @param value_type expected type of value # @param index list index expression # @param bin list bin or list value expression # @param ctx optional context path for nested CDT def self.get_by_index(return_type, value_type, index, bin, ctx: nil) bytes = Exp.pack(ctx, GET_BY_INDEX, return_type, index) - self.add_read(bin, bytes, value_type) + add_read(bin, bytes, value_type) end # Create expression that selects list items starting at specified index to the end of list - # and returns selected data specified by return_type (See {@link CDT::ListReturnTypeend). + # and returns selected data specified by return_type (See {CDT::ListReturnType}). def self.get_by_index_range(return_type, index, bin, ctx: nil) bytes = Exp.pack(ctx, GET_BY_INDEX_RANGE, return_type, index) - self.add_read(bin, bytes, get_value_type(return_type)) + add_read(bin, bytes, get_value_type(return_type)) end # Create expression that selects "count" list items starting at specified index - # and returns selected data specified by return_type (See {@link CDT::ListReturnTypeend). + # and returns selected data specified by return_type (See {CDT::ListReturnType}). def self.get_by_index_range(return_type, index, bin, ctx: nil, count: nil) - unless count.nil? - bytes = Exp.pack(ctx, GET_BY_INDEX_RANGE, return_type, index, count) - else - bytes = Exp.pack(ctx, GET_BY_INDEX_RANGE, return_type, index) - end - self.add_read(bin, bytes, get_value_type(return_type)) + bytes = if count.nil? + Exp.pack(ctx, GET_BY_INDEX_RANGE, return_type, index) + else + Exp.pack(ctx, GET_BY_INDEX_RANGE, return_type, index, count) + end + add_read(bin, bytes, get_value_type(return_type)) end # Create expression that selects list item identified by rank and returns selected @@ -294,32 +294,32 @@ def self.get_by_index_range(return_type, index, bin, ctx: nil, count: nil) # ListExp.getByRank(CDT::ListReturnType::VALUE, Type.STRING, Exp.val(0), Exp.listBin("a")) # end # - # @param return_type metadata attributes to return. See {@link CDT::ListReturnTypeend + # @param return_type metadata attributes to return. See {CDT::ListReturnType} # @param value_type expected type of value # @param rank rank expression # @param bin list bin or list value expression # @param ctx optional context path for nested CDT def self.get_by_rank(return_type, value_type, rank, bin, ctx: nil) bytes = Exp.pack(ctx, GET_BY_RANK, return_type, rank) - self.add_read(bin, bytes, value_type) + add_read(bin, bytes, value_type) end # Create expression that selects list items starting at specified rank to the last ranked item - # and returns selected data specified by return_type (See {@link CDT::ListReturnTypeend). + # and returns selected data specified by return_type (See {CDT::ListReturnType}). def self.get_by_rank_range(return_type, rank, bin, ctx: nil) bytes = Exp.pack(ctx, GET_BY_RANK_RANGE, return_type, rank) - self.add_read(bin, bytes, get_value_type(return_type)) + add_read(bin, bytes, get_value_type(return_type)) end # Create expression that selects "count" list items starting at specified rank and returns - # selected data specified by return_type (See {@link CDT::ListReturnTypeend). + # selected data specified by return_type (See {CDT::ListReturnType}). def self.get_by_rank_range(return_type, rank, bin, ctx: nil, count: nil) - unless count.nil? - bytes = Exp.pack(ctx, GET_BY_RANK_RANGE, return_type, rank, count) - else - bytes = Exp.pack(ctx, GET_BY_RANK_RANGE, return_type, rank) - end - self.add_read(bin, bytes, get_value_type(return_type)) + bytes = if count.nil? + Exp.pack(ctx, GET_BY_RANK_RANGE, return_type, rank) + else + Exp.pack(ctx, GET_BY_RANK_RANGE, return_type, rank, count) + end + add_read(bin, bytes, get_value_type(return_type)) end private @@ -336,7 +336,7 @@ def self.get_by_rank_range(return_type, rank, bin, ctx: nil, count: nil) SIZE = 16 GET_BY_INDEX = 19 GET_BY_RANK = 21 - GET_BY_VALUE = 22 # GET_ALL_BY_VALUE on server + GET_BY_VALUE = 22 # GET_ALL_BY_VALUE on server GET_BY_VALUE_LIST = 23 GET_BY_INDEX_RANGE = 24 GET_BY_VALUE_INTERVAL = 25 @@ -352,11 +352,11 @@ def self.get_by_rank_range(return_type, rank, bin, ctx: nil, count: nil) REMOVE_BY_VALUE_REL_RANK_RANGE = 40 def self.add_write(bin, bytes, ctx) - if ctx.to_a.empty? - ret_type = Exp::Type::LIST - else - ret_type = ((ctx[0].id & 0x10) == 0) ? Exp::Type::MAP : Exp::Type::LIST - end + ret_type = if ctx.to_a.empty? + Exp::Type::LIST + else + (ctx[0].id & 0x10) == 0 ? Exp::Type::MAP : Exp::Type::LIST + end Exp::Module.new(bin, bytes, ret_type, MODULE | Exp::MODIFY) end @@ -379,14 +379,12 @@ def self.pack_range_operation(command, return_type, value_begin, value_end, ctx) packer.write(command) packer.write(return_type) - unless value_begin.nil? - if value_begin.is_a?(Exp) - value_begin.pack(packer) - else - Value.of(value_begin).pack(packer) - end - else + if value_begin.nil? packer.write(nil) + elsif value_begin.is_a?(Exp) + value_begin.pack(packer) + else + Value.of(value_begin).pack(packer) end unless value_end.nil? diff --git a/lib/aerospike/exp/exp_map.rb b/lib/aerospike/exp/exp_map.rb index 0cae9958..473cfade 100644 --- a/lib/aerospike/exp/exp_map.rb +++ b/lib/aerospike/exp/exp_map.rb @@ -15,7 +15,7 @@ # the License. module Aerospike - # Map expression generator. See {@link Exp}. + # Map expression generator. See {Exp}. # # The bin expression argument in these methods can be a reference to a bin or the # result of another expression. Expressions that modify bin values are only used @@ -80,24 +80,22 @@ def self.put(key, value, bin, ctx: nil, policy: CDT::MapPolicy::DEFAULT) value.pack(packer) packer.write(policy.attributes) packer.write(policy.flags) + elsif policy.item_command == REPLACE + Exp.pack_ctx(packer, ctx) + packer.write_array_header(3) + packer.write(policy.item_command) + key.pack(packer) + value.pack(packer) + # Replace doesn't allow map attributes because it does not create on non-existing key. else - if policy.item_command == REPLACE - # Replace doesn't allow map attributes because it does not create on non-existing key. - Exp.pack_ctx(packer, ctx) - packer.write_array_header(3) - packer.write(policy.item_command) - key.pack(packer) - value.pack(packer) - else Exp.pack_ctx(packer, ctx) packer.write_array_header(4) packer.write(policy.item_command) key.pack(packer) value.pack(packer) packer.write(policy.attributes) - end end - self.add_write(bin, packer.bytes, ctx) + add_write(bin, packer.bytes, ctx) end end @@ -111,22 +109,20 @@ def self.put_items(map, bin, ctx: nil, policy: CDT::MapPolicy::DEFAULT) map.pack(packer) packer.write(policy.attributes) packer.write(policy.flags) + elsif policy.items_command == REPLACE_ITEMS + Exp.pack_ctx(packer, ctx) + packer.write_array_header(2) + packer.write(policy.items_command) + map.pack(packer) + # Replace doesn't allow map attributes because it does not create on non-existing key. else - if policy.items_command == REPLACE_ITEMS - # Replace doesn't allow map attributes because it does not create on non-existing key. - Exp.pack_ctx(packer, ctx) - packer.write_array_header(2) - packer.write(policy.items_command) - map.pack(packer) - else Exp.pack_ctx(packer, ctx) packer.write_array_header(3) packer.write(policy.items_command) map.pack(packer) packer.write(policy.attributes) - end end - self.add_write(bin, packer.bytes, ctx) + add_write(bin, packer.bytes, ctx) end end @@ -134,25 +130,25 @@ def self.put_items(map, bin, ctx: nil, policy: CDT::MapPolicy::DEFAULT) # Valid only for numbers. def self.increment(key, incr, bin, ctx: nil, policy: CDT::MapPolicy::DEFAULT) bytes = Exp.pack(ctx, INCREMENT, key, incr, policy.attributes) - return self.add_write(bin, bytes, ctx) + add_write(bin, bytes, ctx) end # Create expression that removes all items in map. def self.clear(bin, ctx: nil) bytes = Exp.pack(ctx, CLEAR) - return self.add_write(bin, bytes, ctx) + add_write(bin, bytes, ctx) end # Create expression that removes map item identified by key. def self.remove_by_key(key, bin, ctx: nil) bytes = Exp.pack(ctx, REMOVE_BY_KEY, CDT::MapReturnType::NONE, key) - return self.add_write(bin, bytes, ctx) + add_write(bin, bytes, ctx) end # Create expression that removes map items identified by keys. def self.remove_by_key_list(keys, bin, ctx: nil) bytes = Exp.pack(ctx, REMOVE_BY_KEY_LIST, CDT::MapReturnType::NONE, keys) - return self.add_write(bin, bytes, ctx) + add_write(bin, bytes, ctx) end # Create expression that removes map items identified by key range (key_begin inclusive, key_end exclusive). @@ -160,7 +156,7 @@ def self.remove_by_key_list(keys, bin, ctx: nil) # If key_end is nil, the range is greater than equal to key_begin. def self.remove_by_key_range(key_begin, key_end, bin, ctx: nil) bytes = Exp::List.pack_range_operation(REMOVE_BY_KEY_INTERVAL, CDT::MapReturnType::NONE, key_begin, key_end, ctx) - return self.add_write(bin, bytes, ctx) + add_write(bin, bytes, ctx) end # Create expression that removes map items nearest to key and greater by index with a count limit if provided. @@ -174,24 +170,24 @@ def self.remove_by_key_range(key_begin, key_end, bin, ctx: nil) # (3,2,1) = [{9=10}] # (3,-2,2) = [{0=17}] def self.remove_by_key_relative_index_range(key, index, bin, ctx: nil, count: nil) - unless count.nil? - bytes = Exp.pack(ctx, REMOVE_BY_KEY_REL_INDEX_RANGE, CDT::MapReturnType::NONE, key, index, count) - else - bytes = Exp.pack(ctx, REMOVE_BY_KEY_REL_INDEX_RANGE, CDT::MapReturnType::NONE, key, index) - end - return self.add_write(bin, bytes, ctx) + bytes = if count.nil? + Exp.pack(ctx, REMOVE_BY_KEY_REL_INDEX_RANGE, CDT::MapReturnType::NONE, key, index) + else + Exp.pack(ctx, REMOVE_BY_KEY_REL_INDEX_RANGE, CDT::MapReturnType::NONE, key, index, count) + end + add_write(bin, bytes, ctx) end # Create expression that removes map items identified by value. def self.remove_by_value(value, bin, ctx: nil) bytes = Exp.pack(ctx, REMOVE_BY_VALUE, CDT::MapReturnType::NONE, value) - return self.add_write(bin, bytes, ctx) + add_write(bin, bytes, ctx) end # Create expression that removes map items identified by values. def self.remove_by_value_list(values, bin, ctx: nil) bytes = Exp.pack(ctx, REMOVE_BY_VALUE_LIST, CDT::MapReturnType::NONE, values) - return self.add_write(bin, bytes, ctx) + add_write(bin, bytes, ctx) end # Create expression that removes map items identified by value range (valueBegin inclusive, valueEnd exclusive). @@ -199,7 +195,7 @@ def self.remove_by_value_list(values, bin, ctx: nil) # If valueEnd is nil, the range is greater than equal to valueBegin. def self.remove_by_value_range(valueBegin, valueEnd, bin, ctx: nil) bytes = Exp::List.pack_range_operation(REMOVE_BY_VALUE_INTERVAL, CDT::MapReturnType::NONE, valueBegin, valueEnd, ctx) - return self.add_write(bin, bytes, ctx) + add_write(bin, bytes, ctx) end # Create expression that removes map items nearest to value and greater by relative rank. @@ -211,7 +207,7 @@ def self.remove_by_value_range(valueBegin, valueEnd, bin, ctx: nil) # (11,-1) = [{9=10},{5=15},{0=17}] def self.remove_by_value_relative_rank_range(value, rank, bin, ctx: nil) bytes = Exp.pack(ctx, REMOVE_BY_VALUE_REL_RANK_RANGE, CDT::MapReturnType::NONE, value, rank) - return self.add_write(bin, bytes, ctx) + add_write(bin, bytes, ctx) end # Create expression that removes map items nearest to value and greater by relative rank with a count limit. @@ -223,40 +219,40 @@ def self.remove_by_value_relative_rank_range(value, rank, bin, ctx: nil) # (11,-1,1) = [{9=10}] def self.remove_by_value_relative_rank_range(value, rank, count, bin, ctx: nil) bytes = Exp.pack(ctx, REMOVE_BY_VALUE_REL_RANK_RANGE, CDT::MapReturnType::NONE, value, rank, count) - return self.add_write(bin, bytes, ctx) + add_write(bin, bytes, ctx) end # Create expression that removes map item identified by index. def self.remove_by_index(index, bin, ctx: nil) bytes = Exp.pack(ctx, REMOVE_BY_INDEX, CDT::MapReturnType::NONE, index) - return self.add_write(bin, bytes, ctx) + add_write(bin, bytes, ctx) end # Create expression that removes "count" map items starting at specified index limited by count if provided. def self.remove_by_index_range(index, bin, ctx: nil, count: nil) - unless count.nil? - bytes = Exp.pack(ctx, REMOVE_BY_INDEX_RANGE, CDT::MapReturnType::NONE, index, count) - else - bytes = Exp.pack(ctx, REMOVE_BY_INDEX_RANGE, CDT::MapReturnType::NONE, index) - end - return self.add_write(bin, bytes, ctx) + bytes = if count.nil? + Exp.pack(ctx, REMOVE_BY_INDEX_RANGE, CDT::MapReturnType::NONE, index) + else + Exp.pack(ctx, REMOVE_BY_INDEX_RANGE, CDT::MapReturnType::NONE, index, count) + end + add_write(bin, bytes, ctx) end # Create expression that removes map item identified by rank. def self.remove_by_rank(rank, bin, ctx: nil) bytes = Exp.pack(ctx, REMOVE_BY_RANK, CDT::MapReturnType::NONE, rank) - return self.add_write(bin, bytes, ctx) + add_write(bin, bytes, ctx) end # Create expression that removes "count" map items starting at specified rank. If count is not provided, # all items until the last ranked item will be removed def self.remove_by_rank_range(rank, bin, ctx: nil, count: nil) - unless count.nil? - bytes = Exp.pack(ctx, REMOVE_BY_RANK_RANGE, CDT::MapReturnType::NONE, rank, count) - else - bytes = Exp.pack(ctx, REMOVE_BY_RANK_RANGE, CDT::MapReturnType::NONE, rank) - end - return self.add_write(bin, bytes, ctx) + bytes = if count.nil? + Exp.pack(ctx, REMOVE_BY_RANK_RANGE, CDT::MapReturnType::NONE, rank) + else + Exp.pack(ctx, REMOVE_BY_RANK_RANGE, CDT::MapReturnType::NONE, rank, count) + end + add_write(bin, bytes, ctx) end # Create expression that returns list size. @@ -266,7 +262,7 @@ def self.remove_by_rank_range(rank, bin, ctx: nil, count: nil) # Exp.gt(MapExp.size(mapBin("a")), Exp.val(7)) def self.size(bin, ctx: nil) bytes = Exp.pack(ctx, SIZE) - return self.add_read(bin, bytes, Exp::Type::INT) + add_read(bin, bytes, Exp::Type::INT) end # Create expression that selects map item identified by key and returns selected data @@ -278,35 +274,35 @@ def self.size(bin, ctx: nil) # MapExp.getByKey(CDT::MapReturnType::COUNT, Exp::Type::INT, Exp.val("B"), Exp.mapBin("a")), # Exp.val(0)) # - # @param return_type metadata attributes to return. See {@link MapReturnType} + # @param return_type metadata attributes to return. See {MapReturnType} # @param value_type expected type of return value # @param key map key expression # @param bin bin or map value expression # @param ctx optional context path for nested CDT def self.get_by_key(return_type, value_type, key, bin, ctx: nil) bytes = Exp.pack(ctx, GET_BY_KEY, return_type, key) - return self.add_read(bin, bytes, value_type) + add_read(bin, bytes, value_type) end # Create expression that selects map items identified by key range (key_begin inclusive, key_end exclusive). # If key_begin is nil, the range is less than key_end. # If key_end is nil, the range is greater than equal to key_begin. # - # Expression returns selected data specified by return_type (See {@link MapReturnType}). + # Expression returns selected data specified by return_type (See {MapReturnType}). def self.get_by_key_range(return_type, key_begin, key_end, bin, ctx: nil) bytes = Exp::List.pack_range_operation(GET_BY_KEY_INTERVAL, return_type, key_begin, key_end, ctx) - return self.add_read(bin, bytes, get_value_type(return_type)) + add_read(bin, bytes, get_value_type(return_type)) end # Create expression that selects map items identified by keys and returns selected data specified by - # return_type (See {@link MapReturnType}). + # return_type (See {MapReturnType}). def self.get_by_key_list(return_type, keys, bin, ctx: nil) bytes = Exp.pack(ctx, GET_BY_KEY_LIST, return_type, keys) - return self.add_read(bin, bytes, get_value_type(return_type)) + add_read(bin, bytes, get_value_type(return_type)) end # Create expression that selects map items nearest to key and greater by index with a coun. - # Expression returns selected data specified by return_type (See {@link MapReturnType}). + # Expression returns selected data specified by return_type (See {MapReturnType}). # # Examples for ordered map [{0=17},{4=2},{5=15},{9=10}]: # @@ -318,11 +314,11 @@ def self.get_by_key_list(return_type, keys, bin, ctx: nil) # (3,-2) = [{0=17},{4=2},{5=15},{9=10}] def self.get_by_key_relative_index_range(return_type, key, index, bin, ctx: nil) bytes = Exp.pack(ctx, GET_BY_KEY_REL_INDEX_RANGE, return_type, key, index) - return self.add_read(bin, bytes, get_value_type(return_type)) + add_read(bin, bytes, get_value_type(return_type)) end # Create expression that selects map items nearest to key and greater by index with a count limit if provided. - # Expression returns selected data specified by return_type (See {@link MapReturnType}). + # Expression returns selected data specified by return_type (See {MapReturnType}). # # Examples for ordered map [{0=17},{4=2},{5=15},{9=10}]: # @@ -333,12 +329,12 @@ def self.get_by_key_relative_index_range(return_type, key, index, bin, ctx: nil) # (3,2,1) = [{9=10}] # (3,-2,2) = [{0=17}] def self.get_by_key_relative_index_range(return_type, key, index, bin, ctx: nil, count: nil) - unless count.nil? - bytes = Exp.pack(ctx, GET_BY_KEY_REL_INDEX_RANGE, return_type, key, index, count) - else - bytes = Exp.pack(ctx, GET_BY_KEY_REL_INDEX_RANGE, return_type, key, index) - end - return self.add_read(bin, bytes, get_value_type(return_type)) + bytes = if count.nil? + Exp.pack(ctx, GET_BY_KEY_REL_INDEX_RANGE, return_type, key, index) + else + Exp.pack(ctx, GET_BY_KEY_REL_INDEX_RANGE, return_type, key, index, count) + end + add_read(bin, bytes, get_value_type(return_type)) end # Create expression that selects map items identified by value and returns selected data @@ -350,34 +346,34 @@ def self.get_by_key_relative_index_range(return_type, key, index, bin, ctx: nil, # MapExp.getByValue(CDT::MapReturnType::COUNT, Exp.val("BBB"), Exp.mapBin("a")), # Exp.val(0)) # - # @param return_type metadata attributes to return. See {@link MapReturnType} + # @param return_type metadata attributes to return. See {MapReturnType} # @param value value expression # @param bin bin or map value expression # @param ctx optional context path for nested CDT def self.get_by_value(return_type, value, bin, ctx: nil) bytes = Exp.pack(ctx, GET_BY_VALUE, return_type, value) - return self.add_read(bin, bytes, get_value_type(return_type)) + add_read(bin, bytes, get_value_type(return_type)) end # Create expression that selects map items identified by value range (valueBegin inclusive, valueEnd exclusive) # If valueBegin is nil, the range is less than valueEnd. # If valueEnd is nil, the range is greater than equal to valueBegin. # - # Expression returns selected data specified by return_type (See {@link MapReturnType}). + # Expression returns selected data specified by return_type (See {MapReturnType}). def self.get_by_value_range(return_type, valueBegin, valueEnd, bin, ctx: nil) bytes = Exp::List.pack_range_operation(GET_BY_VALUE_INTERVAL, return_type, valueBegin, valueEnd, ctx) - return self.add_read(bin, bytes, get_value_type(return_type)) + add_read(bin, bytes, get_value_type(return_type)) end # Create expression that selects map items identified by values and returns selected data specified by - # return_type (See {@link MapReturnType}). + # return_type (See {MapReturnType}). def self.get_by_value_list(return_type, values, bin, ctx: nil) bytes = Exp.pack(ctx, GET_BY_VALUE_LIST, return_type, values) - return self.add_read(bin, bytes, get_value_type(return_type)) + add_read(bin, bytes, get_value_type(return_type)) end # Create expression that selects map items nearest to value and greater by relative rank (with a count limit if passed). - # Expression returns selected data specified by return_type (See {@link MapReturnType}). + # Expression returns selected data specified by return_type (See {MapReturnType}). # # Examples for map [{4=2},{9=10},{5=15},{0=17}]: # @@ -385,48 +381,48 @@ def self.get_by_value_list(return_type, values, bin, ctx: nil) # (11,1) = [{0=17}] # (11,-1) = [{9=10},{5=15},{0=17}] def self.get_by_value_relative_rank_range(return_type, value, rank, bin, ctx: nil, count: nil) - unless count.nil? - bytes = Exp.pack(ctx, GET_BY_VALUE_REL_RANK_RANGE, return_type, value, rank, count) - else - bytes = Exp.pack(ctx, GET_BY_VALUE_REL_RANK_RANGE, return_type, value, rank) - end - return self.add_read(bin, bytes, get_value_type(return_type)) + bytes = if count.nil? + Exp.pack(ctx, GET_BY_VALUE_REL_RANK_RANGE, return_type, value, rank) + else + Exp.pack(ctx, GET_BY_VALUE_REL_RANK_RANGE, return_type, value, rank, count) + end + add_read(bin, bytes, get_value_type(return_type)) end # Create expression that selects map item identified by index and returns selected data specified by - # return_type (See {@link MapReturnType}). + # return_type (See {MapReturnType}). def self.get_by_index(return_type, value_type, index, bin, ctx: nil) bytes = Exp.pack(ctx, GET_BY_INDEX, return_type, index) - return self.add_read(bin, bytes, value_type) + add_read(bin, bytes, value_type) end # Create expression that selects map items starting at specified index to the end of map and returns selected - # data specified by return_type (See {@link MapReturnType}) limited by count if provided. + # data specified by return_type (See {MapReturnType}) limited by count if provided. def self.get_by_index_range(return_type, index, bin, ctx: nil, count: nil) - unless count.nil? - bytes = Exp.pack(ctx, GET_BY_INDEX_RANGE, return_type, index, count) - else - bytes = Exp.pack(ctx, GET_BY_INDEX_RANGE, return_type, index) - end - return self.add_read(bin, bytes, get_value_type(return_type)) + bytes = if count.nil? + Exp.pack(ctx, GET_BY_INDEX_RANGE, return_type, index) + else + Exp.pack(ctx, GET_BY_INDEX_RANGE, return_type, index, count) + end + add_read(bin, bytes, get_value_type(return_type)) end # Create expression that selects map item identified by rank and returns selected data specified by - # return_type (See {@link MapReturnType}). + # return_type (See {MapReturnType}). def self.get_by_rank(return_type, value_type, rank, bin, ctx: nil) bytes = Exp.pack(ctx, GET_BY_RANK, return_type, rank) - return self.add_read(bin, bytes, value_type) + add_read(bin, bytes, value_type) end # Create expression that selects map items starting at specified rank to the last ranked item and - # returns selected data specified by return_type (See {@link MapReturnType}). + # returns selected data specified by return_type (See {MapReturnType}). def self.get_by_rank_range(return_type, rank, bin, ctx: nil, count: nil) - unless count.nil? - bytes = Exp.pack(ctx, GET_BY_RANK_RANGE, return_type, rank, count) - else - bytes = Exp.pack(ctx, GET_BY_RANK_RANGE, return_type, rank) - end - return self.add_read(bin, bytes, get_value_type(return_type)) + bytes = if count.nil? + Exp.pack(ctx, GET_BY_RANK_RANGE, return_type, rank) + else + Exp.pack(ctx, GET_BY_RANK_RANGE, return_type, rank, count) + end + add_read(bin, bytes, get_value_type(return_type)) end private @@ -454,7 +450,7 @@ def self.get_by_rank_range(return_type, rank, bin, ctx: nil, count: nil) GET_BY_KEY = 97 GET_BY_INDEX = 98 GET_BY_RANK = 100 - GET_BY_VALUE = 102; # GET_ALL_BY_VALUE on server + GET_BY_VALUE = 102; # GET_ALL_BY_VALUE on server GET_BY_KEY_INTERVAL = 103 GET_BY_INDEX_RANGE = 104 GET_BY_VALUE_INTERVAL = 105 @@ -465,11 +461,11 @@ def self.get_by_rank_range(return_type, rank, bin, ctx: nil, count: nil) GET_BY_VALUE_REL_RANK_RANGE = 110 def self.add_write(bin, bytes, ctx) - if ctx.to_a.empty? - ret_type = Exp::Type::MAP - else - ret_type = ((ctx[0].id & 0x10) == 0) ? Exp::Type::MAP : Exp::Type::LIST - end + ret_type = if ctx.to_a.empty? + Exp::Type::MAP + else + (ctx[0].id & 0x10) == 0 ? Exp::Type::MAP : Exp::Type::LIST + end Exp::Module.new(bin, bytes, ret_type, MODULE | Exp::MODIFY) end @@ -487,7 +483,7 @@ def self.get_value_type(return_type) if t == CDT::MapReturnType::KEY_VALUE return Exp::Type::MAP end - return Exp::Type::LIST + Exp::Type::LIST end end # class MapExp end # module Aerospike diff --git a/lib/aerospike/exp/operation.rb b/lib/aerospike/exp/operation.rb index 7cfc6104..3c6e70dd 100644 --- a/lib/aerospike/exp/operation.rb +++ b/lib/aerospike/exp/operation.rb @@ -24,7 +24,7 @@ class Exp::Operation # # @param bin_name name of bin to store expression result # @param exp expression to evaluate - # @param flags expression write flags. See {@link Exp::WriteFlags} + # @param flags expression write flags. See {Exp::WriteFlags} def self.write(bin_name, exp, flags = Aerospike::Exp::WriteFlags::DEFAULT) create_operation(Aerospike::Operation::EXP_MODIFY, bin_name, exp, flags) end @@ -36,7 +36,7 @@ def self.write(bin_name, exp, flags = Aerospike::Exp::WriteFlags::DEFAULT) # @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 {@link Exp::ExpReadFlags} + # @param flags expression read flags. See {Exp::ExpReadFlags} def self.read(name, exp, flags = Aerospike::Exp::ReadFlags::DEFAULT) create_operation(Aerospike::Operation::EXP_READ, name, exp, flags) end diff --git a/lib/aerospike/operation.rb b/lib/aerospike/operation.rb index b72fe388..944bc5c5 100644 --- a/lib/aerospike/operation.rb +++ b/lib/aerospike/operation.rb @@ -81,6 +81,7 @@ def self.delete Operation.new(DELETE) end + # :nodoc: def is_write? case @op_type when READ diff --git a/lib/aerospike/policy/batch_delete_policy.rb b/lib/aerospike/policy/batch_delete_policy.rb index 8372cdee..2978d1e6 100644 --- a/lib/aerospike/policy/batch_delete_policy.rb +++ b/lib/aerospike/policy/batch_delete_policy.rb @@ -21,11 +21,11 @@ class BatchDeletePolicy attr_accessor :filter_exp, :commit_level, :generation_policy, :generation, :durable_delete, :send_key def initialize(opt = {}) - # Optional expression filter. If filterExp exists and evaluates to false, the specific batch key - # request is not performed and {@link com.aerospike.client.BatchRecord#result_code} is set to - # {@link com.aerospike.client.ResultCode#FILTERED_OUT}. + # Optional expression filter. If filter_exp exists and evaluates to false, the specific batch key + # request is not performed and {BatchRecord#result_code} is set to + # {ResultCode#FILTERED_OUT}. # - # If exists, this filter overrides the batch parent filter {@link com.aerospike.client.policy.Policy#filter_exp} + # If exists, this filter overrides the batch parent filter {Policy#filter_exp} # for the specific key in batch commands that allow a different policy per key. # Otherwise, this filter is ignored. # diff --git a/lib/aerospike/policy/batch_policy.rb b/lib/aerospike/policy/batch_policy.rb index b9233413..4c9d9d96 100644 --- a/lib/aerospike/policy/batch_policy.rb +++ b/lib/aerospike/policy/batch_policy.rb @@ -63,8 +63,8 @@ def initialize(opt={}) # other nodes will continue to be processed. # # If false, the server will stop the batch to its node on most key specific errors. - # The exceptions are {@link com.aerospike.client.ResultCode#KEY_NOT_FOUND_ERROR} and - # {@link com.aerospike.client.ResultCode#FILTERED_OUT} which never stop the batch. + # The exceptions are {ResultCode#KEY_NOT_FOUND_ERROR} and + # {ResultCode#FILTERED_OUT} which never stop the batch. # The client will stop the entire batch on node specific errors. The client will # not stop the entire batch commands run in parallel. # diff --git a/lib/aerospike/policy/batch_read_policy.rb b/lib/aerospike/policy/batch_read_policy.rb index 309534b3..c61160e0 100644 --- a/lib/aerospike/policy/batch_read_policy.rb +++ b/lib/aerospike/policy/batch_read_policy.rb @@ -23,11 +23,11 @@ class BatchReadPolicy attr_accessor :filter_exp def initialize(opt={}) - # Optional expression filter. If filterExp exists and evaluates to false, the specific batch key - # request is not performed and {@link com.aerospike.client.BatchRecord#result_code} is set to - # {@link com.aerospike.client.ResultCode#FILTERED_OUT}. + # Optional expression filter. If filter_exp exists and evaluates to false, the specific batch key + # request is not performed and {BatchRecord#result_code} is set to + # {ResultCode#FILTERED_OUT}. # - # If exists, this filter overrides the batch parent filter {@link com.aerospike.client.policy.Policy#filter_exp} + # If exists, this filter overrides the batch parent filter {Policy#filter_exp} # for the specific key in batch commands that allow a different policy per key. # Otherwise, this filter is ignored. # diff --git a/lib/aerospike/policy/batch_udf_policy.rb b/lib/aerospike/policy/batch_udf_policy.rb index f1f014b2..42c54ed7 100644 --- a/lib/aerospike/policy/batch_udf_policy.rb +++ b/lib/aerospike/policy/batch_udf_policy.rb @@ -26,11 +26,11 @@ class BatchUDFPolicy alias expiration= ttl= def initialize(opt={}) - # Optional expression filter. If filterExp exists and evaluates to false, the specific batch key - # request is not performed and {@link com.aerospike.client.BatchRecord#resultCode} is set to - # {@link com.aerospike.client.ResultCode#FILTERED_OUT}. + # Optional expression filter. If filter_exp exists and evaluates to false, the specific batch key + # request is not performed and {BatchRecord#resultCode} is set to + # {ResultCode#FILTERED_OUT}. # - # If exists, this filter overrides the batch parent filter {@link com.aerospike.client.policy.Policy#filterExp} + # If exists, this filter overrides the batch parent filter {Policy#filter_exp} # for the specific key in batch commands that allow a different policy per key. # Otherwise, this filter is ignored. # diff --git a/lib/aerospike/policy/batch_write_policy.rb b/lib/aerospike/policy/batch_write_policy.rb index c17e56c5..dfcbb1b0 100644 --- a/lib/aerospike/policy/batch_write_policy.rb +++ b/lib/aerospike/policy/batch_write_policy.rb @@ -29,11 +29,11 @@ class BatchWritePolicy alias expiration= ttl= def initialize(opt={}) - # Optional expression filter. If filterExp exists and evaluates to false, the specific batch key - # request is not performed and {@link com.aerospike.client.BatchRecord#resultCode} is set to - # {@link com.aerospike.client.ResultCode#FILTERED_OUT}. + # Optional expression filter. If filter_exp exists and evaluates to false, the specific batch key + # request is not performed and {BatchRecord#result_code} is set to + # {ResultCode#FILTERED_OUT}. # - # If exists, this filter overrides the batch parent filter {@link com.aerospike.client.policy.Policy#filter_exp} + # If exists, this filter overrides the batch parent filter {Policy#filter_exp} # for the specific key in batch commands that allow a different policy per key. # Otherwise, this filter is ignored. # diff --git a/lib/aerospike/policy/policy.rb b/lib/aerospike/policy/policy.rb index 69edc810..8e4c9c54 100644 --- a/lib/aerospike/policy/policy.rb +++ b/lib/aerospike/policy/policy.rb @@ -31,7 +31,7 @@ def initialize(opt = {}) # Container object for transaction policy attributes used in all database # operation calls. - # Optional expression filter. If filterExp exists and evaluates to false, the + # Optional expression filter. If filter_exp exists and evaluates to false, the # transaction is ignored. # # Default: nil