#ifndef BITCOIN_LEVELDB_H
#define BITCOIN_LEVELDB_H
-#include "main.h"
-
-#include <map>
-#include <string>
-#include <vector>
+#include "serialize.h"
+#include "streams.h"
+#include "version.h"
#include <leveldb/db.h>
#include <leveldb/write_batch.h>
+class CBigNum;
+class CDiskBlockIndex;
+class COutPoint;
+class CTxIndex;
+class CTransaction;
+class uint256;
+class CDiskTxPos;
+
// Class that provides access to a LevelDB. Note that this class is frequently
// instantiated on the stack and then destroyed again, so instantiation has to
// be very cheap. Unfortunately that means, a CTxDB instance is actually just a
private:
leveldb::DB *pdb; // Points to the global instance.
+
// A batch stores up writes and deletes for atomic application. When this
// field is non-NULL, writes/deletes go there instead of directly to disk.
leveldb::WriteBatch *activeBatch;
leveldb::Options options;
bool fReadOnly;
+ int nVersion;
protected:
// Returns true and sets (value,false) if activeBatch contains the given key
SER_DISK, CLIENT_VERSION);
ssValue >> value;
}
- catch (std::exception &e) {
+ catch (const std::exception&) {
return false;
}
return true;
bool WriteSyncCheckpoint(uint256 hashCheckpoint);
bool ReadCheckpointPubKey(std::string& strPubKey);
bool WriteCheckpointPubKey(const std::string& strPubKey);
+ bool ReadModifierUpgradeTime(unsigned int& nUpgradeTime);
+ bool WriteModifierUpgradeTime(const unsigned int& nUpgradeTime);
bool LoadBlockIndex();
-private:
- bool LoadBlockIndexGuts();
};
-// Called from the initialization code. Checks to see if there is an old
-// blkindex.dat file. If so, deletes it and begins re-importing the block
-// chain, which will create the new database.
-enum LevelDBMigrationResult {
- NONE_NEEDED,
- INSUFFICIENT_DISK_SPACE,
- COMPLETED,
- OTHER_ERROR,
-};
-
-typedef boost::signals2::signal<void (double progress)> LevelDBMigrationProgress;
-
-LevelDBMigrationResult MaybeMigrateToLevelDB(LevelDBMigrationProgress &progress);
-#endif // BITCOIN_DB_H
+#endif // BITCOIN_LEVELDB_H