diff options
author | Magnus Ahltorp <map@kth.se> | 2014-10-25 01:51:46 +0200 |
---|---|---|
committer | Magnus Ahltorp <map@kth.se> | 2014-10-25 01:51:46 +0200 |
commit | 868a029e39ec8e9aa368da917146d088edee4d2f (patch) | |
tree | 55730037a34fd13165e960802fc7b8435cd3ee51 /src/plop.erl | |
parent | d24663c44f30815bf57caadb8177f43dea5be797 (diff) |
Move internal HTTP APIs to mochiweb. Stop using jiffy.
Diffstat (limited to 'src/plop.erl')
-rw-r--r-- | src/plop.erl | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/src/plop.erl b/src/plop.erl index 6e15781..0523613 100644 --- a/src/plop.erl +++ b/src/plop.erl @@ -110,7 +110,7 @@ handle_cast(_Request, State) -> handle_http_reply(State, {storage_sendentry_http, {OwnRequestId}}, StatusCode, Body) -> lager:debug("http_reply: ~p", [Body]), - {PropList} = (catch jiffy:decode(Body)), + {struct, PropList} = mochijson2:decode(Body), Result = proplists:get_value(<<"result">>, PropList), case dict:fetch(OwnRequestId, State#state.own_requests) of undefined -> @@ -197,23 +197,24 @@ storage_nodes_quorum() -> Value. send_storage_sendentry(URLBase, LogEntry, TreeLeafHash) -> - Request = jiffy:encode( + Request = mochijson2:encode( {[{plop_version, 1}, {entry, base64:encode(LogEntry)}, {treeleafhash, base64:encode(TreeLeafHash)} ]}), + lager:debug("send sendentry to storage node ~p: ~p", [URLBase, Request]), httpc:request(post, {URLBase ++ "sendentry", [], - "text/json", Request}, + "text/json", list_to_binary(Request)}, [], [{sync, false}]). send_storage_entrycommitted(URLBase, EntryHash, TreeLeafHash) -> - Request = jiffy:encode( - {[{plop_version, 1}, - {entryhash, base64:encode(EntryHash)}, - {treeleafhash, base64:encode(TreeLeafHash)} - ]}), + Request = mochijson2:encode( + {[{plop_version, 1}, + {entryhash, base64:encode(EntryHash)}, + {treeleafhash, base64:encode(TreeLeafHash)} + ]}), httpc:request(post, {URLBase ++ "entrycommitted", [], - "text/json", Request}, + "text/json", list_to_binary(Request)}, [], [{sync, false}]). store_at_all_nodes(Nodes, {LogEntry, TreeLeafHash, EntryHash}, From, State) -> |