Example #1
0
 public OnlineLoadBalancer(IClusterSettings clusterSettings,
                           ILoggerFactory loggerFactory,
                           IOnlineLoadBalancerActorFactory onlineLoadBalancerActorFactory)
 {
     this._onlineLoadBalancerActorFactory = onlineLoadBalancerActorFactory;
     this.ClusterSettings = clusterSettings;
     this._logger         = loggerFactory.CreateLogger <OnlineLoadBalancer>();
 }
 /// <summary>
 /// In memory raft cluster
 /// </summary>
 /// <param name="localNode"></param>
 /// <param name="rpcClientProvider"></param>
 /// <param name="clusterSettings"></param>
 public DefaultCluster(INode localNode, IRpcClientProvider rpcClientProvider, IClusterSettings clusterSettings)
 {
     if (localNode.IsRemote)
     {
         throw new ArgumentException("Must local node", nameof(localNode));
     }
     _nodes.Add(localNode);
     _rpcClientProvider = rpcClientProvider;
     _clusterSettings   = clusterSettings;
 }
Example #3
0
        public static (ClusterConfig, GrpcCoreRemoteConfig) CreateClusterConfig(IClusterSettings clusterSettings, IClusterProvider clusterProvider, IIdentityLookup identityLookup, IDescriptorProvider descriptorProvider, ILogger _logger)
        {
            //var portStr = Environment.GetEnvironmentVariable("PROTOPORT") ?? $"{RemoteConfigBase.AnyFreePort}";

            var clusterName = clusterSettings.ClusterName;

            var hostip         = Environment.GetEnvironmentVariable("PROTOHOST");
            var host           = clusterSettings.ClusterHost;
            var advertisedHost = clusterSettings.ClusterHost;
            var port           = clusterSettings.ClusterPort;

            if ("protohost".Equals(host))
            {
                host           = hostip;
                advertisedHost = hostip;
                _logger.LogDebug($"Using PROTOHOST");
            }
            _logger.LogDebug($"BindTo to {host} port {port}");
            _logger.LogDebug($"WithAdvertisedHost to {advertisedHost}");

            FileDescriptor[] descriptors = descriptorProvider.GetDescriptors();


            // TOOD: This doesn't seem to work. Why?
            List <ChannelOption> options = new List <ChannelOption>()
            {
                new ChannelOption(ChannelOptions.MaxSendMessageLength, (100 * 1024 * 1024)),
                new ChannelOption(ChannelOptions.MaxReceiveMessageLength, (100 * 1024 * 1024))
            };


            GrpcCoreRemoteConfig remoteConfig = GrpcCoreRemoteConfig.BindTo(host, port)
                                                .WithEndpointWriterMaxRetries(0)
                                                .WithRemoteDiagnostics(true)
                                                .WithAdvertisedHost(advertisedHost)
                                                .WithProtoMessages(descriptors)
                                                .WithChannelOptions(options);

            var clusterConfig = ClusterConfig.Setup(clusterName, clusterProvider, identityLookup);

            return(clusterConfig, remoteConfig);
        }
 public SharedClusterWorker(
     ILogger <SharedClusterWorker> logger,
     IClusterSettings clusterSettings,
     IDescriptorProvider descriptorProvider,
     ISharedClusterProviderFactory clusterProvider,
     ISharedSetupRootActors setupRootActors   = default,
     ISubscriptionFactory subscriptionFactory = default,
     IMainWorker mainWorker           = default,
     IMetricsProvider metricsProvider = default
     )
 {
     _logger                  = logger;
     _setupRootActors         = setupRootActors;
     _clusterSettings         = clusterSettings;
     _mainWorker              = mainWorker;
     _descriptorProvider      = descriptorProvider;
     _clusterProvider         = clusterProvider;
     _subscriptionFactory     = subscriptionFactory;
     _metricsProvider         = metricsProvider;
     _cancellationTokenSource = new CancellationTokenSource();
 }
 public SharedClusterProviderFactory(IClusterSettings clusterSettings)
 {
     _clusterSettings = clusterSettings;
 }
Example #6
0
 public ReassemblerService(IClusterSettings clusterSettings, IRawPacketBatchParserActorFactory rawPacketBatchParserActorFactory)
 {
     this._rawPacketBatchParserActorFactory = rawPacketBatchParserActorFactory;
     this._clusterSettings = clusterSettings;
 }