couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dav...@apache.org
Subject svn commit: r824970 - /couchdb/trunk/src/couchdb/couch_view_group.erl
Date Tue, 13 Oct 2009 23:13:16 GMT
Author: davisp
Date: Tue Oct 13 23:13:16 2009
New Revision: 824970

URL: http://svn.apache.org/viewvc?rev=824970&view=rev
Log:
Add more information to the view info objects.

View info is available at the URL:

http://127.0.0.1:5984/db_name/_design/ddocid/_info

New fields include:

    updater_running [true|false] : Whether the view is being built
    waiting_commit [true|false] : Whether this view is a head of db commits
    waiting_clients [integer] : How many clients are waiting on this view
    update_seq [integer] : The update sequence that has been indexed
    purge_seq [integer] : The purge sequence that has been processed

Other fields for reference:

    signature [string] : The md5 signature of the design document's functions
    language [string] : The language of the design document
    disk_size [integer] : Number of bytes the view file occupies on disk
    compact_running [boolean] : Whether the view is currently being compacted


Modified:
    couchdb/trunk/src/couchdb/couch_view_group.erl

Modified: couchdb/trunk/src/couchdb/couch_view_group.erl
URL: http://svn.apache.org/viewvc/couchdb/trunk/src/couchdb/couch_view_group.erl?rev=824970&r1=824969&r2=824970&view=diff
==============================================================================
--- couchdb/trunk/src/couchdb/couch_view_group.erl (original)
+++ couchdb/trunk/src/couchdb/couch_view_group.erl Tue Oct 13 23:13:16 2009
@@ -145,11 +145,8 @@
         waiting_list=[{From, RequestSeq}|WaitList]
         }, infinity};
 
-handle_call(request_group_info, _From, #group_state{
-            group = Group,
-            compactor_pid = CompactorPid
-        } = State) ->
-    GroupInfo = get_group_info(Group, CompactorPid),
+handle_call(request_group_info, _From, State) ->
+    GroupInfo = get_group_info(State),
     {reply, {ok, GroupInfo}, State}.
 
 handle_cast({start_compact, CompactFun}, #group_state{compactor_pid=nil}
@@ -467,17 +464,32 @@
         Else
     end.
 
-get_group_info(#group{
+get_group_info(State) ->
+    #group_state{
+        group=Group,
+        updater_pid=UpdaterPid,
+        compactor_pid=CompactorPid,
+        waiting_commit=WaitingCommit,
+        waiting_list=WaitersList
+    } = State,
+    #group{
         fd = Fd,
         sig = GroupSig,
-        def_lang = Lang
-    }, CompactorPid) ->
+        def_lang = Lang,
+        current_seq=CurrentSeq,
+        purge_seq=PurgeSeq
+    } = Group,
     {ok, Size} = couch_file:bytes(Fd),
     [
         {signature, ?l2b(hex_sig(GroupSig))},
         {language, Lang},
         {disk_size, Size},
-        {compact_running, CompactorPid /= nil}
+        {updater_running, UpdaterPid /= nil},
+        {compact_running, CompactorPid /= nil},
+        {waiting_commit, WaitingCommit},
+        {waiting_clients, length(WaitersList)},
+        {update_seq, CurrentSeq},
+        {purge_seq, PurgeSeq}
     ].
 
 % maybe move to another module



Mime
View raw message