本文整理汇总了C++中leveldb::WriteBatch::Delete方法的典型用法代码示例。如果您正苦于以下问题:C++ WriteBatch::Delete方法的具体用法?C++ WriteBatch::Delete怎么用?C++ WriteBatch::Delete使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类leveldb::WriteBatch
的用法示例。
在下文中一共展示了WriteBatch::Delete方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: remove_address
bool leveldb_chain_keeper::remove_address(leveldb::WriteBatch& batch,
const script& output_script, const output_point& outpoint)
{
payment_address address;
if (!extract(address, output_script))
return false;
data_chunk raw_address = create_address_key(address);
BITCOIN_ASSERT(!raw_address.empty());
data_chunk outpoint_value = create_spent_key(outpoint);
bool is_found = false;
leveldb_iterator it(address_iterator(db_.addr, raw_address));
for (; valid_address_iterator(it, raw_address); it->Next())
{
if (slice_to_output_point(it->value()) != outpoint)
continue;
// We found the address entry we were looking for.
BITCOIN_ASSERT(!is_found);
is_found = true;
// Put changes into batch finally.
batch.Delete(it->key());
break;
}
BITCOIN_ASSERT(it->status().ok());
if (!is_found)
return false;
return true;
}
示例2: remove_credit
bool remove_credit(leveldb::WriteBatch& batch,
const transaction_output_type& output, const output_point& outpoint)
{
payment_address address;
// Not a Bitcoin address so skip this output.
if (!extract(address, output.script))
return true;
data_chunk addr_key = create_address_key(address, outpoint);
batch.Delete(slice(addr_key));
return true;
}
示例3: seq_del
void c_seq::seq_del(uint32 keyId, leveldb::WriteBatch& bh)
{
bh.Delete(__tos(m_key << "@" << keyId));
m_seq_head.s_count(m_seq_head.g_count() - 1);
//LOG4_ERROR("SEQ DEL KEY:" << __tos(m_key << "@" << keyId));
}