public void RaiseNotifications(IndexChangeNotification obj) { Database.TransportState.Send(obj); var onIndexChange = OnIndexChange; if (onIndexChange != null) onIndexChange(Database, obj); }
public void Send(IndexChangeNotification indexChangeNotification) { OnIndexChangeNotification(this, indexChangeNotification); foreach (var connectionState in connections) { connectionState.Value.Send(indexChangeNotification); } }
public void Send(IndexChangeNotification indexChangeNotification) { var value = new { Value = indexChangeNotification, Type = "IndexChangeNotification" }; if (watchAllIndexes > 0) { Enqueue(value); return; } if (matchingIndexes.Contains(indexChangeNotification.Name) == false) return; Enqueue(value); }
public void Send(IndexChangeNotification indexChangeNotification) { var onOnIndexChangeNotification = OnIndexChangeNotification; if (onOnIndexChangeNotification != null) onOnIndexChangeNotification(indexChangeNotification); }
private void OnIndexChange(DocumentDatabase documentDatabase, IndexChangeNotification eventArgs) { switch (eventArgs.Type) { case IndexChangeTypes.IndexAdded: //if created index with the same name as deleted one, we should prevent its deletion replication docDb.TransactionalStorage.Batch(accessor => accessor.Lists.Remove(Constants.RavenReplicationIndexesTombstones, eventArgs.Name)); break; case IndexChangeTypes.IndexRemoved: var metadata = new RavenJObject { {Constants.RavenIndexDeleteMarker, true}, {Constants.RavenReplicationSource, docDb.TransactionalStorage.Id.ToString()}, {Constants.RavenReplicationVersion, ReplicationHiLo.NextId(docDb)} }; docDb.TransactionalStorage.Batch(accessor => accessor.Lists.Set(Constants.RavenReplicationIndexesTombstones, eventArgs.Name, metadata, UuidType.Indexing)); break; } }
public void RaiseNotifications(IndexChangeNotification obj) { TransportState.Send(obj); }
private void OnIndexChange(DocumentDatabase documentDatabase, IndexChangeNotification notification) { var indexName = notification.Name; switch (notification.Type) { case IndexChangeTypes.IndexAdded: //if we created index with the same name as deleted one, we should prevent its deletion replication Database.TransactionalStorage.Batch(accessor => accessor.Lists.Remove(Constants.RavenReplicationIndexesTombstones, indexName)); break; case IndexChangeTypes.IndexRemoved: var indexDefinition = Database.IndexDefinitionStorage.GetIndexDefinition(indexName); if (indexDefinition != null) { //the side by side index was deleted IndexToAdd _; sideBySideIndexesToReplicate.TryRemove(indexDefinition.IndexId, out _); } //If we don't have any destination to replicate to (we are probably slave node) //we shouldn't keep a tombstone since we are not going to remove it anytime //and keeping it prevents us from getting that index created again. if (GetReplicationDestinations().Count == 0) return; var metadata = new RavenJObject { {Constants.RavenIndexDeleteMarker, true}, {Constants.RavenReplicationSource, Database.TransactionalStorage.Id.ToString()}, {Constants.RavenReplicationVersion, ReplicationHiLo.NextId(Database)}, {"IndexVersion", notification.Version } }; Database.TransactionalStorage.Batch(accessor => accessor.Lists.Set(Constants.RavenReplicationIndexesTombstones, indexName, metadata, UuidType.Indexing)); break; } }
public void Send(IndexChangeNotification indexChangeNotification) { OnIndexChangeNotification(indexChangeNotification); }