# File tkrzw.rb, line 59 def self.primary_hash(data, num_buckets=nil) # (native code) end
class Tkrzw::Utility
Library utilities.
Constants
- INT32MAX
The maximum value of int32.
- INT32MIN
The minimum value of int32.
- INT64MAX
The maximum value of int64.
- INT64MIN
The minimum value of int64.
- OS_NAME
The recognized OS name.
- PAGE_SIZE
The size of a memory page on the OS.
- UINT32MAX
The maximum value of uint32.
- UINT64MAX
The maximum value of uint64.
- VERSION
The package version numbers.
Public Class Methods
Deserializes a big-endian binary sequence into a floating-point number.
-
@param data a binary sequence.
-
@return The result floating-point number.
# File tkrzw.rb, line 104 def self.deserialize_float(data) # (native code) end
Deserializes a big-endian binary sequence into an integer.
-
@param data a binary sequence.
-
@return The result integer.
# File tkrzw.rb, line 90 def self.deserialize_int(data) # (native code) end
Gets the Levenshtein edit distance of two strings.
-
@param a A string.
-
@param b The other string.
-
@param utf If true, strings are treated as UTF-8 and the edit distance is by the Unicode character.
-
@return The Levenshtein edit distance of the two strings.
# File tkrzw.rb, line 76 def self.edit_distance_lev(a, b, utf=false) # (native code) end
Gets the memory capacity of the platform.
-
@return The memory capacity of the platform in bytes, or -1 on failure.
# File tkrzw.rb, line 45 def self.get_memory_capacity() # (native code) end
Gets the current memory usage of the process.
-
@return The current memory usage of the process in bytes, or -1 on failure.
# File tkrzw.rb, line 51 def self.get_memory_usage() # (native code) end
Primary hash function for the hash database.
-
@param data The data to calculate the hash value for.
-
@param num_buckets The number of buckets of the hash table. If it is omitted,
UINT64MAX
is set. -
@return The hash value.
Secondary hash function for sharding.
-
@param data The data to calculate the hash value for.
-
@param num_shards The number of shards. If it is omitted,
UINT64MAX
is set. -
@return The hash value.
# File tkrzw.rb, line 67 def self.secondary_hash(data, num_shards=nil) # (native code) end
Serializes a floating-point number into a big-endian binary sequence.
-
@param num a floating-point number.
-
@return The result binary sequence.
# File tkrzw.rb, line 97 def self.serialize_float(num) # (native code) end
Serializes an integer into a big-endian binary sequence.
-
@param num an integer.
-
@return The result binary sequence.
# File tkrzw.rb, line 83 def self.serialize_int(num) # (native code) end