Пример #1
0
IndexAlgorithm* IndexFactory::index(const char* db, const char* ns, const std::set<std::string>& keys) {
	listAlgorithmsTypePtr algorithms = findAlgorithms(db, ns);

	IndexAlgorithm* indexImpl = findIndex(algorithms, keys);
	if (indexImpl == NULL) {
		int len = strlen(db) + strlen(ns) + strlen(".ixp") + 20;
		char* indexFileName = (char*)malloc(len);
		memset(indexFileName, 0, len);
		sprintf(indexFileName, "%s/%s.ixp", db, ns), 
		//indexImpl = new BPlusIndex(keys);
		indexImpl = new BPlusIndexP(indexFileName);
		indexImpl->setKeys(keys);
		algorithms->push_back(indexImpl);
		free(indexFileName);
	}

	return indexImpl;
}