C# Class ScrewTurn.Wiki.SearchEngine.IndexStorerBase

Implements a base class for an index storer.
Instance and static members are thread-safe.
Inheritance: IDisposable
Show file Open project: mono/ScrewTurnWiki Class Usage Examples

Protected Properties

Property Type Description
dataCorrupted bool
disposed bool
index IInMemoryIndex
indexChangedHandler EventHandler
reasonForDataCorruption System.Exception

Public Methods

Method Description
Dispose ( ) : void

Disposes the current object.

IndexStorerBase ( IInMemoryIndex index ) : System

Initializes a new instance of the IndexStorerBase class.

LoadIndex ( ) : void

Loads the index from the data store the first time.

Protected Methods

Method Description
DeleteData ( DumpedChange data, object state ) : void

Deletes data from the data storage.

Find ( DumpedWord word, IEnumerable list ) : bool

Determines whether a DumpedWord is contained in a list.

Find ( DumpedWordMapping mapping, IEnumerable list ) : bool

Determines whether a DumpedWordMapping is contained in a list.

IndexChangedHandler ( object sender, IndexChangedEventArgs e ) : void

Handles the IInMemoryIndex.IndexChanged events.

InitDataStore ( object state ) : void

Initializes the data storage.

LoadIndexInternal ( DumpedDocument &documents, DumpedWord &words, DumpedWordMapping &mappings ) : void

Loads the index from the data store the first time.

SaveData ( DumpedChange data, object state ) : IndexStorerResult

Stores new data into the data storage.

When saving a new document, the document ID in data.Mappings must be replaced with the currect document ID, generated by the concrete implementation of this method. data.Words should have IDs numbered from uint.MaxValue downwards. The method re-numbers the words appropriately.

Method Details

DeleteData() protected abstract method

Deletes data from the data storage.
protected abstract DeleteData ( DumpedChange data, object state ) : void
data DumpedChange The data to delete.
state object A state object passed from the index.
return void

Dispose() public method

Disposes the current object.
public Dispose ( ) : void
return void

Find() protected static method

Determines whether a DumpedWord is contained in a list.
protected static Find ( DumpedWord word, IEnumerable list ) : bool
word DumpedWord The word.
list IEnumerable The list.
return bool

Find() protected static method

Determines whether a DumpedWordMapping is contained in a list.
protected static Find ( DumpedWordMapping mapping, IEnumerable list ) : bool
mapping DumpedWordMapping The mapping.
list IEnumerable The list.
return bool

IndexChangedHandler() protected method

Handles the IInMemoryIndex.IndexChanged events.
protected IndexChangedHandler ( object sender, IndexChangedEventArgs e ) : void
sender object The sender.
e IndexChangedEventArgs The event arguments.
return void

IndexStorerBase() public method

Initializes a new instance of the IndexStorerBase class.
If is null.
public IndexStorerBase ( IInMemoryIndex index ) : System
index IInMemoryIndex The index to manage.
return System

InitDataStore() protected abstract method

Initializes the data storage.
protected abstract InitDataStore ( object state ) : void
state object A state object passed from the index.
return void

LoadIndex() public method

Loads the index from the data store the first time.
public LoadIndex ( ) : void
return void

LoadIndexInternal() protected abstract method

Loads the index from the data store the first time.
protected abstract LoadIndexInternal ( DumpedDocument &documents, DumpedWord &words, DumpedWordMapping &mappings ) : void
documents DumpedDocument The dumped documents.
words DumpedWord The dumped words.
mappings DumpedWordMapping The dumped word mappings.
return void

SaveData() protected abstract method

Stores new data into the data storage.
When saving a new document, the document ID in data.Mappings must be replaced with the currect document ID, generated by the concrete implementation of this method. data.Words should have IDs numbered from uint.MaxValue downwards. The method re-numbers the words appropriately.
protected abstract SaveData ( DumpedChange data, object state ) : IndexStorerResult
data DumpedChange The data to store.
state object A state object passed by the index.
return IndexStorerResult

Property Details

dataCorrupted protected property

true if the index data seems corrupted.
protected bool dataCorrupted
return bool

disposed protected property

Indicates whether the object was disposed.
protected bool disposed
return bool

index protected property

The index bound to this storer.
protected IInMemoryIndex index
return IInMemoryIndex

indexChangedHandler protected property

The event handler for the IInMemoryIndex.IndexChanged of the bound index.
protected EventHandler indexChangedHandler
return EventHandler

reasonForDataCorruption protected property

Contains the exception occurred during index setup.
protected Exception,System reasonForDataCorruption
return System.Exception