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 2020/09/30 15:08:55 UTC
[couchdb] 01/08: Export fabric2_fdb:chunkify_binary/1,2
This is an automated email from the ASF dual-hosted git repository.
davisp pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/couchdb.git
commit ddae72a707ce51c229da9188275f18664302cba7
Author: Paul J. Davis <pa...@gmail.com>
AuthorDate: Thu Aug 6 12:34:29 2020 -0500
Export fabric2_fdb:chunkify_binary/1,2
---
src/fabric/src/fabric2_fdb.erl | 33 ++++++++++++++++++---------------
1 file changed, 18 insertions(+), 15 deletions(-)
diff --git a/src/fabric/src/fabric2_fdb.erl b/src/fabric/src/fabric2_fdb.erl
index 52303ce..36fa451 100644
--- a/src/fabric/src/fabric2_fdb.erl
+++ b/src/fabric/src/fabric2_fdb.erl
@@ -77,6 +77,9 @@
get_approximate_tx_size/1,
+ chunkify_binary/1,
+ chunkify_binary/2,
+
debug_cluster/0,
debug_cluster/2
]).
@@ -1176,6 +1179,21 @@ get_approximate_tx_size(#{} = TxDb) ->
erlfdb:wait(erlfdb:get_approximate_size(Tx)).
+chunkify_binary(Data) ->
+ chunkify_binary(Data, binary_chunk_size()).
+
+
+chunkify_binary(Data, Size) ->
+ case Data of
+ <<>> ->
+ [];
+ <<Head:Size/binary, Rest/binary>> ->
+ [Head | chunkify_binary(Rest, Size)];
+ <<_/binary>> when size(Data) < Size ->
+ [Data]
+ end.
+
+
debug_cluster() ->
debug_cluster(<<>>, <<16#FE, 16#FF, 16#FF>>).
@@ -1677,21 +1695,6 @@ sum_rem_rev_sizes(RevInfos) ->
end, 0, RevInfos).
-chunkify_binary(Data) ->
- chunkify_data(Data, binary_chunk_size()).
-
-
-chunkify_data(Data, Size) ->
- case Data of
- <<>> ->
- [];
- <<Head:Size/binary, Rest/binary>> ->
- [Head | chunkify_data(Rest, Size)];
- <<_/binary>> when size(Data) < Size ->
- [Data]
- end.
-
-
get_fold_acc(Db, RangePrefix, UserCallback, UserAcc, Options)
when is_map(Db) orelse Db =:= undefined ->