Пример #1
0
        public IChangesObservable <OperationStatusChange> ForOperationId(long operationId)
        {
            var counter = GetOrAddConnectionState("operations/" + operationId, "watch-operation", "unwatch-operation", operationId.ToString());

            var taskedObservable = new ChangesObservable <OperationStatusChange, DatabaseConnectionState>(
                counter,
                notification => notification.OperationId == operationId);

            return(taskedObservable);
        }
Пример #2
0
        public IChangesObservable <OperationStatusChange> ForAllOperations()
        {
            var counter = GetOrAddConnectionState("all-operations", "watch-operations", "unwatch-operations", null);

            var taskedObservable = new ChangesObservable <OperationStatusChange, DatabaseConnectionState>(
                counter,
                notification => true);

            return(taskedObservable);
        }
Пример #3
0
        public IChangesObservable <IndexChange> ForIndex(string indexName)
        {
            var counter = GetOrAddConnectionState("indexes/" + indexName, "watch-index", "unwatch-index", indexName);

            var taskedObservable = new ChangesObservable <IndexChange, DatabaseConnectionState>(
                counter,
                notification => string.Equals(notification.Name, indexName, StringComparison.OrdinalIgnoreCase));

            return(taskedObservable);
        }
Пример #4
0
        public IChangesObservable <DocumentChange> ForAllDocuments()
        {
            var counter = GetOrAddConnectionState("all-docs", "watch-docs", "unwatch-docs", null);

            var taskedObservable = new ChangesObservable <DocumentChange, DatabaseConnectionState>(
                counter,
                notification => true);

            return(taskedObservable);
        }
Пример #5
0
        public IChangesObservable <TimeSeriesChange> ForAllTimeSeries()
        {
            var counter = GetOrAddConnectionState("all-timeseries", "watch-all-timeseries", "unwatch-all-timeseries", null);

            var taskedObservable = new ChangesObservable <TimeSeriesChange, DatabaseConnectionState>(
                counter,
                notification => true);

            return(taskedObservable);
        }
Пример #6
0
        public IChangesObservable <DocumentChange> ForDocumentsStartingWith(string docIdPrefix)
        {
            var counter = GetOrAddConnectionState("prefixes/" + docIdPrefix, "watch-prefix", "unwatch-prefix", docIdPrefix);

            var taskedObservable = new ChangesObservable <DocumentChange, DatabaseConnectionState>(
                counter,
                notification => notification.Id != null && notification.Id.StartsWith(docIdPrefix, StringComparison.OrdinalIgnoreCase));

            return(taskedObservable);
        }
Пример #7
0
        public IChangesObservable <DocumentChange> ForDocument(string docId)
        {
            var counter = GetOrAddConnectionState("docs/" + docId, "watch-doc", "unwatch-doc", docId);

            var taskedObservable = new ChangesObservable <DocumentChange, DatabaseConnectionState>(
                counter,
                notification => string.Equals(notification.Id, docId, StringComparison.OrdinalIgnoreCase));

            return(taskedObservable);
        }
Пример #8
0
        public IChangesObservable <IndexChange> ForAllIndexes()
        {
            var counter = GetOrAddConnectionState("all-indexes", "watch-indexes", "unwatch-indexes", null);

            var taskedObservable = new ChangesObservable <IndexChange, DatabaseConnectionState>(
                counter,
                notification => true);

            counter.OnIndexChangeNotification += taskedObservable.Send;
            counter.OnError += taskedObservable.Error;

            return(taskedObservable);
        }
Пример #9
0
        public IChangesObservable <OperationStatusChange> ForOperationId(long operationId)
        {
            var counter = GetOrAddConnectionState("operations/" + operationId, "watch-operation", "unwatch-operation", operationId.ToString());

            var taskedObservable = new ChangesObservable <OperationStatusChange, DatabaseConnectionState>(
                counter,
                notification => true);

            counter.OnOperationStatusChangeNotification += taskedObservable.Send;
            counter.OnError += taskedObservable.Error;

            return(taskedObservable);
        }
Пример #10
0
        public IChangesObservable <DocumentChange> ForDocumentsOfType(string typeName)
        {
            if (typeName == null)
            {
                throw new ArgumentNullException(nameof(typeName));
            }

            var taskedObservable = new ChangesObservable <DocumentChange, DatabaseConnectionState>(
                DatabaseConnectionState.Dummy,
                notification => false);

            return(taskedObservable);
        }
Пример #11
0
        public IChangesObservable <DocumentChange> ForDocumentsStartingWith(string docIdPrefix)
        {
            if (string.IsNullOrWhiteSpace(docIdPrefix))
            {
                throw new ArgumentException("Value cannot be null or whitespace.", nameof(docIdPrefix));
            }

            var counter = GetOrAddConnectionState("prefixes/" + docIdPrefix, "watch-prefix", "unwatch-prefix", docIdPrefix);

            var taskedObservable = new ChangesObservable <DocumentChange, DatabaseConnectionState>(
                counter,
                notification => notification.Id != null && notification.Id.StartsWith(docIdPrefix, StringComparison.OrdinalIgnoreCase));

            return(taskedObservable);
        }
Пример #12
0
        public IChangesObservable <IndexChange> ForIndex(string indexName)
        {
            if (string.IsNullOrWhiteSpace(indexName))
            {
                throw new ArgumentException("Value cannot be null or whitespace.", nameof(indexName));
            }

            var counter = GetOrAddConnectionState("indexes/" + indexName, "watch-index", "unwatch-index", indexName);

            var taskedObservable = new ChangesObservable <IndexChange, DatabaseConnectionState>(
                counter,
                notification => string.Equals(notification.Name, indexName, StringComparison.OrdinalIgnoreCase));

            return(taskedObservable);
        }
Пример #13
0
        public IChangesObservable <DocumentChange> ForDocumentsInCollection(string collectionName)
        {
            if (string.IsNullOrWhiteSpace(collectionName))
            {
                throw new ArgumentException("Value cannot be null or whitespace.", nameof(collectionName));
            }

            var counter = GetOrAddConnectionState("collections/" + collectionName, "watch-collection", "unwatch-collection", collectionName);

            var taskedObservable = new ChangesObservable <DocumentChange, DatabaseConnectionState>(
                counter,
                notification => string.Equals(collectionName, notification.CollectionName, StringComparison.OrdinalIgnoreCase));

            return(taskedObservable);
        }
Пример #14
0
        public IChangesObservable <DocumentChange> ForDocument(string docId)
        {
            if (string.IsNullOrWhiteSpace(docId))
            {
                throw new ArgumentException("Value cannot be null or whitespace.", nameof(docId));
            }

            var counter = GetOrAddConnectionState("docs/" + docId, "watch-doc", "unwatch-doc", docId);

            var taskedObservable = new ChangesObservable <DocumentChange, DatabaseConnectionState>(
                counter,
                notification => string.Equals(notification.Id, docId, StringComparison.OrdinalIgnoreCase));

            return(taskedObservable);
        }
Пример #15
0
        public IChangesObservable <TimeSeriesChange> ForTimeSeriesOfDocument(string documentId)
        {
            if (string.IsNullOrWhiteSpace(documentId))
            {
                throw new ArgumentException("Value cannot be null or whitespace.", nameof(documentId));
            }

            var counter = GetOrAddConnectionState($"document/{documentId}/timeseries", "watch-all-document-timeseries", "unwatch-all-document-timeseries", documentId);

            var taskedObservable = new ChangesObservable <TimeSeriesChange, DatabaseConnectionState>(
                counter,
                notification => string.Equals(documentId, notification.DocumentId, StringComparison.OrdinalIgnoreCase));

            return(taskedObservable);
        }
Пример #16
0
        public IChangesObservable <TimeSeriesChange> ForTimeSeries(string timeSeriesName)
        {
            if (string.IsNullOrWhiteSpace(timeSeriesName))
            {
                throw new ArgumentException("Value cannot be null or whitespace.", nameof(timeSeriesName));
            }

            var counter = GetOrAddConnectionState($"timeseries/{timeSeriesName}", "watch-timeseries", "unwatch-timeseries", timeSeriesName);

            var taskedObservable = new ChangesObservable <TimeSeriesChange, DatabaseConnectionState>(
                counter,
                notification => string.Equals(timeSeriesName, notification.Name, StringComparison.OrdinalIgnoreCase));

            return(taskedObservable);
        }
Пример #17
0
        public IChangesObservable <DocumentChange> ForDocumentsOfType(string typeName)
        {
            if (typeName == null)
            {
                throw new ArgumentNullException(nameof(typeName));
            }
            var encodedTypeName = Uri.EscapeDataString(typeName);

            var counter = GetOrAddConnectionState("types/" + typeName, "watch-type", "unwatch-type", encodedTypeName);

            var taskedObservable = new ChangesObservable <DocumentChange, DatabaseConnectionState>(
                counter,
                notification => string.Equals(typeName, notification.TypeName, StringComparison.OrdinalIgnoreCase));

            return(taskedObservable);
        }
Пример #18
0
        public IChangesObservable <DocumentChange> ForDocumentsInCollection(string collectionName)
        {
            if (collectionName == null)
            {
                throw new ArgumentNullException(nameof(collectionName));
            }

            var counter = GetOrAddConnectionState("collections/" + collectionName, "watch-collection", "unwatch-collection", collectionName);

            var taskedObservable = new ChangesObservable <DocumentChange, DatabaseConnectionState>(
                counter,
                notification => string.Equals(collectionName, notification.CollectionName, StringComparison.OrdinalIgnoreCase));

            counter.OnDocumentChangeNotification += taskedObservable.Send;
            counter.OnError += taskedObservable.Error;

            return(taskedObservable);
        }
Пример #19
0
        public IChangesObservable <CounterChange> ForCounterOfDocument(string documentId, string counterName)
        {
            if (string.IsNullOrWhiteSpace(documentId))
            {
                throw new ArgumentException("Value cannot be null or whitespace.", nameof(documentId));
            }
            if (string.IsNullOrWhiteSpace(counterName))
            {
                throw new ArgumentException("Value cannot be null or whitespace.", nameof(counterName));
            }

            var counter = GetOrAddConnectionState($"document/{documentId}/counter/{counterName}", "watch-document-counter", "unwatch-document-counter", value: null, values: new[] { documentId, counterName });

            var taskedObservable = new ChangesObservable <CounterChange, DatabaseConnectionState>(
                counter,
                notification => string.Equals(counterName, notification.Name, StringComparison.OrdinalIgnoreCase) && string.Equals(documentId, notification.DocumentId, StringComparison.OrdinalIgnoreCase));

            return(taskedObservable);
        }