You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@couchdb.apache.org by GitBox <gi...@apache.org> on 2022/10/25 15:42:22 UTC

[GitHub] [couchdb] big-r81 commented on a diff in pull request #4240: Couch password server process

big-r81 commented on code in PR #4240:
URL: https://github.com/apache/couchdb/pull/4240#discussion_r1004657982


##########
src/couch/src/couch_password_server.erl:
##########
@@ -0,0 +1,86 @@
+% Licensed under the Apache License, Version 2.0 (the "License"); you may not
+% use this file except in compliance with the License. You may obtain a copy of
+% the License at
+%
+%   http://www.apache.org/licenses/LICENSE-2.0
+%
+% Unless required by applicable law or agreed to in writing, software
+% distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+% WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+% License for the specific language governing permissions and limitations under
+% the License.
+
+-module(couch_password_server).
+
+-behaviour(gen_server).
+
+-include_lib("couch/include/couch_db.hrl").
+
+-export([start_link/0]).
+-export([
+    init/1,
+    handle_call/3,
+    handle_cast/2,
+    handle_info/2,
+    terminate/2,
+    code_change/3
+]).
+
+-export([sync_hash/0, async_hash/0]).
+
+-record(state, {}).
+
+%%%===================================================================
+%%% Public functions
+%%%===================================================================
+
+sync_hash() ->
+    gen_server:call(?MODULE, hash_passwords).
+async_hash() ->
+    gen_server:cast(?MODULE, hash_passwords).
+
+%%%===================================================================
+%%% Spawning and gen_server implementation
+%%%===================================================================
+
+start_link() ->
+    gen_server:start_link({local, ?MODULE}, ?MODULE, [], []).
+
+init(_Args) ->
+    {ok, #state{}}.
+
+handle_call(hash_passwords, _From, _State) ->
+    {reply, hash_admin_passwords(), _State};
+handle_call(_Request, _From, State = #state{}) ->
+    {reply, ok, State}.

Review Comment:
   So we would have a `{stop, invalid_call, State}`?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@couchdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org