Ejemplo n.º 1
0
        public EmbeddableDatabaseChanges(EmbeddableDocumentStore embeddableDocumentStore, Action onDispose)
        {
            this.onDispose      = onDispose;
            Task                = new CompletedTask();
            indexesObservable   = new EmbeddableObserableWithTask <IndexChangeNotification>();
            documentsObservable = new EmbeddableObserableWithTask <DocumentChangeNotification>();

            embeddableDocumentStore.DocumentDatabase.TransportState.OnIndexChangeNotification += (o, notification) =>
                                                                                                 enqueuedActions.Add(() => indexesObservable.Notify(o, notification));
            embeddableDocumentStore.DocumentDatabase.TransportState.OnDocumentChangeNotification += (o, notification) =>
                                                                                                    enqueuedActions.Add(() => documentsObservable.Notify(o, notification));

            enqueuedTask = Task.Factory.StartNew(() =>
            {
                while (true)
                {
                    var action = enqueuedActions.Take();
                    if (action == null)
                    {
                        return;
                    }
                    action();
                }
            });
        }
Ejemplo n.º 2
0
        public EmbeddableDatabaseChanges(EmbeddableDocumentStore embeddableDocumentStore, Action onDispose)
        {
            this.onDispose      = onDispose;
            Task                = new CompletedTask();
            indexesObservable   = new EmbeddableObserableWithTask <IndexChangeNotification>();
            documentsObservable = new EmbeddableObserableWithTask <DocumentChangeNotification>();

            embeddableDocumentStore.DocumentDatabase.TransportState.OnIndexChangeNotification    += indexesObservable.Notify;
            embeddableDocumentStore.DocumentDatabase.TransportState.OnDocumentChangeNotification += documentsObservable.Notify;
        }