Replace base_uint(string) with from_hex_text<> (RIPD-897)

Removes the base_uint constructor that took a string.  Replaces
that functionality with two free functions named from_hex_text<>.
Use of from_hex_text<> looks like this:

auto v = from_hex_text<uint256>("AAA555");
static_assert (std::is_same<decltype(v), uint256>::value, "Huh!");

from_hex_text<> only operates on base_uint types.  At the moment the
list of those types include:

 o uint128,
 o uint160,
 o uint256,
 o Directory,
 o Account,
 o Currency, and
 o NodeID.

Using from_hex_text<> with any other types will not compile due to
an enable_if.
This commit is contained in:
Scott Schurr
2015-05-29 10:31:13 -07:00
committed by Vinnie Falco
parent d7def5509d
commit 4515ac0bca
9 changed files with 48 additions and 25 deletions

View File

@@ -136,7 +136,7 @@ public:
// overrride OptimizeLevelStyleCompaction
options.min_write_buffer_number_to_merge = 1;
rocksdb::BlockBasedTableOptions table_options;
// Use hash index
table_options.index_type =
@@ -145,7 +145,7 @@ public:
rocksdb::NewBloomFilterPolicy(10));
options.table_factory.reset(
NewBlockBasedTableFactory(table_options));
// Higher values make reads slower
// table_options.block_size = 4096;
@@ -273,7 +273,7 @@ public:
storeBatch (Batch const& batch)
{
rocksdb::WriteBatch wb;
EncodedBlob encoded;
for (auto const& e : batch)
@@ -291,7 +291,7 @@ public:
// Crucial to ensure good write speed and non-blocking writes to memtable
options.disableWAL = true;
auto ret = m_db->Write (options, &wb);
if (!ret.ok ())
@@ -321,7 +321,8 @@ public:
{
// Uh oh, corrupted data!
if (m_journal.fatal) m_journal.fatal <<
"Corrupt NodeObject #" << uint256 (it->key ().data ());
"Corrupt NodeObject #" <<
from_hex_text<uint256>(it->key ().data ());
}
}
else