// newRocksDBIterator returns a new iterator over the supplied RocksDB // instance. If snapshotHandle is not nil, uses the indicated snapshot. // The caller must call rocksDBIterator.Close() when finished with the // iterator to free up resources. func newRocksDBIterator(rdb *C.DBEngine, prefix roachpb.Key) *rocksDBIterator { // In order to prevent content displacement, caching is disabled // when performing scans. Any options set within the shared read // options field that should be carried over needs to be set here // as well. return &rocksDBIterator{ iter: C.DBNewIter(rdb, goToCSlice(prefix)), } }
// newRocksDBIterator returns a new iterator over the supplied RocksDB // instance. If snapshotHandle is not nil, uses the indicated snapshot. // The caller must call rocksDBIterator.Close() when finished with the // iterator to free up resources. func newRocksDBIterator(rdb *C.DBEngine, snapshotHandle *C.DBSnapshot) *rocksDBIterator { // In order to prevent content displacement, caching is disabled // when performing scans. Any options set within the shared read // options field that should be carried over needs to be set here // as well. return &rocksDBIterator{ iter: C.DBNewIter(rdb, snapshotHandle), } }
// newRocksDBIterator returns a new iterator over the supplied RocksDB // instance. If snapshotHandle is not nil, uses the indicated snapshot. // The caller must call rocksDBIterator.Close() when finished with the // iterator to free up resources. func newRocksDBIterator(rdb *C.DBEngine, prefix bool, engine Engine) Iterator { // In order to prevent content displacement, caching is disabled // when performing scans. Any options set within the shared read // options field that should be carried over needs to be set here // as well. r := iterPool.Get().(*rocksDBIterator) r.iter = C.DBNewIter(rdb, C.bool(prefix)) r.engine = engine return r }
func (r *rocksDBIterator) init(rdb *C.DBEngine, prefix bool, engine Reader) { r.iter = C.DBNewIter(rdb, C.bool(prefix)) r.engine = engine }