First commit
This commit is contained in:
@@ -0,0 +1,98 @@
|
||||
-module(gmhc_config_schema).
|
||||
|
||||
-export([ schema/0
|
||||
, to_json/0 ]).
|
||||
|
||||
-import(gmconfig_schema_helpers,
|
||||
[ str/1
|
||||
, str/2
|
||||
, pos_int/2
|
||||
, int/2
|
||||
, bool/2
|
||||
, obj/1
|
||||
, obj/2
|
||||
, array/2
|
||||
, schema_init/0
|
||||
]).
|
||||
|
||||
-define(ACCOUNT_PATTERN, <<"^ak_[1-9A-HJ-NP-Za-km-z]*$">>).
|
||||
-define(CONTRACT_PATTERN, <<"^ct_[1-9A-HJ-NP-Za-km-z]*$">>).
|
||||
|
||||
to_json() ->
|
||||
json:encode(schema()).
|
||||
|
||||
schema() ->
|
||||
obj(schema_init(),
|
||||
#{
|
||||
pubkey => str(#{pattern => ?ACCOUNT_PATTERN},
|
||||
<<"Primary client pubkey">>)
|
||||
, extra_pubkeys => array(#{ description =>
|
||||
<<"Additional miner pubkeys, sharing rewards">>
|
||||
, default => []
|
||||
},
|
||||
str(#{pattern => ?ACCOUNT_PATTERN}))
|
||||
, type => str(#{ enum => [<<"miner">>, <<"monitor">>]
|
||||
, default => <<"miner">>
|
||||
, description => <<"monitor mode can be used to see if a pool is alive">>})
|
||||
, pool => pool()
|
||||
, pool_admin => pool_admin()
|
||||
, workers => workers()
|
||||
}).
|
||||
|
||||
pool() ->
|
||||
obj(#{
|
||||
id => str(#{ pattern => ?CONTRACT_PATTERN},
|
||||
<<"Pool contract id">>),
|
||||
host => str(#{ default => <<"127.0.0.1">>
|
||||
, example => <<"0.0.0.0">>
|
||||
, description => <<"Hostname of hive server">> })
|
||||
, port => pos_int(17888, <<"Hive server listen port">>)
|
||||
}).
|
||||
|
||||
pool_admin() ->
|
||||
obj(#{
|
||||
url => str(#{ default => <<"https://test.gajumining.com/api/workers/{CLIENT_ID}">>
|
||||
, description => <<"URL of Eureka worker api">> })
|
||||
}).
|
||||
|
||||
workers() ->
|
||||
array(
|
||||
#{default => [#{executable => <<"mean29-generic">>}],
|
||||
description =>
|
||||
<<"Definitions of workers' configurations. If no worker are configured one worker "
|
||||
"is used as default, i.e. 'mean29-generic' executable without any extra args.">>},
|
||||
obj(#{required => [<<"executable">>]},
|
||||
#{executable =>
|
||||
str(#{default => <<"mean29-generic">>,
|
||||
description =>
|
||||
<<"Executable binary of the worker. Options are: \"mean29-generic\""
|
||||
" (memory-intensive), "
|
||||
"\"mean29-avx2\" (memory-intensive, benefits from faster CPU supporting"
|
||||
" AVX2 instructions), "
|
||||
"\"lean29-generic\" (CPU-intensive, useful if memory-constrained), "
|
||||
"\"lean29-avx2\" (CPU-intensive, useful if memory-constrained, benefits "
|
||||
"from faster CPU supporting AVX2 instructions).">>}),
|
||||
executable_group =>
|
||||
str(#{description => <<"Group of executable binaries of the worker.">>,
|
||||
enum => [ <<"aecuckoo">>, <<"aecuckooprebuilt">>, <<"gmcuckkoo">>, <<"cuda">>, <<"gajumine">> ],
|
||||
default => <<"aecuckoo">>}),
|
||||
extra_args =>
|
||||
str(#{description => <<"Extra arguments to pass to the worker executable binary. "
|
||||
"The safest choice is specifying no arguments i.e. empty string.">>,
|
||||
default => <<>>}),
|
||||
hex_encoded_header =>
|
||||
bool(false, <<"Hexadecimal encode the header argument that is send to the worker executable. "
|
||||
"CUDA executables expect hex encoded header.">>),
|
||||
repeats =>
|
||||
int(1, <<"Number of tries to do in each worker context - "
|
||||
"WARNING: it should be set so the worker process "
|
||||
"runs for 3-5s or else the node risk missing out on new micro blocks.">>),
|
||||
instances =>
|
||||
array(#{description =>
|
||||
<<"Instances used by the worker in case of Multi-GPU mining. "
|
||||
"Numbers on the configuration list represent GPU devices that are to "
|
||||
"be addressed by the worker.">>,
|
||||
minItems => 1,
|
||||
example => [0,1,2,3]},
|
||||
#{type => <<"integer">>})
|
||||
})).
|
||||
Reference in New Issue
Block a user