Contains arguments for the IndexChanged event of the IInMemoryIndex interface.
Inheritance: System.EventArgs
Ejemplo n.º 1
0
        /// <summary>
        /// Handles the <see cref="IInMemoryIndex.IndexChanged" /> events.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The event arguments.</param>
        protected void IndexChangedHandler(object sender, IndexChangedEventArgs e)
        {
            lock (this) {
                if (disposed)
                {
                    return;
                }

                switch (e.Change)
                {
                case IndexChangeType.IndexCleared:
                    InitDataStore(e.State);
                    break;

                case IndexChangeType.DocumentAdded:
                    if (!dataCorrupted)
                    {
                        IndexStorerResult result = SaveData(e.ChangeData, e.State);
                        e.Result = result;
                    }
                    break;

                case IndexChangeType.DocumentRemoved:
                    if (!dataCorrupted)
                    {
                        DeleteData(e.ChangeData, e.State);
                    }
                    break;

                default:
                    throw new NotSupportedException("Invalid Change Type");
                }
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Takes care of firing the <see cref="IndexChanged" /> event.
 /// </summary>
 /// <param name="document">The affected document.</param>
 /// <param name="change">The change performed.</param>
 /// <param name="changeData">The dumped change data.</param>
 /// <param name="state">A state object that is passed to the IndexStorer SaveDate/DeleteData function.</param>
 /// <returns>The storage result or <c>null</c>.</returns>
 protected IndexStorerResult OnIndexChange(IDocument document, IndexChangeType change, DumpedChange changeData, object state)
 {
     if (IndexChanged != null)
     {
         IndexChangedEventArgs args = new IndexChangedEventArgs(document, change, changeData, state);
         IndexChanged(this, args);
         return(args.Result);
     }
     return(null);
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Takes care of firing the <see cref="IndexChanged" /> event.
 /// </summary>
 /// <param name="document">The affected document.</param>
 /// <param name="change">The change performed.</param>
 /// <param name="changeData">The dumped change data.</param>
 /// <param name="state">A state object that is passed to the IndexStorer SaveDate/DeleteData function.</param>
 /// <returns>The storage result or <c>null</c>.</returns>
 protected IndexStorerResult OnIndexChange(IDocument document, IndexChangeType change, DumpedChange changeData, object state)
 {
     if(IndexChanged != null) {
         IndexChangedEventArgs args = new IndexChangedEventArgs(document, change, changeData, state);
         IndexChanged(this, args);
         return args.Result;
     }
     else return null;
 }
Ejemplo n.º 4
0
        /// <summary>
        /// Handles the <see cref="IInMemoryIndex.IndexChanged" /> events.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The event arguments.</param>
        protected void IndexChangedHandler(object sender, IndexChangedEventArgs e)
        {
            lock(this) {
                if(disposed) return;

                switch(e.Change) {
                    case IndexChangeType.IndexCleared:
                        InitDataStore(e.State);
                        break;
                    case IndexChangeType.DocumentAdded:
                        if(!dataCorrupted) {
                            IndexStorerResult result = SaveData(e.ChangeData, e.State);
                            e.Result = result;
                        }
                        break;
                    case IndexChangeType.DocumentRemoved:
                        if(!dataCorrupted) DeleteData(e.ChangeData, e.State);
                        break;
                    default:
                        throw new NotSupportedException("Invalid Change Type");
                }
            }
        }