Dynamically compiles a module containing the startup information for each worker pool.
Cofiguration example:
[{cluster_a, [{servers, [{" server1", 11211}, {"server2", 11211}]}, {sharding_algorithm, {mero, shard_phash2}}, {workers_per_shard, 3}, {pool_worker_module, mero_wrk_tcp_txt}] }, {cluster_b, [{servers, [{"server3", 11211}]}, {sharding_algorithm, {mero, shard_crc32}}, {workers_per_shard, 1}, {pool_worker_module, mero_wrk_tcp_binary}] } ]
Module generated:
-module(mero_cluster_util). -export([child_definitions/0, worker_by_index/3, cluster_shards/1, workers_per_shard/1, clusters/0, sharding_algorithm/1]).
child_definitions() ->
[{cluster_a,"server1",11211,mero_cluster_a_server1_0_0, mero_wrk_tcp_txt}, {cluster_a,"server1",11211,mero_cluster_a_server1_0_1, mero_wrk_tcp_txt}, {cluster_a,"server1",11211,mero_cluster_a_server1_0_2, mero_wrk_tcp_txt},
{cluster_a,"server2",11211,mero_cluster_a_server2_1_0, mero_wrk_tcp_txt}, {cluster_a,"server2",11211,mero_cluster_a_server2_1_1, mero_wrk_tcp_txt}, {cluster_a,"server2",11211,mero_cluster_a_server2_1_2, mero_wrk_tcp_txt},
{cluster_b,"server3",11211,mero_cluster_b_server3_0_0, mero_wrk_tcp_binary}].
worker_by_index(cluster_a, 0, 0) -> mero_cluster_a_server1_0_0; worker_by_index(cluster_a, 0, 1) -> mero_cluster_a_server1_0_1; worker_by_index(cluster_a, 0, 2) -> mero_cluster_a_server1_0_2; worker_by_index(cluster_a, 1, 0) -> mero_cluster_a_server2_1_0; worker_by_index(cluster_a, 1, 1) -> mero_cluster_a_server2_1_1; worker_by_index(cluster_a, 1, 2) -> mero_cluster_a_server2_1_2; worker_by_index(cluster_b, 0, 0) -> mero_cluster_b_server3_0_0.
cluster_shards(cluster_a) -> 2; cluster_shards(cluster_b) -> 1.
workers_per_shard(cluster_a) -> 3; workers_per_shard(cluster_b) -> 1.
pool_worker_module(cluster_a) -> mero_wrk_tcp_txt; pool_worker_module(cluster_b) -> mero_wrk_tcp_binary.
sharding_algorithm(cluster_a) -> {mero, shard_phash2}; sharding_algorithm(cluster_b) -> {mero, shard_crc32}.
clusters() -> [cluster_a, cluster_b]child_definitions() -> [{}]
cluster_shards(Name) -> any()
clusters() -> any()
group_by_shards(ClusterName::atom(), Keys::[mero:mero_key()]) -> [{PoolName::atom(), Keys::[binary()]}]
group_by_shards(ClusterName::atom(), Items::[tuple()], KeyPos::pos_integer()) -> [{PoolName::atom(), Items::[tuple()]}]
load_clusters(ClusterConfig::[{ClusterName::atom(), Config::list()}]) -> ok
Loads a file with the pool configuration
one_pool_of_each_shard_of_cluster(ClusterName) -> any()
pool_worker_module(Name) -> any()
random_pool_of_shard(Name, ShardIdentifier) -> any()
server(Name::atom(), Key::mero:mero_key()) -> Server::atom()
sharding_algorithm(Name) -> any()
total_workers(Name) -> any()
workers_per_shard(Name) -> any()
Generated by EDoc, Dec 14 2018, 23:57:15.