Return-Path: Delivered-To: apmail-incubator-couchdb-commits-archive@locus.apache.org Received: (qmail 83414 invoked from network); 14 Jun 2008 21:02:29 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 14 Jun 2008 21:02:29 -0000 Received: (qmail 64422 invoked by uid 500); 14 Jun 2008 21:02:32 -0000 Delivered-To: apmail-incubator-couchdb-commits-archive@incubator.apache.org Received: (qmail 64391 invoked by uid 500); 14 Jun 2008 21:02:31 -0000 Mailing-List: contact couchdb-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: couchdb-dev@incubator.apache.org Delivered-To: mailing list couchdb-commits@incubator.apache.org Received: (qmail 64380 invoked by uid 99); 14 Jun 2008 21:02:31 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 14 Jun 2008 14:02:31 -0700 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 14 Jun 2008 21:01:40 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 9A3602388A03; Sat, 14 Jun 2008 14:01:58 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r667882 - in /incubator/couchdb/branches/runtimeconfig: doc/ src/couchdb/ src/couchdb/test/ Date: Sat, 14 Jun 2008 21:01:58 -0000 To: couchdb-commits@incubator.apache.org From: jan@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20080614210158.9A3602388A03@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: jan Date: Sat Jun 14 14:01:57 2008 New Revision: 667882 URL: http://svn.apache.org/viewvc?rev=667882&view=rev Log: Start documenting with edoc format. add preliminary edoc generation Makefile. Added: incubator/couchdb/branches/runtimeconfig/doc/ incubator/couchdb/branches/runtimeconfig/doc/Makefile incubator/couchdb/branches/runtimeconfig/doc/couch_config.html incubator/couchdb/branches/runtimeconfig/doc/edoc-info incubator/couchdb/branches/runtimeconfig/doc/erlang.png (with props) incubator/couchdb/branches/runtimeconfig/doc/index.html incubator/couchdb/branches/runtimeconfig/doc/modules-frame.html incubator/couchdb/branches/runtimeconfig/doc/overview-summary.html incubator/couchdb/branches/runtimeconfig/doc/packages-frame.html incubator/couchdb/branches/runtimeconfig/doc/stylesheet.css Modified: incubator/couchdb/branches/runtimeconfig/src/couchdb/couch_config.erl incubator/couchdb/branches/runtimeconfig/src/couchdb/test/couch_config_test.erl Added: incubator/couchdb/branches/runtimeconfig/doc/Makefile URL: http://svn.apache.org/viewvc/incubator/couchdb/branches/runtimeconfig/doc/Makefile?rev=667882&view=auto ============================================================================== --- incubator/couchdb/branches/runtimeconfig/doc/Makefile (added) +++ incubator/couchdb/branches/runtimeconfig/doc/Makefile Sat Jun 14 14:01:57 2008 @@ -0,0 +1,4 @@ +SOURCEFILES=\""../src/couchdb/couch_config.erl\"" +all: + @echo "making docdir" + erl -noshell -run edoc_run files [$(SOURCEFILES)] Added: incubator/couchdb/branches/runtimeconfig/doc/couch_config.html URL: http://svn.apache.org/viewvc/incubator/couchdb/branches/runtimeconfig/doc/couch_config.html?rev=667882&view=auto ============================================================================== --- incubator/couchdb/branches/runtimeconfig/doc/couch_config.html (added) +++ incubator/couchdb/branches/runtimeconfig/doc/couch_config.html Sat Jun 14 14:01:57 2008 @@ -0,0 +1,189 @@ + + + +Module couch_config + + + + +
+ +

Module couch_config

+Reads CouchDB's ini file and gets queried for configuration parameters. + +

Behaviours: gen_server.

+

Authors: Jan Lehnardt (jan@apache.org).

+ +

Description

Reads CouchDB's ini file and gets queried for configuration parameters. + This module is initialized with a list of ini files that it + consecutively reads Key/Value pairs from and saves them in a ets table. + If more an one ini file is specified, the last one is used to write + changes that are made with store/2 back to that ini file. +

Function Index

+ + + + + + + + + + + + + + + + + + + + + + + +
code_change/3
dump/0
handle_call/3
handle_cast/2
handle_info/2
init/1
init_value/2Public API function triggers initialization of a Key/Value pair.
load_ini_file/1
load_ini_files/1
lookup/1Returns the value that is stored under key::any() or null::atom() if no + such Key exists.
lookup/2Returns the value that is stored under key::any() or Default::any() if + no such Key exists.
lookup_and_register/2Returns the value that is stored under key::any() or null::atom() if no + such Key exists.
lookup_and_register/3Returns the value that is stored under key::any() or Default::any() if + such Key exists.
lookup_match/1Lets you look for a Key's Value specifying a pattern that gets passed + to ets::match().
lookup_match/2Lets you look for a Key's Value specifying a pattern that gets passed + to ets::match().
lookup_match_and_register/2
lookup_match_and_register/3
register/2
start_link/0Start the configuration module.
stop/0Stops the configuration module.
store/2Public API function that triggers storage of a Key/Value pair into the + local ets table and writes it to the storage ini file.
terminate/2
unset/1
+ +

Function Details

+ +

code_change/3

+
+

code_change() -> term()

+
+ +

dump/0

+
+

dump() -> term()

+
+ +

handle_call/3

+
+

handle_call() -> term()

+
+ +

handle_cast/2

+
+

handle_cast() -> term()

+
+ +

handle_info/2

+
+

handle_info() -> term()

+
+ +

init/1

+
+

init() -> term()

+
+ +

init_value/2

+
+

init_value(Key::any(), Value::any()) -> {ok, Tab}

+

Public API function triggers initialization of a Key/Value pair. Used + when setting values from the ini file. Works like store/2 but doesn't + write the Key/Value pair to the storage ini file.

+ +

load_ini_file/1

+
+

load_ini_file() -> term()

+
+ +

load_ini_files/1

+
+

load_ini_files() -> term()

+
+ +

lookup/1

+
+

lookup(Key::any()) -> Value::any() | null

+

Returns the value that is stored under key::any() or null::atom() if no + such Key exists.

+ +

lookup/2

+
+

lookup(Key::any(), Default::any()) -> Value::any() | Default

+

Returns the value that is stored under key::any() or Default::any() if + no such Key exists.

+ +

lookup_and_register/2

+
+

lookup_and_register(Key::any(), CallbackFunction::function()) -> Value::any() | null

+

Returns the value that is stored under key::any() or null::atom() if no + such Key exists. Additionally, this functions registers + CallbackFunction::function() to be called if the value of Key::any() + is changed at a later point.

+ +

lookup_and_register/3

+
+

lookup_and_register(Key::any(), Default::any(), CallbackFunction::function()) -> Value::any() | Default

+

Returns the value that is stored under key::any() or Default::any() if + such Key exists. Additionally, this functions registers + CallbackFunction::function() to be called if the value of Key::any() + is changed at a later point.

+ +

lookup_match/1

+
+

lookup_match(Key::any()) -> Value::any() | null:atom()

+

Lets you look for a Key's Value specifying a pattern that gets passed + to ets::match(). Returns null::atom() if no Key is found.

+ +

lookup_match/2

+
+

lookup_match(Key::any(), Default::any()) -> Value::any() | Default

+

Lets you look for a Key's Value specifying a pattern that gets passed + to ets::match(). Returns Default::any() if no Key is found

+ +

lookup_match_and_register/2

+
+

lookup_match_and_register() -> term()

+
+ +

lookup_match_and_register/3

+
+

lookup_match_and_register() -> term()

+
+ +

register/2

+
+

register() -> term()

+
+ +

start_link/0

+
+

start_link() -> {ok, Tab}

+

Start the configuration module

+ +

stop/0

+
+

stop() -> ok

+

Stops the configuration module

+ +

store/2

+
+

store(Key::any(), Value::any()) -> {ok, Tab}

+

Public API function that triggers storage of a Key/Value pair into the + local ets table and writes it to the storage ini file.

+ +

terminate/2

+
+

terminate() -> term()

+
+ +

unset/1

+
+

unset() -> term()

+
+
+ + +

Generated by EDoc, Jun 14 2008, 22:56:08.

+ + Added: incubator/couchdb/branches/runtimeconfig/doc/edoc-info URL: http://svn.apache.org/viewvc/incubator/couchdb/branches/runtimeconfig/doc/edoc-info?rev=667882&view=auto ============================================================================== --- incubator/couchdb/branches/runtimeconfig/doc/edoc-info (added) +++ incubator/couchdb/branches/runtimeconfig/doc/edoc-info Sat Jun 14 14:01:57 2008 @@ -0,0 +1,2 @@ +{packages,[]}. +{modules,[couch_config]}. Added: incubator/couchdb/branches/runtimeconfig/doc/erlang.png URL: http://svn.apache.org/viewvc/incubator/couchdb/branches/runtimeconfig/doc/erlang.png?rev=667882&view=auto ============================================================================== Binary file - no diff available. Propchange: incubator/couchdb/branches/runtimeconfig/doc/erlang.png ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream Added: incubator/couchdb/branches/runtimeconfig/doc/index.html URL: http://svn.apache.org/viewvc/incubator/couchdb/branches/runtimeconfig/doc/index.html?rev=667882&view=auto ============================================================================== --- incubator/couchdb/branches/runtimeconfig/doc/index.html (added) +++ incubator/couchdb/branches/runtimeconfig/doc/index.html Sat Jun 14 14:01:57 2008 @@ -0,0 +1,17 @@ + + + +Overview + + + + + + +<h2>This page uses frames</h2> +<p>Your browser does not accept frames. +<br>You should go to the <a href="overview-summary.html">non-frame version</a> instead. +</p> + + + \ No newline at end of file Added: incubator/couchdb/branches/runtimeconfig/doc/modules-frame.html URL: http://svn.apache.org/viewvc/incubator/couchdb/branches/runtimeconfig/doc/modules-frame.html?rev=667882&view=auto ============================================================================== --- incubator/couchdb/branches/runtimeconfig/doc/modules-frame.html (added) +++ incubator/couchdb/branches/runtimeconfig/doc/modules-frame.html Sat Jun 14 14:01:57 2008 @@ -0,0 +1,12 @@ + + + +Overview + + + +

Modules

+ +
couch_config
+ + \ No newline at end of file Added: incubator/couchdb/branches/runtimeconfig/doc/overview-summary.html URL: http://svn.apache.org/viewvc/incubator/couchdb/branches/runtimeconfig/doc/overview-summary.html?rev=667882&view=auto ============================================================================== --- incubator/couchdb/branches/runtimeconfig/doc/overview-summary.html (added) +++ incubator/couchdb/branches/runtimeconfig/doc/overview-summary.html Sat Jun 14 14:01:57 2008 @@ -0,0 +1,15 @@ + + + +Overview + + + + +

Overview

+ +
+ +

Generated by EDoc, Jun 14 2008, 22:56:08.

+ + Added: incubator/couchdb/branches/runtimeconfig/doc/packages-frame.html URL: http://svn.apache.org/viewvc/incubator/couchdb/branches/runtimeconfig/doc/packages-frame.html?rev=667882&view=auto ============================================================================== --- incubator/couchdb/branches/runtimeconfig/doc/packages-frame.html (added) +++ incubator/couchdb/branches/runtimeconfig/doc/packages-frame.html Sat Jun 14 14:01:57 2008 @@ -0,0 +1,11 @@ + + + +Overview + + + +

Packages

+
+ + \ No newline at end of file Added: incubator/couchdb/branches/runtimeconfig/doc/stylesheet.css URL: http://svn.apache.org/viewvc/incubator/couchdb/branches/runtimeconfig/doc/stylesheet.css?rev=667882&view=auto ============================================================================== --- incubator/couchdb/branches/runtimeconfig/doc/stylesheet.css (added) +++ incubator/couchdb/branches/runtimeconfig/doc/stylesheet.css Sat Jun 14 14:01:57 2008 @@ -0,0 +1,55 @@ +/* standard EDoc style sheet */ +body { + font-family: Verdana, Arial, Helvetica, sans-serif; + margin-left: .25in; + margin-right: .2in; + margin-top: 0.2in; + margin-bottom: 0.2in; + color: #000000; + background-color: #ffffff; +} +h1,h2 { + margin-left: -0.2in; +} +div.navbar { + background-color: #add8e6; + padding: 0.2em; +} +h2.indextitle { + padding: 0.4em; + background-color: #add8e6; +} +h3.function,h3.typedecl { + background-color: #add8e6; + padding-left: 1em; +} +div.spec { + margin-left: 2em; + background-color: #eeeeee; +} +a.module,a.package { + text-decoration:none +} +a.module:hover,a.package:hover { + background-color: #eeeeee; +} +ul.definitions { + list-style-type: none; +} +ul.index { + list-style-type: none; + background-color: #eeeeee; +} + +/* + * Minor style tweaks + */ +ul { + list-style-type: square; +} +table { + border-collapse: collapse; +} +td { + padding: 3 +} Modified: incubator/couchdb/branches/runtimeconfig/src/couchdb/couch_config.erl URL: http://svn.apache.org/viewvc/incubator/couchdb/branches/runtimeconfig/src/couchdb/couch_config.erl?rev=667882&r1=667881&r2=667882&view=diff ============================================================================== --- incubator/couchdb/branches/runtimeconfig/src/couchdb/couch_config.erl (original) +++ incubator/couchdb/branches/runtimeconfig/src/couchdb/couch_config.erl Sat Jun 14 14:01:57 2008 @@ -10,11 +10,16 @@ % License for the specific language governing permissions and limitations under % the License. +%% @doc Reads CouchDB's ini file and gets queried for configuration parameters. +%% This module is initialized with a list of ini files that it +%% consecutively reads Key/Value pairs from and saves them in a ets table. +%% If more an one ini file is specified, the last one is used to write +%% changes that are made with store/2 back to that ini file. +%% @author Jan Lehnardt + -module(couch_config). -include("couch_db.hrl"). --define(DEFAULT_INI, "couch.ini"). - -behaviour(gen_server). -export([start_link/0, init/1, stop/0, handle_call/3, handle_cast/2, handle_info/2, @@ -27,25 +32,64 @@ dump/0, init_value/2, unset/1, load_ini_file/1, load_ini_files/1]). +%% @spec start_link() -> {ok, Tab} +%% @doc Start the configuration module start_link() -> gen_server:start_link({local, ?MODULE}, ?MODULE, [], []). +%% @spec stop() -> ok +%% @doc Stops the configuration module stop() -> ok. +%% @spec init_value(Key::any(), Value::any()) -> {ok, Tab} +%% @doc Public API function triggers initialization of a Key/Value pair. Used +%% when setting values from the ini file. Works like store/2 but doesn't +%% write the Key/Value pair to the storage ini file. init_value(Key, Value) -> gen_server:call(?MODULE, {init_value, Key, Value}). + +%% @spec store(Key::any(), Value::any()) -> {ok, Tab} +%% @doc Public API function that triggers storage of a Key/Value pair into the +%% local ets table and writes it to the storage ini file. store(Key, Value) -> gen_server:call(?MODULE, {store, [{Key, Value}]}). +%% @spec lookup(Key::any()) -> Value::any() | null +%% @doc Returns the value that is stored under key::any() or null::atom() if no +%% such Key exists. lookup(Key) -> gen_server:call(?MODULE, {lookup, Key}). + +%% @spec lookup(Key::any(), Default::any()) -> Value::any() | Default +%% @doc Returns the value that is stored under key::any() or Default::any() if +%% no such Key exists. lookup(Key, Default) -> gen_server:call(?MODULE, {lookup, Key, Default}). +%% @spec lookup_and_register(Key::any(), CallbackFunction::function()) -> +%% Value::any() | null +%% @doc Returns the value that is stored under Key::any() or null::atom() if no +%% such Key exists. Additionally, this functions registers +%% CallbackFunction::function() to be called if the value of Key::any() +%% is changed at a later point. lookup_and_register(Key, CallbackFunction) -> gen_server:call(?MODULE, {lookup_and_register, Key, CallbackFunction}). +%% @spec lookup_and_register( +%% Key::any(), +%% Default::any(), +%% CallbackFunction::function()) -> Value::any() | Default +%% @doc Returns the value that is stored under Key::any() or Default::any() if +%% such Key exists. Additionally, this functions registers +%% CallbackFunction::function() to be called if the value of Key::any() +%% is changed at a later point. lookup_and_register(Key, Default, CallbackFunction) -> gen_server:call(?MODULE, {lookup_and_register, Key, Default, CallbackFunction}). +%% @spec lookup_match(Key::any()) -> Value::any() | null:atom() +%% @doc Lets you look for a Key's Value specifying a pattern that gets passed +%% to ets::match(). Returns null::atom() if no Key is found. lookup_match(Key) -> gen_server:call(?MODULE, {lookup_match, Key}). +%% @spec lookup_match(Key::any(), Default::any()) -> Value::any() | Default +%% @doc Lets you look for a Key's Value specifying a pattern that gets passed +%% to ets::match(). Returns Default::any() if no Key is found lookup_match(Key, Default) -> gen_server:call(?MODULE, {lookup_match, Key, Default}). lookup_match_and_register(Key, CallbackFunction) -> Modified: incubator/couchdb/branches/runtimeconfig/src/couchdb/test/couch_config_test.erl URL: http://svn.apache.org/viewvc/incubator/couchdb/branches/runtimeconfig/src/couchdb/test/couch_config_test.erl?rev=667882&r1=667881&r2=667882&view=diff ============================================================================== --- incubator/couchdb/branches/runtimeconfig/src/couchdb/test/couch_config_test.erl (original) +++ incubator/couchdb/branches/runtimeconfig/src/couchdb/test/couch_config_test.erl Sat Jun 14 14:01:57 2008 @@ -17,19 +17,19 @@ % test storing different types and see if they come back % the same way there put in. store_tuples() -> - basic_store(key, value). + store(key, value). store_strings() -> - basic_store("key", "value"). + store("key", "value"). store_numbers() -> - basic_store("number_key", 12345). + store("number_key", 12345). store_tuple_key() -> - basic_store({key, subkey}, value). + store({key, subkey}, value). -basic_store(Key, Value) -> +store(Key, Value) -> couch_config:start_link(), couch_config:init_value(Key, Value),