From 8d9f6f2a9825674d1798757b5ceaa576dc9624ea Mon Sep 17 00:00:00 2001 From: niamtokik Date: Thu, 2 Nov 2023 16:44:09 +0000 Subject: [PATCH] first commit --- .gitignore | 20 +++++++++++ LICENSE.md | 20 +++++++++++ README.md | 9 +++++ .../src/mnesia_backends.app.src | 15 ++++++++ .../src/mnesia_backends_app.erl | 18 ++++++++++ .../src/mnesia_backends_sup.erl | 35 +++++++++++++++++++ config/sys.config | 3 ++ config/vm.args | 6 ++++ rebar.config | 32 +++++++++++++++++ 9 files changed, 158 insertions(+) create mode 100644 .gitignore create mode 100644 LICENSE.md create mode 100644 README.md create mode 100644 apps/mnesia_backends/src/mnesia_backends.app.src create mode 100644 apps/mnesia_backends/src/mnesia_backends_app.erl create mode 100644 apps/mnesia_backends/src/mnesia_backends_sup.erl create mode 100644 config/sys.config create mode 100644 config/vm.args create mode 100644 rebar.config diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..df53f7d --- /dev/null +++ b/.gitignore @@ -0,0 +1,20 @@ +.rebar3 +_build +_checkouts +_vendor +.eunit +*.o +*.beam +*.plt +*.swp +*.swo +.erlang.cookie +ebin +log +erl_crash.dump +.rebar +logs +.idea +*.iml +rebar3.crashdump +*~ diff --git a/LICENSE.md b/LICENSE.md new file mode 100644 index 0000000..41a32ab --- /dev/null +++ b/LICENSE.md @@ -0,0 +1,20 @@ +Copyright 2023 Erlang Punch + +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. diff --git a/README.md b/README.md new file mode 100644 index 0000000..22b5293 --- /dev/null +++ b/README.md @@ -0,0 +1,9 @@ +mnesia_backends +===== + +An OTP application + +Build +----- + + $ rebar3 compile diff --git a/apps/mnesia_backends/src/mnesia_backends.app.src b/apps/mnesia_backends/src/mnesia_backends.app.src new file mode 100644 index 0000000..d371ffd --- /dev/null +++ b/apps/mnesia_backends/src/mnesia_backends.app.src @@ -0,0 +1,15 @@ +{application, mnesia_backends, + [{description, "An OTP application"}, + {vsn, "0.1.0"}, + {registered, []}, + {mod, {mnesia_backends_app, []}}, + {applications, + [kernel, + stdlib + ]}, + {env,[]}, + {modules, []}, + + {licenses, ["Apache-2.0"]}, + {links, []} + ]}. diff --git a/apps/mnesia_backends/src/mnesia_backends_app.erl b/apps/mnesia_backends/src/mnesia_backends_app.erl new file mode 100644 index 0000000..f1bc78c --- /dev/null +++ b/apps/mnesia_backends/src/mnesia_backends_app.erl @@ -0,0 +1,18 @@ +%%%------------------------------------------------------------------- +%% @doc mnesia_backends public API +%% @end +%%%------------------------------------------------------------------- + +-module(mnesia_backends_app). + +-behaviour(application). + +-export([start/2, stop/1]). + +start(_StartType, _StartArgs) -> + mnesia_backends_sup:start_link(). + +stop(_State) -> + ok. + +%% internal functions diff --git a/apps/mnesia_backends/src/mnesia_backends_sup.erl b/apps/mnesia_backends/src/mnesia_backends_sup.erl new file mode 100644 index 0000000..5a9f06a --- /dev/null +++ b/apps/mnesia_backends/src/mnesia_backends_sup.erl @@ -0,0 +1,35 @@ +%%%------------------------------------------------------------------- +%% @doc mnesia_backends top level supervisor. +%% @end +%%%------------------------------------------------------------------- + +-module(mnesia_backends_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 diff --git a/config/sys.config b/config/sys.config new file mode 100644 index 0000000..05b1160 --- /dev/null +++ b/config/sys.config @@ -0,0 +1,3 @@ +[ + {mnesia_backends, []} +]. diff --git a/config/vm.args b/config/vm.args new file mode 100644 index 0000000..b7be73b --- /dev/null +++ b/config/vm.args @@ -0,0 +1,6 @@ +-sname mnesia_backends + +-setcookie mnesia_backends_cookie + ++K true ++A30 diff --git a/rebar.config b/rebar.config new file mode 100644 index 0000000..2f91a8f --- /dev/null +++ b/rebar.config @@ -0,0 +1,32 @@ +{erl_opts, [debug_info]}. +{deps, []}. + +{relx, [{release, {mnesia_backends, "0.1.0"}, + [mnesia_backends, + sasl]}, + + {mode, dev}, + + %% automatically picked up if the files + %% exist but can be set manually, which + %% is required if the names aren't exactly + %% sys.config and vm.args + {sys_config, "./config/sys.config"}, + {vm_args, "./config/vm.args"} + + %% the .src form of the configuration files do + %% not require setting RELX_REPLACE_OS_VARS + %% {sys_config_src, "./config/sys.config.src"}, + %% {vm_args_src, "./config/vm.args.src"} +]}. + +{profiles, [{prod, [{relx, + [%% prod is the default mode when prod + %% profile is used, so does not have + %% to be explicitly included like this + {mode, prod} + + %% use minimal mode to exclude ERTS + %% {mode, minimal} + ] + }]}]}.