You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by da...@apache.org on 2017/09/12 20:09:08 UTC

[couchdb] 25/28: ss - implement pse

This is an automated email from the ASF dual-hosted git repository.

davisp pushed a commit to branch COUCHDB-3287-pluggable-storage-engines
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit 4556897235884a1984b466c9144d4e1030980fd7
Author: Paul J. Davis <pa...@gmail.com>
AuthorDate: Tue Sep 12 14:29:53 2017 -0500

    ss - implement pse
---
 src/couch/src/couch_bt_engine.erl         |  2 +-
 src/couch/src/couch_stream.erl            |  6 +++---
 src/couch/src/test_engine_attachments.erl |  4 ++--
 src/couch/src/test_engine_compaction.erl  | 10 +++++-----
 4 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/src/couch/src/couch_bt_engine.erl b/src/couch/src/couch_bt_engine.erl
index b069067..07ace20 100644
--- a/src/couch/src/couch_bt_engine.erl
+++ b/src/couch/src/couch_bt_engine.erl
@@ -329,7 +329,7 @@ serialize_doc(#st{} = St, #doc{} = Doc) ->
     Body = Compress(Doc#doc.body),
     Atts = Compress(Doc#doc.atts),
     SummaryBin = ?term_to_bin({Body, Atts}),
-    Md5 = couch_crypto:hash(md5, SummaryBin),
+    Md5 = crypto:hash(md5, SummaryBin),
     Data = couch_file:assemble_file_chunk(SummaryBin, Md5),
     % TODO: This is a terrible hack to get around the issues
     %       in COUCHDB-3255. We'll need to come back and figure
diff --git a/src/couch/src/couch_stream.erl b/src/couch/src/couch_stream.erl
index 3926a9d..83b0611 100644
--- a/src/couch/src/couch_stream.erl
+++ b/src/couch/src/couch_stream.erl
@@ -100,7 +100,7 @@ foldl(Engine, <<>>, Fun, Acc) ->
 foldl(Engine, Md5, UserFun, UserAcc) ->
     InitAcc = {crypto:hash_init(md5), UserFun, UserAcc},
     {Md5Acc, _, OutAcc} = foldl(Engine, fun foldl_md5/2, InitAcc),
-    Md5 = crypto:hash_final(md5, Md5Acc),
+    Md5 = crypto:hash_final(Md5Acc),
     OutAcc.
 
 
@@ -128,7 +128,7 @@ range_foldl(Engine, From, To, UserFun, UserAcc) when To >= From ->
 
 
 foldl_md5(Bin, {Md5Acc, UserFun, UserAcc}) ->
-    NewMd5Acc = crypto:hash_update(md5, Md5Acc, Bin),
+    NewMd5Acc = crypto:hash_update(Md5Acc, Bin),
     {NewMd5Acc, UserFun, UserFun(Bin, UserAcc)}.
 
 
@@ -238,7 +238,7 @@ handle_call({write, Bin}, _From, Stream) ->
         WriteBin2 ->
             NewEngine = do_write(Engine, WriteBin2),
             WrittenLen2 = WrittenLen + iolist_size(WriteBin2),
-            Md5_2 = crypto:hash_update(md5, Md5, WriteBin2)
+            Md5_2 = crypto:hash_update(Md5, WriteBin2)
         end,
 
         {reply, ok, Stream#stream{
diff --git a/src/couch/src/test_engine_attachments.erl b/src/couch/src/test_engine_attachments.erl
index b0b3472..691d4bd 100644
--- a/src/couch/src/test_engine_attachments.erl
+++ b/src/couch/src/test_engine_attachments.erl
@@ -21,7 +21,7 @@
 cet_write_attachment() ->
     {ok, Engine, DbPath, St1} = test_engine_util:init_engine(dbpath),
 
-    AttBin = crypto:rand_bytes(32768),
+    AttBin = crypto:strong_rand_bytes(32768),
 
     try
         [Att0] = test_engine_util:prep_atts(Engine, St1, [
@@ -74,7 +74,7 @@ cet_write_attachment() ->
 cet_inactive_stream() ->
     {ok, Engine, DbPath, St1} = test_engine_util:init_engine(dbpath),
 
-    AttBin = crypto:rand_bytes(32768),
+    AttBin = crypto:strong_rand_bytes(32768),
 
     try
         [Att0] = test_engine_util:prep_atts(Engine, St1, [
diff --git a/src/couch/src/test_engine_compaction.erl b/src/couch/src/test_engine_compaction.erl
index 619edd7..09a1e4e 100644
--- a/src/couch/src/test_engine_compaction.erl
+++ b/src/couch/src/test_engine_compaction.erl
@@ -101,11 +101,11 @@ cet_compact_with_everything() ->
 
     {ok, St7} = try
         [Att0, Att1, Att2, Att3, Att4] = test_engine_util:prep_atts(Engine, St6, [
-                {<<"ohai.txt">>, crypto:rand_bytes(2048)},
-                {<<"stuff.py">>, crypto:rand_bytes(32768)},
-                {<<"a.erl">>, crypto:rand_bytes(29)},
-                {<<"a.hrl">>, crypto:rand_bytes(5000)},
-                {<<"a.app">>, crypto:rand_bytes(400)}
+                {<<"ohai.txt">>, crypto:strong_rand_bytes(2048)},
+                {<<"stuff.py">>, crypto:strong_rand_bytes(32768)},
+                {<<"a.erl">>, crypto:strong_rand_bytes(29)},
+                {<<"a.hrl">>, crypto:strong_rand_bytes(5000)},
+                {<<"a.app">>, crypto:strong_rand_bytes(400)}
             ]),
 
         Actions4 = [

-- 
To stop receiving notification emails like this one, please contact
"commits@couchdb.apache.org" <co...@couchdb.apache.org>.