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

edit_distance_lev(a, b, utf=false) click to toggle source

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
get_memory_capacity() click to toggle source

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
get_memory_usage() click to toggle source

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(data, num_buckets=nil) click to toggle source

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.

# File tkrzw.rb, line 59
def self.primary_hash(data, num_buckets=nil)
  # (native code)
end
secondary_hash(data, num_shards=nil) click to toggle source

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