C# Класс ScrewTurn.Wiki.IndexStorer

Stores index data to disk.
Instance and static members are thread-safe.
Наследование: ScrewTurn.Wiki.SearchEngine.IndexStorerBase
Показать файл Открыть проект

Открытые методы

Метод Описание
IndexStorer ( string documentsFile, string wordsFile, string mappingsFile, IInMemoryIndex index ) : System

Initializes a new instance of the IndexStorer class.

Защищенные методы

Метод Описание
DeleteData ( DumpedChange data, object state ) : void

Deletes data from the data storage.

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.

Приватные методы

Метод Описание
EqualDumpedDocument ( DumpedDocument d1, DumpedDocument d2 ) : bool

Determines whether two DumpedDocuments are equal.

GetTempFile ( string file ) : string

Gets a tempDumpedWord file name given an original name.

InitFiles ( ) : void

Initializes the data files, if needed.

ReadCount ( FileStream fs ) : int

Reads the count in a FileStream.

The caller must properly seek the stream after calling the method.

ReadDumpedDocument ( BinaryReader reader ) : DumpedDocument

Reads a DumpedDocument from a BinaryReader.

ReadDumpedWord ( BinaryReader reader ) : DumpedWord

Reads a DumpedWord from a BinaryReader.

ReadDumpedWordMapping ( BinaryReader reader ) : DumpedWordMapping

Reads a DumpedWordMapping from a BinaryReader.

ReadReserved ( BinaryReader reader ) : bool

Reads the reserved bytes.

WriteDumpedDocument ( BinaryWriter writer, DumpedDocument document ) : void

Writes a DumpedDocument to a BinaryWriter.

WriteDumpedWord ( BinaryWriter writer, DumpedWord word ) : void

Writes a DumpedWord to a BinaryWriter.

WriteDumpedWordMapping ( BinaryWriter writer, DumpedWordMapping mapping ) : void

Writes a DumpedWordMapping to a BinaryWriter.

WriteHeader ( BinaryWriter writer ) : void

Writes the binary file header.

Описание методов

DeleteData() защищенный Метод

Deletes data from the data storage.
protected DeleteData ( DumpedChange data, object state ) : void
data ScrewTurn.Wiki.SearchEngine.DumpedChange The data to delete.
state object A state object passed from the index.
Результат void

IndexStorer() публичный Метод

Initializes a new instance of the IndexStorer class.
public IndexStorer ( string documentsFile, string wordsFile, string mappingsFile, IInMemoryIndex index ) : System
documentsFile string The file that contains the documents list.
wordsFile string The file that contains the words list.
mappingsFile string The file that contains the index mappings data.
index IInMemoryIndex The index to manage.
Результат System

InitDataStore() защищенный Метод

Initializes the data storage.
protected InitDataStore ( object state ) : void
state object A state object passed from the index.
Результат void

LoadIndexInternal() защищенный Метод

Loads the index from the data store the first time.
protected LoadIndexInternal ( DumpedDocument &documents, DumpedWord &words, DumpedWordMapping &mappings ) : void
documents ScrewTurn.Wiki.SearchEngine.DumpedDocument The dumped documents.
words ScrewTurn.Wiki.SearchEngine.DumpedWord The dumped words.
mappings ScrewTurn.Wiki.SearchEngine.DumpedWordMapping The dumped word mappings.
Результат void

SaveData() защищенный Метод

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 SaveData ( DumpedChange data, object state ) : IndexStorerResult
data ScrewTurn.Wiki.SearchEngine.DumpedChange The data to store.
state object A state object passed from the index.
Результат ScrewTurn.Wiki.SearchEngine.IndexStorerResult