/// <summary> /// Creates a <see cref="Config"/> from an <see cref="IClusterConfig"/> object. /// Initialises the necessary remoting properties necessary for clustering as well. /// </summary> /// <param name="cfg">The <see cref="IClusterConfig"/></param> /// <returns><see cref="Config"/></returns> public static Config CreateClusterConfig(IClusterConfig cfg) { var seedNodes = string.Join(",", cfg.SeedNodePaths.Select(p => $"\"{p}\"")); var roles = string.Join(",", cfg.Roles.Keys); var roleNumbers = string.Join(",", cfg.Roles.Select(kvp => $"{kvp.Key}.min-nr-of-members = {kvp.Value}")); var mainConfig = ConfigurationFactory .ParseString( $@" akka.cluster {{ min-nr-of-members = {cfg.MinNodeNumberForUp}, seed-nodes = [{seedNodes}], roles = [{roles}], role {{ {roleNumbers} }} }}") .WithFallback(CreateRemotingConfig(cfg)); return(mainConfig); }
public GraphController(IGraphCache graph, IClusterConfig cluster) { _graph = graph; _cluster = cluster; }
public TimelineController(IClusterConfig cluster) { _cluster = cluster; }
public LeaderFollowerDataSource(IClusterConfig cluster, IGraphData db) { _cluster = cluster; _db = db; }
public GraphCache(IClusterConfig config, IGraphData source) { _config = config; _source = new LeaderFollowerDataSource(config, source); _entities = new EntityCache(_source); }
public ConsensusTransport(IClusterConfig config) { _config = config; }
public static IGraphQuery Query(this IClusterConfig config) => new FailOverClient(config.ShuffledFollowers);
public static IGraphLeader Leader(this IClusterConfig config) => Create <IGraphLeader>(config.CurrentLeader);
public static IGraphDataWrite Write(this IClusterConfig config) => Create <IGraphDataWrite>(config.CurrentLeader);
public static IGraphDataRead Read(this IClusterConfig config) => new FailOverClient(config.ShuffledFollowers);