public ClusterMaintenanceSupervisor(ServerStore server, string leaderClusterTag, long term)
 {
     _leaderClusterTag = leaderClusterTag;
     _term             = term;
     _server           = server;
     _contextPool      = new JsonContextPool(server.Configuration.Memory.MaxContextSizeToKeep);
     Config            = server.Configuration.Cluster;
 }
Esempio n. 2
0
        internal static ExtensionPointCpuUsageCalculator GetExtensionPointCpuUsageCalculator(
            JsonContextPool contextPool,
            MonitoringConfiguration configuration,
            NotificationCenter.NotificationCenter notificationCenter)
        {
            var extensionPoint = new ExtensionPointCpuUsageCalculator(
                contextPool,
                configuration.CpuUsageMonitorExec,
                configuration.CpuUsageMonitorExecArguments,
                notificationCenter);



            return(extensionPoint);
        }
Esempio n. 3
0
 public ClusterNode(
     string clusterTag,
     string url,
     JsonContextPool contextPool,
     ClusterMaintenanceSupervisor parent,
     CancellationToken token)
 {
     ClusterTag   = clusterTag;
     Url          = url;
     _contextPool = contextPool;
     _parent      = parent;
     _cts         = CancellationTokenSource.CreateLinkedTokenSource(token);
     _token       = _cts.Token;
     _readStatusUpdateDebugString = $"ClusterMaintenanceServer/{ClusterTag}/UpdateState/Read-Response";
     _log = LoggingSource.Instance.GetLogger <ClusterNode>(clusterTag);
 }
Esempio n. 4
0
        public void ShouldCleanEscapePositionWhenTakenFromCache()
        {
            using (var pool = new JsonContextPool())
            {
                using (pool.AllocateOperationContext(out var context))
                {
                    var lazyString = context.GetLazyString("abc \b cba");
                    Assert.NotNull(lazyString.EscapePositions);
                }

                using (pool.AllocateOperationContext(out var context))
                {
                    var lazyString = context.GetLazyString("abc");
                    Assert.Null(lazyString.EscapePositions);
                }
            }
        }
Esempio n. 5
0
 public CpuUsageExtensionPoint(
     JsonContextPool contextPool,
     string exec,
     string args,
     NotificationCenter.NotificationCenter notificationCenter)
 {
     _contextPool        = contextPool;
     _notificationCenter = notificationCenter;
     _startInfo          = new ProcessStartInfo
     {
         FileName               = exec,
         Arguments              = args,
         UseShellExecute        = false,
         RedirectStandardOutput = true,
         RedirectStandardError  = true,
         CreateNoWindow         = true
     };
 }
Esempio n. 6
0
            public ClusterNode(
                string clusterTag,
                string url,
                long term,
                JsonContextPool contextPool,
                ClusterMaintenanceSupervisor parent,
                CancellationToken token)
            {
                ClusterTag = clusterTag;
                Url        = url;

                _contextPool = contextPool;
                _parent      = parent;
                _cts         = CancellationTokenSource.CreateLinkedTokenSource(token);
                _token       = _cts.Token;
                _readStatusUpdateDebugString = $"ClusterMaintenanceServer/{ClusterTag}/UpdateState/Read-Response in term {term}";
                _name = $"Heartbeats supervisor from {_parent._server.NodeTag} to {ClusterTag} in term {term}";
                _log  = LoggingSource.Instance.GetLogger <ClusterNode>(_name);
            }
Esempio n. 7
0
        public RequestExecuter(string url, string databaseName, string apiKey)
        {
            _topology = new Topology
            {
                LeaderNode = new ServerNode
                {
                    Url      = url,
                    Database = databaseName,
                    ApiKey   = apiKey,
                },
                ReadBehavior  = ReadBehavior.LeaderOnly,
                WriteBehavior = WriteBehavior.LeaderOnly,
                Etag          = int.MinValue,
            };

            var handler = new HttpClientHandler();

            _httpClient = new HttpClient(handler);

            ContextPool = new JsonContextPool();

            _updateTopologyTimer      = new Timer(UpdateTopologyCallback, null, 0, Timeout.Infinite);
            _updateFailingNodesStatus = new Timer(UpdateFailingNodesStatusCallback, null, TimeSpan.FromMinutes(1), TimeSpan.FromMinutes(1));
        }