K2HASH(1)
π NAME π
K2HASH β it's a NoSQL Key Value Store (aka KVS) library, bestie. That's the whole vibe. And yes, this is the K2HASH(1) manual page, so buckle up π«Ά
β¨ SYNOPSIS β¨
π library
libk2hash.so
π§ tool for library
k2hlinetool [options]
k2hreplace [options]
k2hcompress [options]
k2htouch [options]
k2hedit [options]
πΈ DESCRIPTION πΈ
okay so. K2HASH is a NoSQL (key value store) library, plus the tools that go with it, brought to you by Yahoo! JAPAN. Iconic behaviour, honestly π
Here's what K2HASH is serving, spec-wise:
- It supports multi-threading and multi-processing programs. yes bestie, both.
- It expands the data area.
- It switches between accessing only memory, and accessing the data file directly.
- It puts transaction.
- It does archiving.
- It replaces the hash function like it's a plugin.
- It replaces the transaction.
And the K2HASH tools? They can create / store (write) / read a file or a memory that was made (allocated) by the K2HASH library β for testing purposes. cute little sandbox moment π§ͺ
The K2HASH library has three ways to do KVS storage:
- Memory only. This type of storage can be used by a multi-thread process only. And on this type, the data on storage is not permanent. it's giving "here for a good time not a long time" π
- Fully mapping file. This type can be used by multi-thread and multi-process. All of the data in the file is mmapping fully, so the limit of the file and data size depends on the memory.
- A part of a mapping file, with direct file access. This type can be used by multi-thread and multi-process.
K2HASH maps only the hash table and etc from the file, and it reads/writes the file for datas directly. This way is expanding the upper limit, but it's less performance, because, well β directly accessing. tradeoffs, bestie π
In cases of using a mapping file, you can use the data (file) as permanently or temporary. your call, main character.
K2HASH uses the FNV-1a hashing function inside it. And if you wanna replace that hash function? You can do it two ways:
- One way is that your process defines the same prototype of hash function.
- The other is that you can load your original DSO library which includes the same prototype of hash function.
Wanna know how to implement replacing the hash function? Go look at the k2hashfunc.h file. iykyk π
K2HASH can put transaction and archive all of the data in the file. And if you need to make your own original formatted transaction outputs, you can do it two ways, just like replacing the hash function:
- One way is that your process defines the same prototype of hash function.
- The other is that you can load your original DSO library which includes the same prototype of hash function.
And for how to implement replacing the transaction function? That's the k2htransfunc.h file, bestie β¨
π₯ FUNCTIONS π₯
You can develop programs using the interface for C/C++ language that the K2HASH library provides. The following C language function prototypes live in k2hash.h.
The K2HASH C++ Language interface is implemented almost in k2shm.h. You can use the public K2HShm class methods just like the C Language interface. same energy, different font π
π K2HASH C Language interface function
okay this is the big one. every single one, no skipping, we eat the whole plate π
π¦ debug + library loading
void k2h_bump_debug_level(...)
void k2h_set_debug_level_silent(...)
void k2h_set_debug_level_error(...)
void k2h_set_debug_level_warning(...)
void k2h_set_debug_level_message(...)
bool k2h_set_debug_file(...)
bool k2h_unset_debug_file(...)
bool k2h_load_debug_env(...)
bool k2h_set_bumpup_debug_signal_user1(...)
bool k2h_load_hash_library(...)
bool k2h_unload_hash_library(...)
bool k2h_load_transaction_library(...)
bool k2h_unload_transaction_library(...)
π opening + creating
bool k2h_create(...)
k2h_h k2h_open(...)
k2h_h k2h_open_rw(...)
k2h_h k2h_open_ro(...)
k2h_h k2h_open_tempfile(...)
k2h_h k2h_open_mem(...)
bool k2h_close(...)
bool k2h_close_wait(...)
π§ transactions + archives
bool k2h_transaction(...)
bool k2h_transaction_prefix(...)
bool k2h_transaction_param(...)
bool k2h_transaction_param_we(...)
bool k2h_enable_transaction(...)
bool k2h_enable_transaction_prefix(...)
bool k2h_enable_transaction_param(...)
bool k2h_enable_transaction_param_we(...)
bool k2h_disable_transaction(...)
int k2h_get_transaction_archive_fd(...)
bool k2h_load_archive(...)
bool k2h_put_archive(...)
int k2h_get_transaction_thread_pool(...)
bool k2h_set_transaction_thread_pool(...)
bool k2h_unset_transaction_thread_pool(...)
π common attrs
bool k2h_set_common_attr(...)
bool k2h_clean_common_attr(...)
bool k2h_add_attr_plugin_library(...)
bool k2h_add_attr_crypt_pass(...)
bool k2h_print_attr_version(...)
bool k2h_print_attr_information(...)
π getting values (the whole getter family)
bool k2h_get_value(...)
unsigned char* k2h_get_direct_value(...)
bool k2h_get_str_value(...)
char* k2h_get_str_direct_value(...)
bool k2h_get_value_wp(...)
unsigned char* k2h_get_direct_value_wp(...)
bool k2h_get_str_value_wp(...)
char* k2h_get_str_direct_value_wp(...)
bool k2h_get_value_np(...)
unsigned char* k2h_get_direct_value_np(...)
bool k2h_get_str_value_np(...)
char* k2h_get_str_direct_value_np(...)
bool k2h_get_value_ext(...)
unsigned char* k2h_get_direct_value_ext(...)
bool k2h_get_str_value_ext(...)
char* k2h_get_str_direct_value_ext(...)
bool k2h_get_value_wp_ext(...)
unsigned char* k2h_get_direct_value_wp_ext(...)
bool k2h_get_str_value_wp_ext(...)
char* k2h_get_str_direct_value_wp_ext(...)
bool k2h_get_value_np_ext(...)
unsigned char* k2h_get_direct_value_np_ext(...)
bool k2h_get_str_value_np_ext(...)
char* k2h_get_str_direct_value_np_ext(...)
π subkeys + freeing
bool k2h_get_subkeys(...)
PK2HKEYPCK k2h_get_direct_subkeys(...)
int k2h_get_str_subkeys(...)
char** k2h_get_str_direct_subkeys(...)
bool k2h_get_subkeys_np(...)
PK2HKEYPCK k2h_get_direct_subkeys_np(...)
int k2h_get_str_subkeys_np(...)
char** k2h_get_str_direct_subkeys_np(...)
bool k2h_free_keypack(...)
bool k2h_free_keyarray(...)
β attrs
bool k2h_get_attrs(...)
PK2HATTRPCK k2h_get_direct_attrs(...)
PK2HATTRPCK k2h_get_str_direct_attrs(...)
bool k2h_free_attrpack(...)
π setting stuff
bool k2h_set_all(...)
bool k2h_set_str_all(...)
bool k2h_set_value(...)
bool k2h_set_str_value(...)
bool k2h_set_all_wa(...)
bool k2h_set_str_all_wa(...)
bool k2h_set_value_wa(...)
bool k2h_set_str_value_wa(...)
bool k2h_set_subkeys(...)
bool k2h_set_str_subkeys(...)
bool k2h_add_subkey(...)
bool k2h_add_str_subkey(...)
k2h_add_subkey_wa(...)
k2h_add_str_subkey_wa(...)
k2h_add_attr(...)
k2h_add_str_attr(...)
π removing stuff
bool k2h_remove_all(...)
bool k2h_remove_str_all(...)
bool k2h_remove(...)
bool k2h_remove_str(...)
bool k2h_remove_subkey(...)
bool k2h_remove_str_subkey(...)
π§ renaming stuff
bool k2h_rename(...)
bool k2h_rename_str(...)
π₯ finding stuff
k2h_find_h k2h_find_first(...)
k2h_find_h k2h_find_first_subkey(...)
k2h_find_h k2h_find_first_str_subkey(...)
k2h_find_h k2h_find_next(...)
bool k2h_find_free(...)
bool k2h_find_get_key(...)
char* k2h_find_get_str_key(...)
bool k2h_find_get_value(...)
char* k2h_find_get_direct_value(...)
bool k2h_find_get_subkeys(...)
PK2HKEYPCK k2h_find_get_direct_subkeys(...)
int k2h_find_get_str_subkeys(...)
char** k2h_find_get_str_direct_subkeys(...)
πΈ direct access handles
k2h_da_h k2h_da_handle(...)
k2h_da_h k2h_da_handle_read(...)
k2h_da_h k2h_da_handle_write(...)
k2h_da_h k2h_da_handle_rw(...)
k2h_da_h k2h_da_str_handle(...)
k2h_da_h k2h_da_str_handle_read(...)
k2h_da_h k2h_da_str_handle_write(...)
k2h_da_h k2h_da_str_handle_rw(...)
bool k2h_da_free(...)
ssize_t k2h_da_get_length(...)
ssize_t k2h_da_get_buf_size(...)
bool k2h_da_set_buf_size(...)
off_t k2h_da_get_offset(...)
off_t k2h_da_get_read_offset(...)
off_t k2h_da_get_write_offset(...)
bool k2h_da_set_offset(...)
bool k2h_da_set_read_offset(...)
bool k2h_da_set_write_offset(...)
bool k2h_da_get_value(...)
bool k2h_da_get_value_offset(...)
bool k2h_da_get_value_to_file(...)
unsigned char* k2h_da_read(...)
unsigned char* k2h_da_read_offset(...)
char* k2h_da_read_str(...)
bool k2h_da_set_value(...)
bool k2h_da_set_value_offset(...)
bool k2h_da_set_value_from_file(...)
bool k2h_da_set_value_str(...)
π queue handles
k2h_q_h k2h_q_handle(...)
k2h_q_h k2h_q_handle_prefix(...)
k2h_q_h k2h_q_handle_str_prefix(...)
bool k2h_q_free(...)
bool k2h_q_empty(...)
int k2h_q_count(...)
bool k2h_q_read(...)
bool k2h_q_str_read(...)
bool k2h_q_push(...)
bool k2h_q_str_push(...)
bool k2h_q_pop(...)
bool k2h_q_str_pop(...)
bool k2h_q_remove(...)
int k2h_q_remove_ext(...)
bool k2h_q_dump(...)
k2h_q_read_wp(...)
k2h_q_str_read_wp(...)
k2h_q_push_wa(...)
k2h_q_str_push_wa(...)
k2h_q_pop_wa(...)
k2h_q_str_pop_wa(...)
k2h_q_pop_wp(...)
k2h_q_str_pop_wp(...)
k2h_q_remove_wp(...)
k2h_q_remove_wp_ext(...)
k2h_keyq_h k2h_keyq_handle(...)
k2h_keyq_h k2h_keyq_handle_prefix(...)
k2h_keyq_h k2h_keyq_handle_str_prefix(...)
bool k2h_keyq_free(...)
bool k2h_keyq_empty(...)
int k2h_keyq_count(...)
bool k2h_keyq_read(...)
bool k2h_keyq_read_keyval(...)
bool k2h_keyq_str_read(...)
bool k2h_keyq_str_read_keyval(...)
bool k2h_keyq_push(...)
bool k2h_keyq_str_push(...)
bool k2h_keyq_push_keyval(...)
bool k2h_keyq_str_push_keyval(...)
bool k2h_keyq_pop(...)
bool k2h_keyq_pop_keyval(...)
bool k2h_keyq_str_pop(...)
bool k2h_keyq_str_pop_keyval(...)
bool k2h_keyq_remove(...)
int k2h_keyq_remove_ext(...)
bool k2h_keyq_dump(...)
k2h_keyq_read_wp(...)
k2h_keyq_read_keyval_wp(...)
k2h_keyq_str_read_wp(...)
k2h_keyq_str_read_keyval_wp(...)
k2h_keyq_push_wa(...)
k2h_keyq_push_keyval_wa(...)
k2h_keyq_str_push_wa(...)
k2h_keyq_str_push_keyval_wa(...)
k2h_keyq_pop_wp(...)
k2h_keyq_pop_keyval_wp(...)
k2h_keyq_str_pop_wp(...)
k2h_keyq_str_pop_keyval_wp(...)
k2h_keyq_remove_wp(...)
k2h_keyq_remove_wp_ext(...)
π¦ dumping + printing
bool k2h_dump_head(...)
bool k2h_dump_keytable(...)
bool k2h_dump_full_keytable(...)
bool k2h_dump_elementtable(...)
bool k2h_dump_full(...)
bool k2h_print_state(...)
void k2h_print_version(...)
β¨ ENVIRONMENT β¨
okay bestie, K2HASH lowkey reads some environment variables all on its own, no asking, no warning, just vibes. so pls be careful with these, fr fr π«Ά
K2HDBGMODEβ sets the debugging level. your options areINFO/WAN/ERR/SILENT. pick your chaos level πK2HDBGFILEβ the output file path for messages. default isstderr(iykyk, it just screams into your terminal)K2HATTR_MTIMEβ set it toONto get the builtin attribute for last modify time β°K2HATTR_HISTORYβ set it toONto get the builtin attribute for history πK2HATTR_EXPIRE_SECβ set the seconds for the builtin attribute expire time β³K2HATTR_DEFENCβ set it toONto enable the builtin attribute encrypt πK2HATTR_ENCFILEβ set the pass phrase file path for the builtin attribute en(de)crypt ποΈ
π NOTES π
so like, k2hlinetool, k2hreplace, k2hcompress, k2htouch, and k2hedit are all tools for a k2hash file/memory. they're the whole squad, the friend group, the main character lineup π
π SEE ALSO π
π BUGS π
found something broken? pls report it to the owner and the committers, they wanna know π«Ά
π AUTHOR π
k2hash has been written by Takeshi Nakatani <ggtakec@gmail.com>. absolute legend behavior, no cap β¨
and that's a wrap on the whole page bestie!! this one's from the K2HASH era of February 2014, and it's giving vintage but still slaying π go forth and hash responsibly, mwah π
π¦ where this page comes from
- epel 10: k2hash 1.0.101-1.el10_3 Β· MIT
- epel 9: k2hash 1.0.98-1.el9 Β· MIT
- fedora 43: k2hash 1.0.99-1.fc43 Β· MIT
- fedora 44: k2hash 1.0.100-2.fc44 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms