Skip to content

Commit 096564b

Browse files
hsun324facebook-github-bot
authored andcommitted
Rename APP to RAFT_APPLICATION
Summary: Change the name of the macro used for the RAFT application name from `APP` to `RAFT_APPLICATION` as `APP` is a bit too short of a name to be using in a general header. Reviewed By: jaher Differential Revision: D78371737 fbshipit-source-id: 46732460eb1b6448fdbb00ce3243e45d16674cad
1 parent 7f2bc74 commit 096564b

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

include/wa_raft.hrl

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
%%%
66
%%% This file defines general macros and data structures shared across modules.
77

8-
-define(APP, wa_raft).
8+
%% The name of the RAFT application.
9+
-define(RAFT_APPLICATION, wa_raft).
910

1011
%%-------------------------------------------------------------------
1112
%% Registered information about applications and partitions
@@ -78,7 +79,7 @@
7879
%% Metrics
7980
%%-------------------------------------------------------------------
8081

81-
-define(RAFT_METRICS_MODULE_KEY, {?APP, raft_metrics_module}).
82+
-define(RAFT_METRICS_MODULE_KEY, {?RAFT_APPLICATION, raft_metrics_module}).
8283
-define(RAFT_METRICS_MODULE, (persistent_term:get(?RAFT_METRICS_MODULE_KEY, wa_raft_metrics))).
8384
-define(RAFT_COUNT(Metric), ?RAFT_METRICS_MODULE:count(Metric)).
8485
-define(RAFT_COUNTV(Metric, Value), ?RAFT_METRICS_MODULE:countv(Metric, Value)).
@@ -90,8 +91,8 @@
9091
%%-------------------------------------------------------------------
9192

9293
%% Get global config
93-
-define(RAFT_CONFIG(Name), (application:get_env(?APP, Name))).
94-
-define(RAFT_CONFIG(Name, Default), (application:get_env(?APP, Name, Default))).
94+
-define(RAFT_CONFIG(Name), (application:get_env(?RAFT_APPLICATION, Name))).
95+
-define(RAFT_CONFIG(Name, Default), (application:get_env(?RAFT_APPLICATION, Name, Default))).
9596

9697
%% Default metrics module
9798
-define(RAFT_METRICS_MODULE(), ?RAFT_CONFIG(raft_metrics_module)).

src/wa_raft_env.erl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ get_env(Scope, Key, Default) ->
5454

5555
-spec get_env_impl(SearchApps :: [atom()], Key :: atom(), FallbackKey :: atom()) -> {ok, Value :: dynamic()} | undefined.
5656
get_env_impl([], _Key, FallbackKey) ->
57-
application:get_env(?APP, FallbackKey);
57+
?RAFT_CONFIG(FallbackKey);
5858
get_env_impl([App | SearchApps], Key, FallbackKey) ->
5959
case application:get_env(App, Key) of
6060
{ok, Value} -> {ok, Value};

src/wa_raft_sup.erl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ default_name(Application) ->
149149

150150
-spec default_config_apps(Application :: atom()) -> [atom()].
151151
default_config_apps(Application) ->
152-
[Application, ?APP].
152+
[Application, ?RAFT_APPLICATION].
153153

154154
-spec registered_config_apps(Application :: atom()) -> [atom()].
155155
registered_config_apps(Application) ->

0 commit comments

Comments
 (0)