diff options
author | Paul Joseph Davis <davisp@apache.org> | 2009-10-13 23:13:16 +0000 |
---|---|---|
committer | Paul Joseph Davis <davisp@apache.org> | 2009-10-13 23:13:16 +0000 |
commit | 594e19a52490629bd2e538161a2e1b1ccb29a833 (patch) | |
tree | 37aaaa1155451db7edcfa296c2058a8ae506e647 /src | |
parent | 4f75d5035cf16f39e086c5c8278e18019514d803 (diff) |
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
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@824970 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src')
-rw-r--r-- | src/couchdb/couch_view_group.erl | 30 |
1 files changed, 21 insertions, 9 deletions
diff --git a/src/couchdb/couch_view_group.erl b/src/couchdb/couch_view_group.erl index 2a757c55..6589bc6a 100644 --- a/src/couchdb/couch_view_group.erl +++ b/src/couchdb/couch_view_group.erl @@ -145,11 +145,8 @@ handle_call({request_group, RequestSeq}, From, 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 @@ open_db_group(DbName, GroupId) -> 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 |