You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ja...@apache.org on 2013/08/02 22:09:01 UTC

[47/49] git commit: updated refs/heads/1867-feature-plugins to d269b53

add inline comments


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

Branch: refs/heads/1867-feature-plugins
Commit: fc2717cfa5d0c12df6e74c596319d1489085e655
Parents: ed1fdd5
Author: Jan Lehnardt <ja...@apache.org>
Authored: Fri Aug 2 18:17:05 2013 +0200
Committer: Jan Lehnardt <ja...@apache.org>
Committed: Fri Aug 2 21:17:05 2013 +0200

----------------------------------------------------------------------
 src/couch_plugins/README.md             |  2 ++
 src/couch_plugins/src/couch_plugins.erl | 24 ++++++++++++++++++++++++
 2 files changed, 26 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb/blob/fc2717cf/src/couch_plugins/README.md
----------------------------------------------------------------------
diff --git a/src/couch_plugins/README.md b/src/couch_plugins/README.md
index c75b87d..02a83ce 100644
--- a/src/couch_plugins/README.md
+++ b/src/couch_plugins/README.md
@@ -85,6 +85,8 @@ Milestone X: Later
  - Add some account/identity/maybe crypto-web-of-trust system for
    authors to publish “legit” plugins.
  - Sign & verify individual releases.
+ - Handle unclean un/installs if CouchDB crashes while installing/
+   uninstalling
 
 A few more things that can happen concurrently depending on what
 plugins require:

http://git-wip-us.apache.org/repos/asf/couchdb/blob/fc2717cf/src/couch_plugins/src/couch_plugins.erl
----------------------------------------------------------------------
diff --git a/src/couch_plugins/src/couch_plugins.erl b/src/couch_plugins/src/couch_plugins.erl
index dfd59a2..7adadc4 100644
--- a/src/couch_plugins/src/couch_plugins.erl
+++ b/src/couch_plugins/src/couch_plugins.erl
@@ -51,10 +51,30 @@ install({Name, _BaseUrl, Version, Checksums}=Plugin) ->
 
   ok.
 
+%% * * *
+
+
+%% Plugin Registration
+%% On uninstall:
+%%  - add plugins/name = version to config
+%% On uninstall:
+%%  - remove plugins/name from config
+
 -spec register_plugin(string(), string()) -> ok.
 register_plugin(Name, Version) ->
   couch_config:set("plugins", Name, Version).
 
+-spec unregister_plugin(string()) -> ok.
+unregister_plugin(Name) ->
+  couch_config:delete("plugins", Name).
+
+%% * * *
+
+
+%% Load Config
+%% Pareses <plugindir>/priv/default.d/<pluginname.ini> and applies
+%% the contents to the config system.
+
 -spec load_config(string(), string()) -> ok.
 load_config(Name, Version) ->
     lists:foreach(
@@ -73,6 +93,10 @@ load_config_file(File) ->
 set_config({{Section, Key}, Value}) ->
     ok = couch_config:set(Section, Key, Value, false).
 
+%% * * *
+
+
+
 -spec add_code_path(string(), string()) -> ok | {error, bad_directory}.
 add_code_path(Name, Version) ->
   PluginPath = plugin_dir() ++ "/" ++ get_file_slug(Name, Version) ++ "/ebin",