couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rnew...@apache.org
Subject fabric commit: updated refs/heads/windsor-merge to a71701c
Date Fri, 22 Aug 2014 18:26:58 GMT
Repository: couchdb-fabric
Updated Branches:
  refs/heads/windsor-merge 0c3ad74e4 -> a71701c91


Expose new size values


Project: http://git-wip-us.apache.org/repos/asf/couchdb-fabric/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-fabric/commit/a71701c9
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-fabric/tree/a71701c9
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-fabric/diff/a71701c9

Branch: refs/heads/windsor-merge
Commit: a71701c91c7f674ff20017332a4ddbb0dbaf1d11
Parents: 0c3ad74
Author: Robert Newson <rnewson@apache.org>
Authored: Fri Aug 22 19:26:45 2014 +0100
Committer: Robert Newson <rnewson@apache.org>
Committed: Fri Aug 22 19:26:45 2014 +0100

----------------------------------------------------------------------
 src/fabric_db_info.erl    | 17 +++++++++++++++--
 src/fabric_group_info.erl | 15 +++++++++++++--
 2 files changed, 28 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-fabric/blob/a71701c9/src/fabric_db_info.erl
----------------------------------------------------------------------
diff --git a/src/fabric_db_info.erl b/src/fabric_db_info.erl
index 8a41cde..ab93e47 100644
--- a/src/fabric_db_info.erl
+++ b/src/fabric_db_info.erl
@@ -94,9 +94,13 @@ merge_results(Info) ->
             [{purge_seq, lists:sum(X)} | Acc];
         (compact_running, X, Acc) ->
             [{compact_running, lists:member(true, X)} | Acc];
-        (disk_size, X, Acc) ->
+        (disk_size, X, Acc) -> % legacy
             [{disk_size, lists:sum(X)} | Acc];
-        (other, X, Acc) ->
+        (data_size, X, Acc) -> % legacy
+            [{data_size, lists:sum(X)} | Acc];
+        (sizes, X, Acc) ->
+            [{sizes, {merge_object(X)}} | Acc];
+        (other, X, Acc) -> % legacy
             [{other, {merge_other_results(X)}} | Acc];
         (disk_format_version, X, Acc) ->
             [{disk_format_version, lists:max(X)} | Acc];
@@ -114,3 +118,12 @@ merge_other_results(Results) ->
         (_, _, Acc) ->
             Acc
     end, [], Dict).
+
+merge_object(Objects) ->
+    Dict = lists:foldl(fun({Props}, D) ->
+        lists:foldl(fun({K,V},D0) -> orddict:append(K,V,D0) end, D, Props)
+    end, orddict:new(), Objects),
+    orddict:fold(fun
+        (Key, X, Acc) ->
+            [{Key, lists:sum(X)} | Acc]
+    end, [], Dict).

http://git-wip-us.apache.org/repos/asf/couchdb-fabric/blob/a71701c9/src/fabric_group_info.erl
----------------------------------------------------------------------
diff --git a/src/fabric_group_info.erl b/src/fabric_group_info.erl
index b5ee2b2..85719b6 100644
--- a/src/fabric_group_info.erl
+++ b/src/fabric_group_info.erl
@@ -81,10 +81,12 @@ merge_results(Info) ->
             [{signature, X} | Acc];
         (language, [X|_], Acc) ->
             [{language, X} | Acc];
-        (disk_size, X, Acc) ->
+        (disk_size, X, Acc) -> % legacy
             [{disk_size, lists:sum(X)} | Acc];
-        (data_size, X, Acc) ->
+        (data_size, X, Acc) -> % legacy
             [{data_size, lists:sum(X)} | Acc];
+        (sizes, X, Acc) ->
+            [{sizes, {merge_object(X)}} | Acc];
         (compact_running, X, Acc) ->
             [{compact_running, lists:member(true, X)} | Acc];
         (updater_running, X, Acc) ->
@@ -100,3 +102,12 @@ merge_results(Info) ->
         (_, _, Acc) ->
             Acc
     end, [], Dict).
+
+merge_object(Objects) ->
+    Dict = lists:foldl(fun({Props}, D) ->
+        lists:foldl(fun({K,V},D0) -> orddict:append(K,V,D0) end, D, Props)
+    end, orddict:new(), Objects),
+    orddict:fold(fun
+        (Key, X, Acc) ->
+            [{Key, lists:sum(X)} | Acc]
+    end, [], Dict).


Mime
View raw message