Skip to content

Instantly share code, notes, and snippets.

get_priority(Channel, DiskSize, DataSize, Threshold, Dir) ->
MinSize = list_to_integer(smoosh_utils:get(Channel, "min_size", "0")),
MaxSize = case smoosh_utils:get(Channel, "max_size", infinity) of
infinity -> infinity;
Value -> list_to_integer(Value)
end,
ProjectedCapacity = projected_capacity(Dir, DataSize),
MaxCapacity = list_to_integer(
couch_config:get("smoosh", "max_capacity", "90")),
BadSize = DiskSize =< MinSize orelse DiskSize > MaxSize,
PreCommDict = dict:from_list(PreCommitFailures),
{_, _, Tr} = lists:foldl(fun(#doc{id=Id,revs={Pos, RevIds}},{RidRevs,RCommitResults,Acc}) ->
DocKey = {Id, {Pos, RevIds}},
case lists:keyfind(DocKey,1,RCommitResults) of
false ->
case dict:find(DocKey,PreCommDict) of
error ->
{_, GoodVal} = lists:keyfind(DocKey,1,RidRevs),
{lists:delete(DocKey,RidRevs), RCommitResults, [GoodVal | Acc]};
{ok, PCommFailVal} ->
#!/usr/bin/env escript
%% -*- erlang -*-
%%! -pa ./src/couchdb -sasl errlog_type error -boot start_sasl -noshell
%%
main(_) ->
code:add_pathz("src/couchdb"),
application:load(crypto),
crypto:start(),
etap:plan(unknown),
case (catch test()) of