Bleh
This commit is contained in:
parent
3dfa14d20c
commit
c26f6737dc
18
TODO
18
TODO
@ -2,11 +2,23 @@
|
|||||||
On redirect a list of hosts of the form [{zx:host(), [zx:realm()]}] must be provided to the downstream client.
|
On redirect a list of hosts of the form [{zx:host(), [zx:realm()]}] must be provided to the downstream client.
|
||||||
This is the only way that downstream clients can determine which redirect hosts are useful to it.
|
This is the only way that downstream clients can determine which redirect hosts are useful to it.
|
||||||
|
|
||||||
- Connect attempts and established connections should have different report statuses.
|
- Change zx_daemon request references to counters.
|
||||||
An established connection does not necessarily have other attempts being made concurrently, so a termination should initiate 3 new connect attempts as init.
|
Count everything.
|
||||||
An attempt is just an attempt. It can fall flat and be replaced only 1::1.
|
This will be the only way to sort of track stats other than log analysis.
|
||||||
|
Log analysis sucks.
|
||||||
|
|
||||||
|
- Double-indexing must happen everywhere for anything to be discoverable without traversing the entire state of zx_daemon whenever a client or conn crashes.
|
||||||
|
|
||||||
|
- zx_daemon request() types have been changes to flat, wide tuples as in the main zx module.
|
||||||
|
This change is not yet refected in the using code.
|
||||||
|
|
||||||
|
- Write a logging process.
|
||||||
|
Pick a log rotation scheme.
|
||||||
|
Eventually make it so that it can shed log loads in the event they get out of hand.
|
||||||
|
|
||||||
|
|
||||||
|
- Create zx_daemon primes.
|
||||||
|
See below
|
||||||
|
|
||||||
New Feature: ZX Universal lock
|
New Feature: ZX Universal lock
|
||||||
Cross-instance communication
|
Cross-instance communication
|
||||||
|
|||||||
@ -50,7 +50,7 @@
|
|||||||
-type option() :: {string(), term()}.
|
-type option() :: {string(), term()}.
|
||||||
-type host() :: {string() | inet:ip_address(), inet:port_number()}.
|
-type host() :: {string() | inet:ip_address(), inet:port_number()}.
|
||||||
-type key_id() :: {realm(), key_name()}.
|
-type key_id() :: {realm(), key_name()}.
|
||||||
-type key_name() :: label().
|
-type key_name() :: lower0_9().
|
||||||
-type user() :: {realm(), username()}.
|
-type user() :: {realm(), username()}.
|
||||||
-type username() :: label().
|
-type username() :: label().
|
||||||
-type lower0_9() :: [$a..$z | $0..$9 | $_].
|
-type lower0_9() :: [$a..$z | $0..$9 | $_].
|
||||||
|
|||||||
@ -11,7 +11,7 @@
|
|||||||
-copyright("Craig Everett <zxq9@zxq9.com>").
|
-copyright("Craig Everett <zxq9@zxq9.com>").
|
||||||
-license("GPL-3.0").
|
-license("GPL-3.0").
|
||||||
|
|
||||||
-export([start_monitor/1, stop/1]).
|
-export([start/1, stop/1]).
|
||||||
-export([start_link/1]).
|
-export([start_link/1]).
|
||||||
|
|
||||||
-include("zx_logger.erl").
|
-include("zx_logger.erl").
|
||||||
@ -20,24 +20,17 @@
|
|||||||
|
|
||||||
%%% Startup
|
%%% Startup
|
||||||
|
|
||||||
-spec start_monitor(Target) -> Result
|
-spec start(Target) -> Result
|
||||||
when Target :: zx:host(),
|
when Target :: zx:host(),
|
||||||
Result :: {ok, PID :: pid(), Mon :: reference()}
|
Result :: {ok, pid()}
|
||||||
| {error, Reason},
|
| {error, Reason :: term()}.
|
||||||
Reason :: term().
|
|
||||||
%% @doc
|
%% @doc
|
||||||
%% Starts a connection to a given target Zomp node. This call itself should never fail,
|
%% Starts a connection to a given target Zomp node. This call itself should never fail,
|
||||||
%% but this process may fail to connect or crash immediately after spawning. Should
|
%% but this process may fail to connect or crash immediately after spawning. Should
|
||||||
%% only be called by zx_daemon.
|
%% only be called by zx_daemon.
|
||||||
|
|
||||||
start_monitor(Target) ->
|
start(Target) ->
|
||||||
case zx_conn_sup:start_conn(Target) of
|
zx_conn_sup:start_conn(Target).
|
||||||
{ok, Pid} ->
|
|
||||||
Mon = monitor(process, Pid),
|
|
||||||
{ok, Pid, Mon};
|
|
||||||
Error ->
|
|
||||||
Error
|
|
||||||
end.
|
|
||||||
|
|
||||||
|
|
||||||
-spec stop(Conn :: pid()) -> ok.
|
-spec stop(Conn :: pid()) -> ok.
|
||||||
@ -49,16 +42,24 @@ stop(Conn) ->
|
|||||||
ok.
|
ok.
|
||||||
|
|
||||||
|
|
||||||
-spec subscribe(Conn, Realm) -> ok
|
-spec subscribe(Conn, Package) -> ok
|
||||||
when Conn :: pid(),
|
when Conn :: pid(),
|
||||||
Realm :: zx:realm(),
|
Package :: zx:package().
|
||||||
Result :: ok.
|
|
||||||
|
|
||||||
subscribe(Conn, Realm) ->
|
subscribe(Conn, Realm) ->
|
||||||
Conn ! {subscribe, Realm},
|
Conn ! {subscribe, Realm},
|
||||||
ok.
|
ok.
|
||||||
|
|
||||||
|
|
||||||
|
-spec unsubscribe(Conn, Package) -> ok
|
||||||
|
when Conn :: pid(),
|
||||||
|
Package :: zx:package().
|
||||||
|
|
||||||
|
unsubscribe(Conn, Package) ->
|
||||||
|
Conn ! {unsubscribe, Package},
|
||||||
|
ok.
|
||||||
|
|
||||||
|
|
||||||
-spec start_link(Target) ->
|
-spec start_link(Target) ->
|
||||||
when Target :: zx:host(),
|
when Target :: zx:host(),
|
||||||
Result :: {ok, pid()}
|
Result :: {ok, pid()}
|
||||||
@ -172,6 +173,9 @@ loop(Parent, Debug, Socket) ->
|
|||||||
ok = handle(Bin, Socket),
|
ok = handle(Bin, Socket),
|
||||||
ok = inet:setopts(Socket, [{active, once}]),
|
ok = inet:setopts(Socket, [{active, once}]),
|
||||||
loop(Parent, Debug, Socket);
|
loop(Parent, Debug, Socket);
|
||||||
|
{subscribe, Package} ->
|
||||||
|
{unsubscribe, Package} ->
|
||||||
|
|
||||||
stop ->
|
stop ->
|
||||||
ok = zx_net:disconnect(Socket),
|
ok = zx_net:disconnect(Socket),
|
||||||
terminate();
|
terminate();
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@ -14,13 +14,12 @@
|
|||||||
-copyright("Craig Everett <zxq9@zxq9.com>").
|
-copyright("Craig Everett <zxq9@zxq9.com>").
|
||||||
-license("GPL-3.0").
|
-license("GPL-3.0").
|
||||||
|
|
||||||
|
|
||||||
-export([zomp_home/0, find_zomp_home/0,
|
-export([zomp_home/0, find_zomp_home/0,
|
||||||
hosts_cache_file/1, get_prime/1, realm_meta/1,
|
hosts_cache_file/1, get_prime/1, realm_meta/1,
|
||||||
read_project_meta/0, read_project_meta/1, read_package_meta/1,
|
read_project_meta/0, read_project_meta/1, read_package_meta/1,
|
||||||
write_project_meta/1, write_project_meta/2,
|
write_project_meta/1, write_project_meta/2,
|
||||||
write_terms/2,
|
write_terms/2,
|
||||||
valid_lower0_9/1, valid_label/1,
|
valid_lower0_9/1, valid_label/1, valid_version/1,
|
||||||
string_to_version/1, version_to_string/1,
|
string_to_version/1, version_to_string/1,
|
||||||
package_id/1, package_string/1,
|
package_id/1, package_string/1,
|
||||||
package_dir/1, package_dir/2,
|
package_dir/1, package_dir/2,
|
||||||
@ -139,7 +138,7 @@ read_project_meta(Dir) ->
|
|||||||
| {error, file:posix()}.
|
| {error, file:posix()}.
|
||||||
|
|
||||||
read_package_meta({Realm, Name, Version}) ->
|
read_package_meta({Realm, Name, Version}) ->
|
||||||
VersionString = Version,
|
{ok, VersionString} = version_to_string(Version),
|
||||||
Path = filename:join([zomp_home(), "lib", Realm, Name, VersionString]),
|
Path = filename:join([zomp_home(), "lib", Realm, Name, VersionString]),
|
||||||
read_project_meta(Path).
|
read_project_meta(Path).
|
||||||
|
|
||||||
@ -250,6 +249,26 @@ valid_label(_, _) ->
|
|||||||
false.
|
false.
|
||||||
|
|
||||||
|
|
||||||
|
-spec valid_version(zx:version()) -> boolean().
|
||||||
|
|
||||||
|
valid_version({z, z, z}) ->
|
||||||
|
true;
|
||||||
|
valid_version({X, z, z})
|
||||||
|
when is_integer(X), X >= 0 ->
|
||||||
|
true;
|
||||||
|
valid_version({X, Y, z})
|
||||||
|
when is_integer(X), X >= 0,
|
||||||
|
is_integer(Y), Y >= 0 ->
|
||||||
|
true;
|
||||||
|
valid_version({X, Y, Z})
|
||||||
|
when is_integer(X), X >= 0,
|
||||||
|
is_integer(Y), Y >= 0,
|
||||||
|
is_integer(Z), Z >= 0 ->
|
||||||
|
true;
|
||||||
|
valid_version(_) ->
|
||||||
|
false.
|
||||||
|
|
||||||
|
|
||||||
-spec string_to_version(VersionString) -> Result
|
-spec string_to_version(VersionString) -> Result
|
||||||
when VersionString :: string(),
|
when VersionString :: string(),
|
||||||
Result :: {ok, zx:version()}
|
Result :: {ok, zx:version()}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user