Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .env
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
OTP_VERSION=24.3.4
REBAR_VERSION=3.18
OTP_VERSION=27.1.2
REBAR_VERSION=3.24
THRIFT_VERSION=0.14.2.3
# DATABASE_URL=postgresql://postgres:postgres@dmt-db/dmt
2 changes: 1 addition & 1 deletion .tool-versions
Original file line number Diff line number Diff line change
@@ -1 +1 @@
erlang 24.3.4
erlang 27.1.2
2 changes: 1 addition & 1 deletion compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ services:
command: /sbin/init

dmt:
image: ghcr.io/valitydev/dominant-v2:sha-f8163a0-epic-fixes_for_client
image: ghcr.io/valitydev/dominant-v2:sha-793b108-epic-fixes_for_client
command: /opt/dmt/bin/dmt foreground
healthcheck:
test: "/opt/dmt/bin/dmt ping"
Expand Down
18 changes: 7 additions & 11 deletions config/dominant/sys.config
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,12 @@
{log_level, debug},
{logger, [
{handler, default, logger_std_h, #{
level =>
all,
level => all,
config => #{
type =>
{file, "/var/log/dmt/console.json"},
sync_mode_qlen =>
20
type => standard_io
}
% formatter =>
% {logger_logstash_formatter, #{}}
%% formatter =>
%% {logger_logstash_formatter, #{}}
}}
]}
]},
Expand All @@ -34,8 +30,8 @@
repository_client => #{
url => <<"http://dmt:8022/v1/domain/repository_client">>
},
user_op => #{
url => <<"http://dmt:8022/v1/domain/user_op">>
author => #{
url => <<"http://dmt:8022/v1/domain/author">>
}
}}
]},
Expand All @@ -59,7 +55,7 @@
database => default_db,
size => 10
},
user_op_pool => #{
author_pool => #{
database => default_db,
size => 10
}
Expand Down
16 changes: 4 additions & 12 deletions rebar.config
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@

%% Common project dependencies.
{deps, [
{genlib, {git, "https://github.com/valitydev/genlib.git", {branch, "master"}}},
{prometheus, "4.6.0"},
{woody, {git, "https://github.com/valitydev/woody_erlang.git", {branch, "master"}}},
{genlib, {git, "https://github.com/valitydev/genlib.git", {tag, "v1.1.0"}}},
{prometheus, "4.11.0"},
{woody, {git, "https://github.com/valitydev/woody_erlang.git", {tag, "v1.1.0"}}},
{damsel, {git, "https://github.com/valitydev/damsel.git", {branch, "IMP-281/dmt_v2_proto"}}}
]}.

Expand All @@ -48,7 +48,6 @@
% mandatory
unmatched_returns,
error_handling,
% NOTE 'race_conditions' was removed https://www.erlang.org/doc/apps/dialyzer/notes#dialyzer-5.0
unknown
]},
{plt_apps, all_deps}
Expand All @@ -70,7 +69,7 @@
{project_plugins, [
{rebar3_lint, "3.2.6"},
{erlfmt, "1.5.0"},
{covertool, "2.0.6"}
{covertool, "2.0.7"}
]}.

%% Linter config.
Expand All @@ -87,10 +86,3 @@
"ct.coverdata"
]}
]}.

%% NOTE
%% It is needed to use rebar3 lint plugin
{overrides, [
{del, accept, [{plugins, [{rebar3_archive_plugin, "0.0.2"}]}]},
{del, prometheus, [{plugins, [{rebar3_archive_plugin, "0.0.1"}]}]}
]}.
17 changes: 10 additions & 7 deletions rebar.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@
{<<"cowlib">>,{pkg,<<"cowlib">>,<<"2.11.0">>},2},
{<<"damsel">>,
{git,"https://github.com/valitydev/damsel.git",
{ref,"91cb04e9aa265aab3fb4d42daa5eb95b5019c744"}},
{ref,"0c0c0bcb6376a4ba62dc0565434cda7bbd081f20"}},
0},
{<<"dmt_core">>,
{git,"https://github.com/valitydev/dmt-core.git",
{ref,"19d8f57198f2cbe5b64aa4a923ba32774e505503"}},
0},
{<<"genlib">>,
{git,"https://github.com/valitydev/genlib.git",
{ref,"f6074551d6586998e91a97ea20acb47241254ff3"}},
{ref,"d2324089afbbd9630e85fac554620f1de0b33dfe"}},
0},
{<<"gproc">>,{pkg,<<"gproc">>,<<"0.9.0">>},1},
{<<"hackney">>,{pkg,<<"hackney">>,<<"1.18.0">>},1},
Expand All @@ -25,7 +25,8 @@
{pkg,<<"opentelemetry_semantic_conventions">>,<<"0.2.0">>},
2},
{<<"parse_trans">>,{pkg,<<"parse_trans">>,<<"3.3.1">>},2},
{<<"prometheus">>,{pkg,<<"prometheus">>,<<"4.6.0">>},0},
{<<"prometheus">>,{pkg,<<"prometheus">>,<<"4.11.0">>},0},
{<<"quantile_estimator">>,{pkg,<<"quantile_estimator">>,<<"0.2.1">>},1},
{<<"ranch">>,{pkg,<<"ranch">>,<<"1.8.0">>},2},
{<<"snowflake">>,
{git,"https://github.com/valitydev/snowflake.git",
Expand All @@ -34,12 +35,12 @@
{<<"ssl_verify_fun">>,{pkg,<<"ssl_verify_fun">>,<<"1.1.7">>},2},
{<<"thrift">>,
{git,"https://github.com/valitydev/thrift_erlang.git",
{ref,"c280ff266ae1c1906fb0dcee8320bb8d8a4a3c75"}},
{ref,"3a60e5dc5bbd709495024f26e100b041c3547fd9"}},
1},
{<<"unicode_util_compat">>,{pkg,<<"unicode_util_compat">>,<<"0.7.0">>},2},
{<<"woody">>,
{git,"https://github.com/valitydev/woody_erlang.git",
{ref,"072825ee7179825a4078feb0649df71303c74157"}},
{ref,"cc983a9423325ba1d6a509775eb6ff7ace721539"}},
0}]}.
[
{pkg_hash,[
Expand All @@ -55,7 +56,8 @@
{<<"opentelemetry_api">>, <<"7B69ED4F40025C005DE0B74FCE8C0549625D59CB4DF12D15C32FE6DC5076FF42">>},
{<<"opentelemetry_semantic_conventions">>, <<"B67FE459C2938FCAB341CB0951C44860C62347C005ACE1B50F8402576F241435">>},
{<<"parse_trans">>, <<"16328AB840CC09919BD10DAB29E431DA3AF9E9E7E7E6F0089DD5A2D2820011D8">>},
{<<"prometheus">>, <<"20510F381DB1CCAB818B4CF2FAC5FA6AB5CC91BC364A154399901C001465F46F">>},
{<<"prometheus">>, <<"B95F8DE8530F541BD95951E18E355A840003672E5EDA4788C5FA6183406BA29A">>},
{<<"quantile_estimator">>, <<"EF50A361F11B5F26B5F16D0696E46A9E4661756492C981F7B2229EF42FF1CD15">>},
{<<"ranch">>, <<"8C7A100A139FD57F17327B6413E4167AC559FBC04CA7448E9BE9057311597A1D">>},
{<<"ssl_verify_fun">>, <<"354C321CF377240C7B8716899E182CE4890C5938111A1296ADD3EC74CF1715DF">>},
{<<"unicode_util_compat">>, <<"BC84380C9AB48177092F43AC89E4DFA2C6D62B40B8BD132B1059ECC7232F9A78">>}]},
Expand All @@ -72,7 +74,8 @@
{<<"opentelemetry_api">>, <<"6D7A27B7CAD2AD69A09CABF6670514CAFCEC717C8441BEB5C96322BAC3D05350">>},
{<<"opentelemetry_semantic_conventions">>, <<"D61FA1F5639EE8668D74B527E6806E0503EFC55A42DB7B5F39939D84C07D6895">>},
{<<"parse_trans">>, <<"07CD9577885F56362D414E8C4C4E6BDF10D43A8767ABB92D24CBE8B24C54888B">>},
{<<"prometheus">>, <<"4905FD2992F8038ECCD7AA0CD22F40637ED618C0BED1F75C05AACEC15B7545DE">>},
{<<"prometheus">>, <<"719862351AABF4DF7079B05DC085D2BBCBE3AC0AC3009E956671B1D5AB88247D">>},
{<<"quantile_estimator">>, <<"282A8A323CA2A845C9E6F787D166348F776C1D4A41EDE63046D72D422E3DA946">>},
{<<"ranch">>, <<"49FBCFD3682FAB1F5D109351B61257676DA1A2FDBE295904176D5E521A2DDFE5">>},
{<<"ssl_verify_fun">>, <<"FE4C190E8F37401D30167C8C405EDA19469F34577987C76DDE613E838BBC67F8">>},
{<<"unicode_util_compat">>, <<"25EEE6D67DF61960CF6A794239566599B09E17E668D3700247BC498638152521">>}]}
Expand Down
56 changes: 28 additions & 28 deletions src/dmt_client.erl
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
-export([commit/4]).
-export([get_last_version/0]).

% UserOpManagement API
% AuthorManagement API

-export([user_op_create/2]).
-export([user_op_get/1]).
-export([user_op_delete/1]).
-export([author_create/2]).
-export([author_get/1]).
-export([author_delete/1]).

%% Health check API
-export([health_check/0]).
Expand All @@ -35,23 +35,23 @@
-export_type([version/0]).
-export_type([base_version/0]).
-export_type([versioned_object/0]).
-export_type([commit/0]).
-export_type([operation/0]).
-export_type([commit_response/0]).
-export_type([object_ref/0]).
-export_type([domain_object/0]).
-export_type([opts/0]).

-export_type([user_op_id/0]).
-export_type([user_op/0]).
-export_type([user_op_params/0]).
-export_type([author_id/0]).
-export_type([author/0]).
-export_type([author_params/0]).

-include_lib("damsel/include/dmsl_domain_conf_v2_thrift.hrl").

-type vsn() :: {version, non_neg_integer()} | {head, dmsl_domain_conf_v2_thrift:'Head'()}.
-type vsn_created_at() :: dmsl_base_thrift:'Timestamp'().
-type version() :: base_version() | latest.
-type base_version() :: non_neg_integer().
-type commit() :: dmsl_domain_conf_v2_thrift:'Commit'().
-type operation() :: dmsl_domain_conf_v2_thrift:'Operation'().
-type object_ref() :: dmsl_domain_thrift:'Reference'().
-type versioned_object() :: dmsl_domain_conf_v2_thrift:'VersionedObject'().
-type domain_object() :: dmsl_domain_thrift:'ReflessDomainObject'().
Expand All @@ -61,9 +61,9 @@
woody_context => woody_context:ctx()
}.

-type user_op_id() :: dmsl_domain_conf_v2_thrift:'UserOpID'().
-type user_op() :: dmsl_domain_conf_v2_thrift:'UserOp'().
-type user_op_params() :: dmsl_domain_conf_v2_thrift:'UserOpParams'().
-type author_id() :: dmsl_domain_conf_v2_thrift:'AuthorID'().
-type author() :: dmsl_domain_conf_v2_thrift:'Author'().
-type author_params() :: dmsl_domain_conf_v2_thrift:'AuthorParams'().

%%% API

Expand All @@ -83,31 +83,31 @@ do_checkout_object(ObjectReference, Reference, Opts) ->
Version = ref_to_version(Reference),
dmt_client_cache:get_object(ObjectReference, Version, Opts).

-spec commit(base_version(), commit(), user_op_id()) -> commit_response() | no_return().
commit(Version, Commit, UserOpID) ->
commit(Version, Commit, UserOpID, #{}).
-spec commit(base_version(), [operation()], author_id()) -> commit_response() | no_return().
commit(Version, Operations, AuthorID) ->
commit(Version, Operations, AuthorID, #{}).

-spec commit(base_version(), commit(), user_op_id(), opts()) -> commit_response() | no_return().
commit(Version, Commit, UserOpID, Opts) ->
dmt_client_backend:commit(Version, Commit, UserOpID, Opts).
-spec commit(base_version(), [operation()], author_id(), opts()) -> commit_response() | no_return().
commit(Version, Operations, AuthorID, Opts) ->
dmt_client_backend:commit(Version, Operations, AuthorID, Opts).

-spec get_last_version() -> number() | no_return().
get_last_version() ->
dmt_client_backend:get_last_version(#{}).

% UserOpManagement
% AuthorManagement

-spec user_op_create(user_op_params(), opts()) -> user_op().
user_op_create(Params, Opts) ->
dmt_client_user_op:create(Params, Opts).
-spec author_create(author_params(), opts()) -> author().
author_create(Params, Opts) ->
dmt_client_author:create(Params, Opts).

-spec user_op_get(user_op_id()) -> user_op().
user_op_get(ID) ->
dmt_client_user_op:get(ID).
-spec author_get(author_id()) -> author().
author_get(ID) ->
dmt_client_author:get(ID).

-spec user_op_delete(user_op_id()) -> ok.
user_op_delete(ID) ->
dmt_client_user_op:delete(ID).
-spec author_delete(author_id()) -> ok.
author_delete(ID) ->
dmt_client_author:delete(ID).

%% Health check API

Expand Down
8 changes: 4 additions & 4 deletions src/dmt_client_api.erl
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@

-spec commit(
dmt_client:vsn(),
dmt_client:commit(),
dmt_client:user_op_id(),
[dmt_client:operation()],
dmt_client:author_id(),
dmt_client:opts()
) ->
dmt_client:commit_response() | no_return().
commit(Version, Commit, UserOpID, Opts) ->
call('Repository', 'Commit', {Version, Commit, UserOpID}, Opts).
commit(Version, Operations, AuthorID, Opts) ->
call('Repository', 'Commit', {Version, Operations, AuthorID}, Opts).

-spec checkout_object(dmt_client:object_ref(), dmt_client:vsn(), dmt_client:opts()) ->
dmt_client:versioned_object() | no_return().
Expand Down
32 changes: 16 additions & 16 deletions src/dmt_client_user_op.erl → src/dmt_client_author.erl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
-module(dmt_client_user_op).
-module(dmt_client_author).

-include_lib("damsel/include/dmsl_domain_conf_v2_thrift.hrl").

Expand All @@ -9,35 +9,35 @@
delete/1
]).

-export_type([user_op/0]).
-export_type([user_op_params/0]).
-export_type([user_op_id/0]).
-export_type([author/0]).
-export_type([author_params/0]).
-export_type([author_id/0]).
-export_type([opts/0]).

-type user_op() :: dmt_client:user_op().
-type user_op_params() :: dmt_client:user_op_params().
-type user_op_id() :: dmt_client:user_op_id().
-type author() :: dmt_client:author().
-type author_params() :: dmt_client:author_params().
-type author_id() :: dmt_client:author_id().
-type opts() :: dmt_client:opts().

-spec create(user_op_params(), opts()) -> user_op() | no_return().
-spec create(author_params(), opts()) -> author() | no_return().
create(Params, Opts) ->
call('UserOpManagement', 'Create', {Params}, Opts).
call('AuthorManagement', 'Create', {Params}, Opts).

-spec get(user_op_id()) -> user_op() | no_return().
-spec get(author_id()) -> author() | no_return().
get(ID) ->
get(ID, #{}).

-spec get(user_op_id(), opts()) -> user_op() | no_return().
-spec get(author_id(), opts()) -> author() | no_return().
get(ID, Opts) ->
call('UserOpManagement', 'Get', {ID}, Opts).
call('AuthorManagement', 'Get', {ID}, Opts).

-spec delete(user_op_id()) -> ok | no_return().
-spec delete(author_id()) -> ok | no_return().
delete(ID) ->
delete(ID, #{}).

-spec delete(user_op_id(), opts()) -> ok | no_return().
-spec delete(author_id(), opts()) -> ok | no_return().
delete(ID, Opts) ->
call('UserOpManagement', 'Delete', {ID}, Opts).
call('AuthorManagement', 'Delete', {ID}, Opts).

%% Internal functions

Expand Down Expand Up @@ -86,7 +86,7 @@ get_service_url(ServiceName) ->
get_service_modname(ServiceName) ->
{get_service_module(ServiceName), ServiceName}.

get_service_module('UserOpManagement') ->
get_service_module('AuthorManagement') ->
dmsl_domain_conf_v2_thrift.

get_event_handlers() ->
Expand Down
12 changes: 6 additions & 6 deletions src/dmt_client_backend.erl
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@

-callback commit(
dmt_client:vsn(),
dmt_client:commit(),
dmt_client:user_op_id(),
[dmt_client:operation()],
dmt_client:author_id(),
dmt_client:opts()
) -> dmt_client:commit_response() | no_return().

Expand All @@ -20,12 +20,12 @@

-spec commit(
dmt_client:base_version(),
dmt_client:commit(),
dmt_client:user_op_id(),
[dmt_client:operation()],
dmt_client:author_id(),
dmt_client:opts()
) -> dmt_client:commit_response() | no_return().
commit(Version, Commit, UserOpID, Opts) ->
call(commit, [Version, Commit, UserOpID, Opts]).
commit(Version, Operations, AuthorID, Opts) ->
call(commit, [Version, Operations, AuthorID, Opts]).

-spec checkout_object(dmt_client:object_ref(), dmt_client:vsn(), dmt_client:opts()) ->
dmt_client:versioned_object() | no_return().
Expand Down
Loading
Loading