本文整理汇总了C++中DBC::c_set_bounds方法的典型用法代码示例。如果您正苦于以下问题:C++ DBC::c_set_bounds方法的具体用法?C++ DBC::c_set_bounds怎么用?C++ DBC::c_set_bounds使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DBC
的用法示例。
在下文中一共展示了DBC::c_set_bounds方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ftfs_bstore_scan_pages
int ftfs_bstore_scan_pages(DB *data_db, struct ftfs_meta_key *meta_key,
DB_TXN *txn, struct ftio *ftio)
{
int ret, r;
uint64_t block_num;
struct ftfs_scan_pages_cb_info info;
struct ftfs_data_key *data_key, *prefetch_data_key;
DBT key_dbt, prefetch_key_dbt;
DBC *cursor;
if (ftio_job_done(ftio))
return 0;
block_num = ftio_current_page(ftio)->index;
data_key = alloc_data_key_from_meta_key(meta_key, block_num);
if (!data_key)
return -ENOMEM;
block_num = ftio_last_page(ftio)->index;
prefetch_data_key = alloc_data_key_from_meta_key(meta_key, block_num);
if (!prefetch_data_key) {
ret = -ENOMEM;
goto out;
}
dbt_init(&key_dbt, data_key, SIZEOF_KEY(*data_key));
dbt_init(&prefetch_key_dbt, prefetch_data_key, SIZEOF_KEY(*prefetch_data_key));
ret = data_db->cursor(data_db, txn, &cursor, DB_CURSOR_FLAGS);
if (ret)
goto free_out;
ret = cursor->c_set_bounds(cursor, &key_dbt, &prefetch_key_dbt, true, 0);
if (ret)
goto close_cursor;
info.meta_key = meta_key;
info.ftio = ftio;
r = cursor->c_getf_set_range(cursor, 0, &key_dbt, ftfs_scan_pages_cb, &info);
while (info.do_continue && !r)
r = cursor->c_getf_next(cursor, 0, ftfs_scan_pages_cb, &info);
if (r && r != DB_NOTFOUND)
ret = r;
if (!ret)
ftfs_bstore_fill_rest_page(ftio);
close_cursor:
r = cursor->c_close(cursor);
BUG_ON(r);
free_out:
data_key_free(prefetch_data_key);
out:
data_key_free(data_key);
return ret;
}
示例2: _prelockRange
void IndexCursor::_prelockRange(const BSONObj &startKey, const BSONObj &endKey) {
const bool isSecondary = !_cl->isPKIndex(_idx);
// The ydb requires that we only lock ranges such that the left
// endpoint is less than or equal to the right endpoint.
// Reverse cursors describe the start and end key as the two
// keys where they start and end iteration, which is backwards
// in the key space (because they iterate in reverse).
const BSONObj &leftKey = forward() ? startKey : endKey;
const BSONObj &rightKey = forward() ? endKey : startKey;
dassert(leftKey.woCompare(rightKey, _ordering) <= 0);
storage::Key sKey(leftKey, isSecondary ? &minKey : NULL);
storage::Key eKey(rightKey, isSecondary ? &maxKey : NULL);
DBT start = sKey.dbt();
DBT end = eKey.dbt();
DBC *cursor = _cursor.dbc();
const int r = cursor->c_set_bounds( cursor, &start, &end, true, 0 );
if ( r != 0 ) {
storage::handle_ydb_error(r);
}
}