mruby binding of yahoojapan/k2hash
C Ruby
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
mrblib
src
test
.gitignore
.travis.yml
Dockerfile
LICENSE
README.md
docker_config.rb
mrbgem.rake
travis_config.rb

README.md

mruby-k2hash

Build Status

mruby binding of yahoojapan/k2hash

Quickstart

  1. build mruby with mruby-k2hash. Or use the Docker image.
# mruby root dir
$ MRUBY_CONFIG=./path/to/build_config.rb ./minirake
  1. Run mirb and test K2Hash class
$ ./build/host/bin/mirb
mirb - Embeddable Interactive Ruby Shell

> 
>
> k2hash = K2Hash.new('/tmp/tmp.k2hash', 0666, K2Hash::WRCREAT)
 => #<K2Hash:0x127ada0>
> k2hash.store('key', 'value')
 => nil
> k2hash.fetch('key')
 => "value"
> k2hash.store('key', 'new value')
 => nil
> k2hash.fetch('key')
 => "new value"
> k2hash['key2'] = 'value2'
 => "value2"
> k2hash['key2']
 => "value2"
> k2hash.close
 => nil

Implemented methods

method implemented?
[] ✔️
[]= ✔️
clear ✔️
close ✔️
closed? ✔️
delete ✔️
delete_if ✔️
reject! ✔️
each ✔️
each_pair ✔️
each_key ✔️
each_value ✔️
empty? ✔️
fetch ✔️
has_key? ✔️
include? ✔️
key? ✔️
member? ✔️
has_value? ✔️
value? ✔️
invert ✔️
key ✔️
keys ✔️
length ✔️
size ✔️
reject ✔️
replace ✔️
select ✔️
shift ✔️
store ✔️
to_a ✔️
to_hash ✔️
update ✔️
values ✔️
values_at ✔️
  • subkey

    • fetch_subkeys(key) -> Array returns subkey array corresponding to the key str
    • store_subkeys(key, subkeys) -> self set the subkey array to the key str

TODO

  • Support k2hash features. Especially...:

    • open mode
    • transaction
    • queue
    • attributes

License

MITL