Skip to content

Commit

Permalink
Cleanup documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
khaf committed Aug 9, 2024
1 parent fd936d5 commit e54c151
Show file tree
Hide file tree
Showing 20 changed files with 285 additions and 301 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/development.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
4 changes: 2 additions & 2 deletions lib/aerospike/batch_delete.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 5 additions & 5 deletions lib/aerospike/batch_read.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand All @@ -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

Expand Down
14 changes: 7 additions & 7 deletions lib/aerospike/batch_record.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions lib/aerospike/batch_udf.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
10 changes: 5 additions & 5 deletions lib/aerospike/batch_write.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ class BatchWrite < BatchRecord
attr_accessor :ops

# Initialize batch key and read/write operations.
# <p>
# {@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)
Expand All @@ -42,15 +42,15 @@ 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

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
Expand Down
9 changes: 4 additions & 5 deletions lib/aerospike/cdt/bit_operation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down Expand Up @@ -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]
Expand Down Expand Up @@ -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]
Expand Down Expand Up @@ -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)

Expand Down
44 changes: 17 additions & 27 deletions lib/aerospike/exp/exp.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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.
#
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -873,7 +873,7 @@ def self.cond(*exps)
#
# ==== Examples
# Args Format: <def1>, <def2>, ..., <exp>
# def: {@link Exp#def(String, Exp)}
# def: {Exp#def(String, Exp)}
# exp: Scoped expression
#
# ==== Examples
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -1135,7 +1129,7 @@ def initialize(exps)

def pack(packer)
# Let wire format: LET <defname1>, <defexp1>, <defname2>, <defexp2>, ..., <scope exp>
count = (@exps.length - 1) * 2 + 2
count = ((@exps.length - 1) * 2) + 2
packer.write_array_header(count)
packer.write(LET)

Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
Loading

0 comments on commit e54c151

Please sign in to comment.