database.h

来自「a open source project in linux for peer 」· C头文件 代码 · 共 48 行

H
48
字号
#ifndef DATABASE_H_#define DATABASE_H_/* * Class for storing key value pairs *  * It will use the KadC library and the KadCppApi C++ wrapper around it, * It implements the singleton interface,  */#include "Logger.h"#include "KadCppApi.h"#include <string> class Database {	  public:  	// Obtains the singleton instance.	static Database* getInstance();	// Closes the singleton instance.	static void close();	// Searches for a key.	const std::string get(const std::string& key);	// Adds a key-value pair to the database.	int put(const std::string& key, const std::string& value);	  private:     // Constants 	/* Min number of knodes to wait for till initialized. */ 	const static int INIT_KNODES_COUNT = 20;    	// Fields 	static Database* instance; 	KadCppApi* api; 	Logger* log;		// Constructors & destructor 	Database(); 	Database(const Database&);	virtual ~Database(); 	 	// Private methods 	void init();};#endif /*DATABASE_H_*/

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?