Permalink
Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
228 lines (162 sloc) 5.39 KB
head 1.4;
access;
symbols;
locks
mmcdanie:1.4; strict;
comment @# @;
1.4
date 2009.02.27.00.46.41; author mmcdanie; state Exp;
branches;
next 1.3;
1.3
date 2009.02.16.04.42.11; author mmcdanie; state Exp;
branches;
next 1.2;
1.2
date 2009.02.16.03.52.16; author mmcdanie; state Exp;
branches;
next 1.1;
1.1
date 2009.02.13.20.29.24; author mmcdanie; state Exp;
branches;
next ;
desc
@@
1.4
log
@*** empty log message ***
@
text
@Fri Feb 13 11:04:25 PST 2009
Michael McDaniel
TODO:
1) erlview should be parameterized in local.ini
2) add to Makefile the copy of erlview.beam and
couch_query_servers.beam to CDB ebin
I currently manually copy {erlview, couch_query_servers}.beam to
/usr/local/lib/couchdb/erlang/lib/couch-0.9.0a740870-incubating/ebin/
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
whichever version being used
3) Reconsider the interface for writing map funs. I am not at all sure
I like the basic premise of how I'm currently doing it.
4) Write reduce fun(s).
5) Write end-user docs on how to write map funs, and how to use the
individual helper funs. I have started writing inline docs in
the code so during 'make', the html docs get made.
6) Makefile could use some improving (e.g. doc target instead of just making it)
7) Maybe modify couch_query_servers.erl so that map_docs/2 sent a list of
docs rather than a single doc. That way, handle_call( {map_doc ... )
in erlview could run parallel funs.
---
KNOWN BUGS:
1) If your map funs don't run properly the view name and contents can get
mixed up. If you go change the offending map fun so as to force a
runtime failure that will usually straighten things out (then correct
the map fun). Otherwise you may need to start/stop CouchDB.
Note also: I thought I had the general case of 'view name'/contents
mixup resolved. Though I had only tested that whilst
using entire_doc/2 in the map funs. I now see that with
only two map funs (though using find_all_content/2) the
'view name'/contents are reversed. I have no idea at
the moment why using a different helper fun would have
any effect at all on this problem.
2) Helper funs have not been thoroughly tested.
---
NOTES:
1) Remember, erlview is "AS IS, NO WARRANTY". See the licensing in
src/erlview.erl or doc/erlview.html
Hopefully, by the time you read this, I'll have it up on
http://github.com so you can get it and fix or add whatever
you want.
2) When running eunit:test(erlview, [verbose]), all 10 tests run
successfully. Don't let the SASL "=ERROR REPORT= ..." throw you.
They are proper behaviour to the correct crash of certain funs.
3) In order for erlang to show up as a view language choice (e.g. in Futon),
the following gets added to .../local.ini
[query_servers]
...
erlang = /dev/null
The /dev/null used to cause an error from CDB (apparently because nothing
returned a pid and something in couch dinna like that); I am now
using CDB ver 0.9.0a740870-incubating and the /dev/null works fine
with no error messages or apparently problems.
3)To start the erlang view server (also in local.ini) ...
[daemons]
erlview = {erlview, start_link, []}
4) CouchDB code changes are only in module couch_query_servers.erl
Using a traditional view server, Pid would be returned from whatever
runs on the query_server line (e.g. javascript = ...). However, as
you see from the modified get_os_process/1 code below,
Pid = erlang:whereis(erlview) ,
where erlview is the registered name of the Erlang view server.
couch_query_servers.erl changes
---
% MODIFY get_os_process/1
get_os_process(Lang) ->
case Lang
of <<"erlang">> -> erlang:whereis(erlview) ;
_ ->
gen_server:call(couch_query_servers, {get_proc, Lang})
end
.
% ADD BEFORE map_docs/2
% Pid comes from start_doc_map/2 (see call in couch_view_updater)
map_docs({<<"erlang">>, Pid}, Docs) ->
Results = lists:map( fun( Doc ) ->
couch_os_process:prompt(Pid, [<<"map_doc">>, Doc])
end,
Docs) ,
{ok, Results}
;
5) Edit src/Emakefile for the path to your couch_db.hrl file.
6) This note intentionally left blank (but, from a meta-level, is it?).
%% end $Id: README,v 1.3 2009/02/16 04:42:11 mmcdanie Exp mmcdanie $@
1.3
log
@*** empty log message ***
@
text
@d31 3
d46 8
d131 1
a131 1
%% end $Id: README,v 1.2 2009/02/16 03:52:16 mmcdanie Exp mmcdanie $@
1.2
log
@*** empty log message ***
@
text
@a112 1
5) This note intentionally left blank (but, from a meta-level, is it?).
d114 1
d116 5
a120 1
%% end $Id: README,v 1.1 2009/02/13 20:29:24 mmcdanie Exp $@
1.1
log
@Initial revision
@
text
@d38 4
a41 2
1) More than one map fun and the names get mixed up on which view to show.
For example,
d43 1
a43 10
Via Futon, create first map fun "who" and it runs fine.
Via Futon, create second map fun "what" and it runs fine
but shows output from "who" map fun. Choose "who"
and it shows output from "what"
I suspect this is tied to the handle_call/3 for add_fun in erlview.erl,
i.e., how I save/recall funs.
2) Helper fun entire_doc/2 fails.
d51 6
d58 1
a58 1
1) When running eunit:test(erlview, [verbose]), all 10 tests runn
d63 1
a63 1
2) In order for erlang to show up as a view language choice (e.g. in Futon),
d116 1
a116 1
%% end $Id$@