You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by va...@apache.org on 2019/11/14 23:15:48 UTC

[couchdb] 01/01: Assert Db handle field existence in `load_config/1` in fabric2_fdb

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

vatamane pushed a commit to branch assert-field-existence-in-load-config
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit b1899b3bb7bf0fc0d74248b746995610e5932e65
Author: Nick Vatamaniuc <va...@apache.org>
AuthorDate: Thu Nov 14 18:13:46 2019 -0500

    Assert Db handle field existence in `load_config/1` in fabric2_fdb
    
    Forgot to push this in the previous PR so made a new commit.
    
    https://github.com/apache/couchdb/pull/2300#discussion_r346592418
---
 src/fabric/src/fabric2_fdb.erl | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/fabric/src/fabric2_fdb.erl b/src/fabric/src/fabric2_fdb.erl
index 97f0bc9..0d74138 100644
--- a/src/fabric/src/fabric2_fdb.erl
+++ b/src/fabric/src/fabric2_fdb.erl
@@ -212,8 +212,10 @@ open(#{} = Db0, Options) ->
         db_prefix => DbPrefix,
         db_version => DbVersion,
 
+        uuid => <<>>,
         revs_limit => 1000,
         security_doc => {[]},
+
         user_ctx => UserCtx,
 
         % Place holders until we implement these
@@ -369,9 +371,9 @@ load_config(#{} = Db) ->
     lists:foldl(fun({K, V}, DbAcc) ->
         {?DB_CONFIG, Key} = erlfdb_tuple:unpack(K, DbPrefix),
         case Key of
-            <<"uuid">> ->  DbAcc#{uuid => V};
-            <<"revs_limit">> -> DbAcc#{revs_limit => ?bin2uint(V)};
-            <<"security_doc">> -> DbAcc#{security_doc => ?JSON_DECODE(V)}
+            <<"uuid">> ->  DbAcc#{uuid := V};
+            <<"revs_limit">> -> DbAcc#{revs_limit := ?bin2uint(V)};
+            <<"security_doc">> -> DbAcc#{security_doc := ?JSON_DECODE(V)}
         end
     end, Db, erlfdb:wait(Future)).