You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by da...@apache.org on 2017/05/10 16:03:06 UTC

[couchdb] branch COUCHDB-3287-pluggable-storage-engines updated (a41c3b1 -> 30d29f4)

This is an automated email from the ASF dual-hosted git repository.

davisp pushed a change to branch COUCHDB-3287-pluggable-storage-engines
in repository https://gitbox.apache.org/repos/asf/couchdb.git.

      from  a41c3b1   SQUASH: Remove public db record
       new  27d9520   Add vsn field to db records
       new  a671ba5   Don't hardcode variable names in macros
       new  e177e10   Removed unused couch_att:copy/2
       new  5a22203   Add comment for couch_util:fold_files/5
       new  30d29f4   Add couch_server:get_possible_engines/3

The 5 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "adds" were already present in the repository and have only
been added to this reference.


Summary of changes:
 src/couch/src/couch_att.erl           | 11 +----------
 src/couch/src/couch_db_int.hrl        |  1 +
 src/couch/src/couch_server.erl        | 32 ++++++++++++++------------------
 src/couch/src/couch_util.erl          |  7 +++++++
 src/couch/test/couch_stream_tests.erl | 10 +++++-----
 5 files changed, 28 insertions(+), 33 deletions(-)

-- 
To stop receiving notification emails like this one, please contact
['"commits@couchdb.apache.org" <co...@couchdb.apache.org>'].

[couchdb] 04/05: Add comment for couch_util:fold_files/5

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

davisp pushed a commit to branch COUCHDB-3287-pluggable-storage-engines
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit 5a222038867bf1a7e912ae9666af00e4c9379279
Author: Paul J. Davis <pa...@gmail.com>
AuthorDate: Wed May 10 10:39:23 2017 -0500

    Add comment for couch_util:fold_files/5
---
 src/couch/src/couch_util.erl | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/couch/src/couch_util.erl b/src/couch/src/couch_util.erl
index dc2ef64..3ed3929 100644
--- a/src/couch/src/couch_util.erl
+++ b/src/couch/src/couch_util.erl
@@ -64,6 +64,13 @@ normparts([Part | RestParts], Acc) ->
     normparts(RestParts, [Part | Acc]).
 
 
+% This is implementation is similar the builtin filelib:fold_files/5
+% except that this version will run the user supplied function
+% on directories that match the regular expression as well.
+%
+% This is motivated by the case when couch_server is searching
+% for pluggable storage engines. This change allows a
+% database to be either a file or a directory.
 fold_files(Dir, RegExp, Recursive, Fun, Acc) ->
     {ok, Re} = re:compile(RegExp, [unicode]),
     fold_files1(Dir, Re, Recursive, Fun, Acc).

-- 
To stop receiving notification emails like this one, please contact
"commits@couchdb.apache.org" <co...@couchdb.apache.org>.

[couchdb] 05/05: Add couch_server:get_possible_engines/3

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

davisp pushed a commit to branch COUCHDB-3287-pluggable-storage-engines
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit 30d29f4c83ef3b92928caa9d33c57dc5f290190f
Author: Paul J. Davis <pa...@gmail.com>
AuthorDate: Wed May 10 11:02:57 2017 -0500

    Add couch_server:get_possible_engines/3
---
 src/couch/src/couch_server.erl | 32 ++++++++++++++------------------
 1 file changed, 14 insertions(+), 18 deletions(-)

diff --git a/src/couch/src/couch_server.erl b/src/couch/src/couch_server.erl
index 650b961..60ecc5e 100644
--- a/src/couch/src/couch_server.erl
+++ b/src/couch/src/couch_server.erl
@@ -121,15 +121,7 @@ delete(DbName, Options) ->
 exists(DbName) ->
     RootDir = config:get("couchdb", "database_dir", "."),
     Engines = get_configured_engines(),
-    Possible = lists:foldl(fun({Extension, Engine}, Acc) ->
-        Path = make_filepath(RootDir, DbName, Extension),
-        case couch_db_engine:exists(Engine, Path) of
-            true ->
-                [{Engine, Path} | Acc];
-            false ->
-                Acc
-        end
-    end, [], Engines),
+    Possible = get_possible_engines(DbName, RootDir, Engines),
     Possible /= [].
 
 
@@ -608,15 +600,7 @@ get_engine(Server, DbName) ->
         root_dir = RootDir,
         engines = Engines
     } = Server,
-    Possible = lists:foldl(fun({Extension, Engine}, Acc) ->
-        Path = make_filepath(RootDir, DbName, Extension),
-        case couch_db_engine:exists(Engine, Path) of
-            true ->
-                [{Engine, Path} | Acc];
-            false ->
-                Acc
-        end
-    end, [], Engines),
+    Possible = get_possible_engines(DbName, RootDir, Engines),
     case Possible of
         [] ->
             get_default_engine(Server, DbName);
@@ -627,6 +611,18 @@ get_engine(Server, DbName) ->
     end.
 
 
+get_possible_engines(DbName, RootDir, Engines) ->
+    lists:foldl(fun({Extension, Engine}, Acc) ->
+        Path = make_filepath(RootDir, DbName, Extension),
+        case couch_db_engine:exists(Engine, Path) of
+            true ->
+                [{Engine, Path} | Acc];
+            false ->
+                Acc
+        end
+    end, [], Engines),
+
+
 get_default_engine(Server, DbName) ->
     #server{
         root_dir = RootDir,

-- 
To stop receiving notification emails like this one, please contact
"commits@couchdb.apache.org" <co...@couchdb.apache.org>.

[couchdb] 01/05: Add vsn field to db records

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

davisp pushed a commit to branch COUCHDB-3287-pluggable-storage-engines
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit 27d9520ddfb3abb4783bec29a0a31f8a06b2eb27
Author: Paul J. Davis <pa...@gmail.com>
AuthorDate: Wed May 10 10:18:56 2017 -0500

    Add vsn field to db records
---
 src/couch/src/couch_db_int.hrl | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/couch/src/couch_db_int.hrl b/src/couch/src/couch_db_int.hrl
index 2b41b73..a412b33 100644
--- a/src/couch/src/couch_db_int.hrl
+++ b/src/couch/src/couch_db_int.hrl
@@ -12,6 +12,7 @@
 
 
 -record(db, {
+    vsn = 1,
     name,
     filepath,
 

-- 
To stop receiving notification emails like this one, please contact
"commits@couchdb.apache.org" <co...@couchdb.apache.org>.

[couchdb] 02/05: Don't hardcode variable names in macros

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

davisp pushed a commit to branch COUCHDB-3287-pluggable-storage-engines
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit a671ba5f13d0810fb8d973a0d91311814c7758ca
Author: Paul J. Davis <pa...@gmail.com>
AuthorDate: Wed May 10 10:22:58 2017 -0500

    Don't hardcode variable names in macros
---
 src/couch/test/couch_stream_tests.erl | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/couch/test/couch_stream_tests.erl b/src/couch/test/couch_stream_tests.erl
index 901b4fd..a7fedf0 100644
--- a/src/couch/test/couch_stream_tests.erl
+++ b/src/couch/test/couch_stream_tests.erl
@@ -14,11 +14,11 @@
 
 -include_lib("couch/include/couch_eunit.hrl").
 
--define(ENGINE, {couch_bt_engine_stream, {Fd, []}}).
+-define(ENGINE(FdVar), {couch_bt_engine_stream, {FdVar, []}}).
 
 setup() ->
     {ok, Fd} = couch_file:open(?tempfile(), [create, overwrite]),
-    {ok, Stream} = couch_stream:open(?ENGINE, []),
+    {ok, Stream} = couch_stream:open(?ENGINE(Fd), []),
     {Fd, Stream}.
 
 teardown({Fd, _}) ->
@@ -80,7 +80,7 @@ should_recall_last_pointer_position({Fd, Stream}) ->
     couch_stream:write(Stream, <<"foodfoob">>),
     {_, _, _, _, _} = couch_stream:close(Stream),
     {ok, ExpPtr} = couch_file:bytes(Fd),
-    {ok, Stream2} = couch_stream:open(?ENGINE),
+    {ok, Stream2} = couch_stream:open(?ENGINE(Fd)),
     ZeroBits = <<0:(8 * 10)>>,
     OneBits = <<1:(8 * 10)>>,
     ok = couch_stream:write(Stream2, OneBits),
@@ -92,7 +92,7 @@ should_recall_last_pointer_position({Fd, Stream}) ->
     ?_assertEqual(AllBits, read_all(NewEngine)).
 
 should_stream_more_with_4K_chunk_size({Fd, _}) ->
-    {ok, Stream} = couch_stream:open(?ENGINE, [{buffer_size, 4096}]),
+    {ok, Stream} = couch_stream:open(?ENGINE(Fd), [{buffer_size, 4096}]),
     lists:foldl(
         fun(_, Acc) ->
             Data = <<"a1b2c">>,
@@ -107,7 +107,7 @@ should_stop_on_normal_exit_of_stream_opener({Fd, _}) ->
     RunnerPid = self(),
     OpenerPid = spawn(
         fun() ->
-            {ok, StreamPid} = couch_stream:open(?ENGINE),
+            {ok, StreamPid} = couch_stream:open(?ENGINE(Fd)),
             RunnerPid ! {pid, StreamPid}
         end),
     StreamPid = receive

-- 
To stop receiving notification emails like this one, please contact
"commits@couchdb.apache.org" <co...@couchdb.apache.org>.

[couchdb] 03/05: Removed unused couch_att:copy/2

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

davisp pushed a commit to branch COUCHDB-3287-pluggable-storage-engines
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit e177e1079d13c80018f1538c4970e50ee3a44c72
Author: Paul J. Davis <pa...@gmail.com>
AuthorDate: Wed May 10 10:26:28 2017 -0500

    Removed unused couch_att:copy/2
---
 src/couch/src/couch_att.erl | 11 +----------
 1 file changed, 1 insertion(+), 10 deletions(-)

diff --git a/src/couch/src/couch_att.erl b/src/couch/src/couch_att.erl
index e6ed7df..bd53086 100644
--- a/src/couch/src/couch_att.erl
+++ b/src/couch/src/couch_att.erl
@@ -18,8 +18,7 @@
     fetch/2,
     store/2,
     store/3,
-    transform/3,
-    copy/2
+    transform/3
 ]).
 
 -export([
@@ -234,14 +233,6 @@ transform(Field, Fun, Att) ->
     store(Field, NewValue, Att).
 
 
-copy(Att, DstStream) ->
-    [{stream, SrcStream}, AttLen, OldMd5] = fetch([data, att_len, md5], Att),
-    ok = couch_stream:copy(SrcStream, DstStream),
-    {NewStream, AttLen, _, NewMd5, _} = couch_stream:close(DstStream),
-    couch_util:check_md5(OldMd5, NewMd5),
-    store(data, {stream, NewStream}, Att).
-
-
 is_stub(Att) ->
     stub == fetch(data, Att).
 

-- 
To stop receiving notification emails like this one, please contact
"commits@couchdb.apache.org" <co...@couchdb.apache.org>.