@ -80,19 +80,21 @@ std::string BlobFile::PathName() const {
return BlobFileName ( path_to_dir_ , file_number_ ) ;
return BlobFileName ( path_to_dir_ , file_number_ ) ;
}
}
std : : shared_ptr < Reader > BlobFile : : OpenSequential Reader (
std : : shared_ptr < Reader > BlobFile : : OpenRandomAccess Reader (
Env * env , const DBOptions & db_options ,
Env * env , const DBOptions & db_options ,
const EnvOptions & env_options ) const {
const EnvOptions & env_options ) const {
std : : unique_ptr < SequentialFile > sfile ;
constexpr size_t kReadaheadSize = 2 * 1024 * 1024 ;
std : : unique_ptr < RandomAccessFile > sfile ;
std : : string path_name ( PathName ( ) ) ;
std : : string path_name ( PathName ( ) ) ;
Status s = env - > NewSequential File ( path_name , & sfile , env_options ) ;
Status s = env - > NewRandomAccess File ( path_name , & sfile , env_options ) ;
if ( ! s . ok ( ) ) {
if ( ! s . ok ( ) ) {
// report something here.
// report something here.
return nullptr ;
return nullptr ;
}
}
sfile = NewReadaheadRandomAccessFile ( std : : move ( sfile ) , kReadaheadSize ) ;
std : : unique_ptr < Sequential FileReader> sfile_reader ;
std : : unique_ptr < RandomAccess FileReader> sfile_reader ;
sfile_reader . reset ( new Sequential FileReader( std : : move ( sfile ) , path_name ) ) ;
sfile_reader . reset ( new RandomAccess FileReader( std : : move ( sfile ) , path_name ) ) ;
std : : shared_ptr < Reader > log_reader = std : : make_shared < Reader > (
std : : shared_ptr < Reader > log_reader = std : : make_shared < Reader > (
std : : move ( sfile_reader ) , db_options . env , db_options . statistics . get ( ) ) ;
std : : move ( sfile_reader ) , db_options . env , db_options . statistics . get ( ) ) ;