@ -0,0 +1,29 @@ | |||||
.eunit | |||||
*.o | |||||
*.beam | |||||
*.plt | |||||
erl_crash.dump | |||||
.concrete/DEV_MODE | |||||
# rebar 2.x | |||||
.rebar | |||||
rel/example_project | |||||
ebin/* | |||||
deps | |||||
# rebar 3 | |||||
.rebar3 | |||||
_build/ | |||||
_checkouts/ | |||||
rebar.lock | |||||
# idea | |||||
.idea | |||||
*.iml | |||||
cmake-build* | |||||
CMakeLists.txt | |||||
# nif compile temp file | |||||
*.pdb | |||||
*.d | |||||
compile_commands.json |
@ -0,0 +1,21 @@ | |||||
MIT License | |||||
Copyright (c) 2022 AICells | |||||
Permission is hereby granted, free of charge, to any person obtaining a copy | |||||
of this software and associated documentation files (the "Software"), to deal | |||||
in the Software without restriction, including without limitation the rights | |||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |||||
copies of the Software, and to permit persons to whom the Software is | |||||
furnished to do so, subject to the following conditions: | |||||
The above copyright notice and this permission notice shall be included in all | |||||
copies or substantial portions of the Software. | |||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | |||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | |||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | |||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | |||||
SOFTWARE. |
@ -0,0 +1,9 @@ | |||||
ranks | |||||
===== | |||||
排行榜 | |||||
Build | |||||
----- | |||||
$ rebar3 compile |
@ -0,0 +1,7 @@ | |||||
-ifndef(RANKS_H_). | |||||
-define(RANKS_H_, true). | |||||
-endif. |
@ -0,0 +1,10 @@ | |||||
{erl_opts, [no_debug_info, {i, "include"}]}. | |||||
{deps, [ | |||||
{eGbh, ".*", {git, "http://sismaker.tpddns.cn:53000/SisMaker/eGbh.git", {branch, "master"}}}, | |||||
{eSync, ".*", {git, "http://sismaker.tpddns.cn:53000/SisMaker/eSync.git", {branch, "master"}}} | |||||
]}. | |||||
{shell, [ | |||||
% {config, "config/sys.config"}, | |||||
{apps, [ranks]} | |||||
]}. |
@ -0,0 +1,5 @@ | |||||
-module(rankMgr). | |||||
-behavior(gen_srv). | |||||
-export([]). |
@ -0,0 +1,5 @@ | |||||
-module(rankWork). | |||||
-behavior(gen_srv). | |||||
-export([]). |
@ -0,0 +1,12 @@ | |||||
{application, ranks, | |||||
[{description, "An OTP application"}, | |||||
{vsn, "0.1.0"}, | |||||
{registered, []}, | |||||
{mod, {ranks_app, []}}, | |||||
{applications, [kernel, stdlib]}, | |||||
{env,[]}, | |||||
{modules, []}, | |||||
{licenses, ["MIT"]}, | |||||
{links, []} | |||||
]}. |
@ -0,0 +1,33 @@ | |||||
-module(ranks). | |||||
-export([ | |||||
start/0 | |||||
, stop/0 | |||||
, | |||||
, initRank/1 %% 创建新的排行榜 | |||||
, updateScore/3 %% 更新分数 | |||||
, updateInfo/2 %% 更新其他分数 | |||||
, getRankInfo/3 %% 获取排行某页的信息 | |||||
]). | |||||
start() -> | |||||
application:ensure_all_started(ranks). | |||||
stop() -> | |||||
application:stop(ranks). | |||||
startWork(Cnt) -> | |||||
ok. | |||||
initRank(RankType) -> | |||||
ok. | |||||
updateScore(RankType, Key, Score) -> | |||||
ok. | |||||
updateInfo(Key, Infos) -> | |||||
ok. | |||||
getRankInfo(RankType, Cnt, PageInfo) -> | |||||
ok. | |||||
@ -0,0 +1,11 @@ | |||||
-module(ranks_app). | |||||
-behaviour(application). | |||||
-export([start/2, stop/1]). | |||||
start(_StartType, _StartArgs) -> | |||||
ranks_sup:start_link(). | |||||
stop(_State) -> | |||||
ok. |
@ -0,0 +1,30 @@ | |||||
-module(ranks_sup). | |||||
-behaviour(supervisor). | |||||
-export([start_link/0]). | |||||
-export([init/1]). | |||||
-define(SERVER, ?MODULE). | |||||
start_link() -> | |||||
supervisor:start_link({local, ?SERVER}, ?MODULE, []). | |||||
%% sup_flags() = #{strategy => strategy(), % optional | |||||
%% intensity => non_neg_integer(), % optional | |||||
%% period => pos_integer()} % optional | |||||
%% child_spec() = #{id => child_id(), % mandatory | |||||
%% start => mfargs(), % mandatory | |||||
%% restart => restart(), % optional | |||||
%% shutdown => shutdown(), % optional | |||||
%% type => worker(), % optional | |||||
%% modules => modules()} % optional | |||||
init([]) -> | |||||
SupFlags = #{strategy => one_for_all, | |||||
intensity => 0, | |||||
period => 1}, | |||||
ChildSpecs = [], | |||||
{ok, {SupFlags, ChildSpecs}}. | |||||
%% internal functions |