Beispiel #1
0
        private void NotifySubscribers(string type, BlittableJsonReaderObject value, List <DatabaseConnectionState> states)
        {
            switch (type)
            {
            case nameof(DocumentChange):
                var documentChange = DocumentChange.FromJson(value);
                foreach (var state in states)
                {
                    state.Send(documentChange);
                }
                break;

            case nameof(IndexChange):
                var indexChange = IndexChange.FromJson(value);
                foreach (var state in states)
                {
                    state.Send(indexChange);
                }
                break;

            case nameof(OperationStatusChange):
                var operationStatusChange = OperationStatusChange.FromJson(value, _conventions);
                foreach (var state in states)
                {
                    state.Send(operationStatusChange);
                }
                break;

            default:
                throw new NotSupportedException(type);
            }
        }
Beispiel #2
0
 public void OnNext(IndexChange change)
 {
     if (change.Type == IndexChangeTypes.BatchCompleted || change.Type == IndexChangeTypes.IndexRemoved)
     {
         Interlocked.Increment(ref _requestExecutor.Cache.Generation);
     }
 }
Beispiel #3
0
        private void NotifySubscribers(string type, BlittableJsonReaderObject value, List <DatabaseConnectionState> states)
        {
            switch (type)
            {
            case nameof(DocumentChange):
                var documentChange = DocumentChange.FromJson(value);
                foreach (var state in states)
                {
                    state.Send(documentChange);
                }
                break;

            case nameof(CounterChange):
                var counterChange = CounterChange.FromJson(value);
                foreach (var state in states)
                {
                    state.Send(counterChange);
                }
                break;

            case nameof(IndexChange):
                var indexChange = IndexChange.FromJson(value);
                foreach (var state in states)
                {
                    state.Send(indexChange);
                }
                break;

            case nameof(OperationStatusChange):
                var operationStatusChange = OperationStatusChange.FromJson(value, _conventions);
                foreach (var state in states)
                {
                    state.Send(operationStatusChange);
                }
                break;

            case nameof(TopologyChange):
                var topologyChange = TopologyChange.FromJson(value);
                _requestExecutor?.UpdateTopologyAsync(new ServerNode
                {
                    Url      = topologyChange.Url,
                    Database = topologyChange.Database
                }, 0, true, "topology-change-notification").ConfigureAwait(false);
                break;

            default:
                throw new NotSupportedException(type);
            }
        }
Beispiel #4
0
        private void NotifySubscribers(string type, BlittableJsonReaderObject value, List <DatabaseConnectionState> states)
        {
            switch (type)
            {
            case nameof(DocumentChange):
                var documentChange = DocumentChange.FromJson(value);
                foreach (var state in states)
                {
                    state.Send(documentChange);
                }
                break;

            case nameof(CounterChange):
                var counterChange = CounterChange.FromJson(value);
                foreach (var state in states)
                {
                    state.Send(counterChange);
                }
                break;

            case nameof(TimeSeriesChange):
                var timeSeriesChange = TimeSeriesChange.FromJson(value);
                foreach (var state in states)
                {
                    state.Send(timeSeriesChange);
                }
                break;

            case nameof(IndexChange):
                var indexChange = IndexChange.FromJson(value);
                foreach (var state in states)
                {
                    state.Send(indexChange);
                }
                break;

            case nameof(OperationStatusChange):
                var operationStatusChange = OperationStatusChange.FromJson(value);
                foreach (var state in states)
                {
                    state.Send(operationStatusChange);
                }
                break;

            case nameof(TopologyChange):
                var topologyChange = TopologyChange.FromJson(value);

                var requestExecutor = _requestExecutor;
                if (requestExecutor != null)
                {
                    var node = new ServerNode
                    {
                        Url      = topologyChange.Url,
                        Database = topologyChange.Database
                    };

                    requestExecutor.UpdateTopologyAsync(new RequestExecutor.UpdateTopologyParameters(node)
                    {
                        TimeoutInMs = 0,
                        ForceUpdate = true,
                        DebugTag    = "topology-change-notification"
                    }).ConfigureAwait(false);
                }
                break;

            default:
                throw new NotSupportedException(type);
            }
        }
 public void Send(IndexChange indexChange)
 {
     OnIndexChangeNotification?.Invoke(indexChange);
 }