This commit is contained in:
Gregory Burd 2024-07-18 04:25:32 -04:00
parent 80b5b85e81
commit 994b28a6a4
8 changed files with 140 additions and 34 deletions

View file

@ -1,4 +1,4 @@
REBAR= rebar
REBAR= rebar3
DIALYZER= dialyzer

1
TODO
View file

@ -1,5 +1,4 @@
* Phase 1: Minimum viable product (in order of priority)
* lager; check for uses of lager:error/2
* configurable TOP_LEVEL size
* test new snappy compression support
* status and statistics

View file

@ -4,8 +4,7 @@
{eunit_opts, [verbose, {report, {eunit_surefire, [{dir, "."}]}}]}.
{erl_opts, [%{d,'DEBUG',true},
{d,'USE_EBLOOM',true},
{parse_transform, lager_transform},
{d,'USE_EBLOOM',false},
fail_on_warning,
warn_unused_vars,
warn_export_all,
@ -27,13 +26,13 @@
{xref_checks, [undefined_function_calls]}.
{deps, [ {sext, ".*", {git, "https://github.com/uwiger/sext.git", {branch, "master"}}}
, {lager, ".*", {git, "https://github.com/basho/lager.git", {branch, "master"}}}
, {snappy, "1.*", {git, "https://github.com/fdmanana/snappy-erlang-nif.git", {branch, "master"}}}
%% , {snappy, "1.*", {git, "https://github.com/fdmanana/snappy-erlang-nif.git", {branch, "master"}}}
, {plain_fsm, "1.*", {git, "https://github.com/gburd/plain_fsm.git", {branch, "master"}}}
%% , {basho_bench, ".*", {git, "https://github.com/basho/basho_bench.git", {branch, "master"}}}
, {ebloom, ".*", {git, "https://github.com/basho/ebloom.git", {branch, "develop"}}}
, {triq, ".*", {git, "https://github.com/krestenkrab/triq.git", {branch, "master"}}}
%% , {ebloom, ".*", {git, "https://github.com/basho/ebloom.git", {branch, "develop"}}}
%% , {bloomerl, ".*", {git, "https://github.com/gburd/bloomerl.git", {branch, "master"}}}
, {lz4, ".*", {git, "https://github.com/krestenkrab/erlang-lz4.git", {branch, "master"}}}
, {triq, ".*", {git, "https://github.com/gburd/triq.git", {branch, "master"}}}
% , {edown, "0.3.*", {git, "git://github.com/uwiger/edown.git", {branch, "master"}}}
% , {asciiedoc, "0.1.*", {git, "git://github.com/norton/asciiedoc.git", {branch, "master"}}}
% , {triq, ".*", {git, "git://github.com/krestenkrab/triq.git", {branch, "master"}}}

View file

@ -1,32 +1,16 @@
[{<<"ebloom">>,
{git,"https://github.com/basho/ebloom.git",
{ref,"0a176b5b41cd418adeaa3747c8138e0e7da0adc7"}},
0},
{<<"goldrush">>,
{git,"https://github.com/basho/goldrush.git",
{ref,"8f1b715d36b650ec1e1f5612c00e28af6ab0de82"}},
1},
{<<"lager">>,
{git,"https://github.com/basho/lager.git",
{ref,"81eaef0ce98fdbf64ab95665e3bc2ec4b24c7dac"}},
0},
{<<"lz4">>,
[{<<"lz4">>,
{git,"https://github.com/krestenkrab/erlang-lz4.git",
{ref,"5fd90ca1e2345bdc359ee43d958da87fafb4fd78"}},
0},
{<<"plain_fsm">>,
{git,"https://github.com/gburd/plain_fsm.git",
{ref,"1de45fba4caccbc76df0b109e7581d0fc6a2e67b"}},
{ref,"6421158d742956836dfa39fca857422afcf56419"}},
0},
{<<"sext">>,
{git,"https://github.com/uwiger/sext.git",
{ref,"c22486add9cc374dc8138b1f547c0999a1922a65"}},
0},
{<<"snappy">>,
{git,"https://github.com/fdmanana/snappy-erlang-nif.git",
{ref,"ceaceb4d964b33489ab76e2a281bec31a0e84e51"}},
0},
{<<"triq">>,
{git,"https://github.com/krestenkrab/triq.git",
{ref,"c7306b8eaea133d52140cb828817efb5e50a3d52"}},
{git,"https://github.com/gburd/triq.git",
{ref,"5d4b98e8323eec70aff474a578a1e5ebe9495e70"}},
0}].

View file

@ -19,16 +19,22 @@ mkShell rec {
ripgrep
shellcheck
erlang
erlang-ls
rebar3
erlfmt
# BEAM support
beam.interpreters.erlangR26
beam.packages.erlangR26.elixir_1_15
nodejs-18_x
#beam.interpreters.erlangR26
#rebar3
#beam.packages.erlangR26.elixir_1_15
#nodejs-18_x
# elixir-typst support
pkgs.iconv
#pkgs.iconv
# rust support
cargo
#cargo
];
shellHook =
let

View file

@ -831,7 +831,8 @@ start_range_fold(FileName, WorkerPID, Range, State) ->
ok
catch
Class:Ex ->
io:format(user, "BAD: ~p:~p ~p~n", [Class,Ex,erlang:get_stacktrace()])
try throw(42) catch _:_:Stk -> io:format(user, "BAD: ~p:~p ~p~n", [Class,Ex,Stk]) end
end
end ),
{ok, PID}.

34
src/hanoidb_load.erl Normal file
View file

@ -0,0 +1,34 @@
-module(hanoidb_load).
-export([run/1]).
run(Dir) ->
case hanoidb:open(filename:join(Dir, "test.hanoidb"), []) of
{error, Reason} ->
{error, Reason};
{ok, Tree} -> fill_db_timed(Tree, 5 * 60 * 1000)
end.
fill_db(Tree) -> fill_db(Tree, 5000).
fill_db(Tree, 0) -> hanoidb:close(Tree);
fill_db(Tree, N) ->
Letter = N rem 26 + $a,
Length = rand:uniform(100),
Key = << <<Letter/utf8>> || _ <- lists:seq(0, Length) >>,
ok = hanoidb:put(Tree, Key, Key),
fill_db(Tree, N - 1).
fill_db_timed(Tree, Timeout) ->
erlang:send_after(Timeout, self(), stop),
fill_db_loop(Tree, 0).
fill_db_loop(Tree, N) ->
receive
stop ->
ok
after 0 ->
Letter = N rem 26 + $a,
Length = rand:uniform(100),
Key = << <<Letter/utf8>> || _ <- lists:seq(0, Length) >>,
ok = hanoidb:put(Tree, Key, Key),
fill_db_loop(Tree, N+1)
end.

83
tools/levelpresence.sh Normal file
View file

@ -0,0 +1,83 @@
#!/bin/bash
## ----------------------------------------------------------------------------
##
## hanoi: LSM-trees (Log-Structured Merge Trees) Indexed Storage
##
## Copyright 2011-2012 (c) Trifork A/S. All Rights Reserved.
## http://trifork.com/ info@trifork.com
##
## Copyright 2012 (c) Basho Technologies, Inc. All Rights Reserved.
## http://basho.com/ info@basho.com
##
## This file is provided to you under the Apache License, Version 2.0 (the
## "License"); you may not use this file except in compliance with the License.
## You may obtain a copy of the License at
##
## http://www.apache.org/licenses/LICENSE-2.0
##
## Unless required by applicable law or agreed to in writing, software
## distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
## WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
## License for the specific language governing permissions and limitations
## under the License.
##
## ----------------------------------------------------------------------------
function periodic() {
t=0
while sleep 1 ; do
let "t=t+1"
printf "%5d [" "$t"
for ((i=0; i<35; i++)) ; do
if ! [ -f "A-$i.data" ] ; then
echo -n " "
elif ! [ -f "B-$i.data" ] ; then
echo -n "-"
elif ! [ -f "C-$i.data" ] ; then
echo -n "#"
elif ! [ -f "X-$i.data" ] ; then
echo -n "="
else
echo -n "*"
fi
done
echo
done
}
function dynamic() {
local old s t start now
t=0
start=`date +%s`
while true ; do
s=""
for ((i=0; i<35; i++)) ; do
if ! [ -f "A-$i.data" ] ; then
s="$s "
elif ! [ -f "B-$i.data" ] ; then
s="$s-"
elif ! [ -f "C-$i.data" ] ; then
s="$s="
elif ! [ -f "X-$i.data" ] ; then
s="$s%"
else
s="$s*"
fi
done
if [[ "$s" != "$old" ]] ; then
let "t=t+1"
now=`date +%s`
let "now=now-start"
printf "%5d %6d [%s\n" "$t" "$now" "$s"
old="$s"
else
# Sleep a little bit:
perl -e 'use Time::HiRes; Time::HiRes::usleep(100000)'
fi
done
}
dynamic