deps/rocksdb/table/table_test.cc
// BlockBasedTableIterator should invalidate itself and return
// OutOfBound()=true immediately after Seek(), to allow LevelIterator
// filter out corresponding level.
BlockBasedTableIterator should invalidate itself and return
OutOfBound()=true immediately after Seek(), to allow LevelIterator
filter out corresponding level.
BlockBasedTableIterator should invalidate itself and return OutOfBound () = true immediately after Seek () to allow LevelIterator filter out corresponding level .
TEST_P(BlockBasedTableTest, OutOfBoundOnSeek) {
  TableConstructor c(BytewiseComparator(), true );
  c.Add("foo", "v1");
  std::vector<std::string> keys;
  stl_wrappers::KVMap kvmap;
  Options options;
  BlockBasedTableOptions table_opt(GetBlockBasedTableOptions());
  options.table_factory.reset(NewBlockBasedTableFactory(table_opt));
  const ImmutableCFOptions ioptions(options);
  const MutableCFOptions moptions(options);
  c.Finish(options, ioptions, moptions, table_opt,
           GetPlainInternalComparator(BytewiseComparator()), &keys, &kvmap);
  auto* reader = c.GetTableReader();
  ReadOptions read_opt;
  std::string upper_bound = "bar";
  Slice upper_bound_slice(upper_bound);
  read_opt.iterate_upper_bound = &upper_bound_slice;
  std::unique_ptr<InternalIterator> iter;
  iter.reset(new KeyConvertingIterator(reader->NewIterator(
      read_opt, nullptr, nullptr,
      false, TableReaderCaller::kUncategorized)));
  iter->SeekToFirst();
  ASSERT_FALSE(iter->Valid());
  ASSERT_TRUE(iter->IsOutOfBound());
  iter.reset(new KeyConvertingIterator(reader->NewIterator(
      read_opt, nullptr, nullptr,
      false, TableReaderCaller::kUncategorized)));
  iter->Seek("foo");
  ASSERT_FALSE(iter->Valid());
  ASSERT_TRUE(iter->IsOutOfBound());
}
TEST_P ( BlockBasedTableTest , OutOfBoundOnSeek ) { TableConstructor c ( BytewiseComparator ( ) , true ) ; c . Add ( " " , " " ) ; std :: vector < std :: string > keys ; stl_wrappers :: KVMap kvmap ; Options options ; BlockBasedTableOptions table_opt ( GetBlockBasedTableOptions ( ) ) ; options . table_factory . reset ( NewBlockBasedTableFactory ( table_opt ) ) ; const ImmutableCFOptions ioptions ( options ) ; const MutableCFOptions moptions ( options ) ; c . Finish ( options , ioptions , moptions , table_opt , GetPlainInternalComparator ( BytewiseComparator ( ) ) , & keys , & kvmap ) ; auto * reader = c . GetTableReader ( ) ; ReadOptions read_opt ; std :: string upper_bound = " " ; Slice upper_bound_slice ( upper_bound ) ; read_opt . iterate_upper_bound = & upper_bound_slice ; std :: unique_ptr < InternalIterator > iter ; iter . reset ( new KeyConvertingIterator ( reader -> NewIterator ( read_opt , nullptr , nullptr , false , TableReaderCaller :: kUncategorized ) ) ) ; iter -> SeekToFirst ( ) ; ASSERT_FALSE ( iter -> Valid ( ) ) ; ASSERT_TRUE ( iter -> IsOutOfBound ( ) ) ; iter . reset ( new KeyConvertingIterator ( reader -> NewIterator ( read_opt , nullptr , nullptr , false , TableReaderCaller :: kUncategorized ) ) ) ; iter -> Seek ( " " ) ; ASSERT_FALSE ( iter -> Valid ( ) ) ; ASSERT_TRUE ( iter -> IsOutOfBound ( ) ) ; }
BlockBasedTableIterator should invalidate itself and return
OutOfBound()=true immediately after Seek(), to allow LevelIterator
filter out corresponding level.
BlockBasedTableIterator should invalidate itself and return OutOfBound () = true immediately after Seek () to allow LevelIterator filter out corresponding level .
/*convert_to_internal_key*/ /*prefix_extractor=*/ /*arena=*/ /*skip_filters=*/ /*prefix_extractor=*/ /*arena=*/ /*skip_filters=*/