diff options
author | Magnus Ahltorp <map@kth.se> | 2014-10-25 01:51:46 +0200 |
---|---|---|
committer | Linus Nordberg <linus@nordberg.se> | 2014-10-29 16:21:58 +0100 |
commit | b15f4636337c45b487651e8d442afed0d4141725 (patch) | |
tree | e8d79c7d2bff077aad0579681d073f4a412f3eed /src/plop.erl | |
parent | e49af90a5e4470ce3da343708dfbf2e59c745466 (diff) |
Move internal HTTP APIs to mochiweb. Stop using jiffy.
Conflicts:
src/frontend.erl
src/plop.erl
src/storage.erl
Diffstat (limited to 'src/plop.erl')
-rw-r--r-- | src/plop.erl | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/src/plop.erl b/src/plop.erl index 4c94f2b..57febf5 100644 --- a/src/plop.erl +++ b/src/plop.erl @@ -109,7 +109,8 @@ handle_cast(_Request, State) -> handle_http_reply(State, {storage_sendentry_http, {OwnRequestId}}, StatusCode, Body) -> - {PropList} = (catch jiffy:decode(Body)), + lager:debug("http_reply: ~p", [Body]), + {struct, PropList} = mochijson2:decode(Body), Result = proplists:get_value(<<"result">>, PropList), case dict:fetch(OwnRequestId, State#state.own_requests) of undefined -> @@ -200,23 +201,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) -> |