00001 /*========================================================================== 00002 * Copyright (c) 2005 University of Massachusetts. All Rights Reserved. 00003 * 00004 * Use of the Lemur Toolkit for Language Modeling and Information Retrieval 00005 * is subject to the terms of the software license set forth in the LICENSE 00006 * file included with this software, and also available at 00007 * http://www.lemurproject.org/license.html 00008 * 00009 *========================================================================== 00010 */ 00011 00012 // 00013 // RepositoryMaintenanceThread 00014 // 00015 // 31 January 2005 -- tds 00016 // 00017 00018 #ifndef INDRI_REPOSITORYMAINTENANCETHREAD_HPP 00019 #define INDRI_REPOSITORYMAINTENANCETHREAD_HPP 00020 00021 #include "indri/UtilityThread.hpp" 00022 #include <queue> 00023 namespace indri 00024 { 00025 namespace collection 00026 { 00027 00028 class RepositoryMaintenanceThread : public indri::thread::UtilityThread { 00029 private: 00030 enum { WRITE, MERGE, TRIM }; 00031 class Repository& _repository; 00032 00033 indri::thread::Mutex _requestLock; 00034 std::queue<int> _requests; 00035 UINT64 _memory; 00036 00037 public: 00038 RepositoryMaintenanceThread( class Repository& repository, UINT64 memory ); 00039 00040 UINT64 initialize(); 00041 UINT64 work(); 00042 bool hasWork(); 00043 void deinitialize(); 00044 00045 void write(); 00046 void merge(); 00047 }; 00048 } 00049 } 00050 00051 #endif // INDRI_REPOSITORYMAINTENANCETHREAD_HPP 00052