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/10/03 16:11:38 UTC
[38/50] [abbrv] git commit: updated refs/heads/1867-feature-plugins
to 95d6e35
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/0f7a4efa
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/0f7a4efa
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/0f7a4efa
Branch: refs/heads/1867-feature-plugins
Commit: 0f7a4efa663da5dea5d89afb773518535038beec
Parents: 2bed2a5
Author: Jan Lehnardt <ja...@apache.org>
Authored: Fri Aug 2 18:17:05 2013 +0200
Committer: Jan Lehnardt <ja...@apache.org>
Committed: Thu Oct 3 16:08:36 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/0f7a4efa/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/0f7a4efa/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",