@ -897,15 +897,8 @@ Status BlobDBImpl::Write(const WriteOptions& opts, WriteBatch* updates) {
last_file_ = bfile ;
has_put_ = true ;
Slice value = value_unc ;
std : : string compression_output ;
if ( impl_ - > bdb_options_ . compression ! = kNoCompression ) {
CompressionType ct = impl_ - > bdb_options_ . compression ;
CompressionOptions compression_opts ;
value = CompressBlock ( value_unc , compression_opts , & ct ,
kBlockBasedTableVersionFormat , Slice ( ) ,
& compression_output ) ;
}
Slice value = impl_ - > GetCompressedSlice ( value_unc , & compression_output ) ;
std : : string headerbuf ;
Writer : : ConstructBlobHeader ( & headerbuf , key , value , expiration , - 1 ) ;
@ -1018,6 +1011,18 @@ Status BlobDBImpl::PutWithTTL(const WriteOptions& options,
: - 1 ) ;
}
Slice BlobDBImpl : : GetCompressedSlice ( const Slice & raw ,
std : : string * compression_output ) const {
if ( bdb_options_ . compression = = kNoCompression ) {
return raw ;
}
CompressionType ct = bdb_options_ . compression ;
CompressionOptions compression_opts ;
CompressBlock ( raw , compression_opts , & ct , kBlockBasedTableVersionFormat ,
Slice ( ) , compression_output ) ;
return * compression_output ;
}
Status BlobDBImpl : : PutUntil ( const WriteOptions & options ,
ColumnFamilyHandle * column_family , const Slice & key ,
const Slice & value_unc , int32_t expiration ) {
@ -1028,15 +1033,8 @@ Status BlobDBImpl::PutUntil(const WriteOptions& options,
if ( ! bfile ) return Status : : NotFound ( " Blob file not found " ) ;
Slice value = value_unc ;
std : : string compression_output ;
if ( bdb_options_ . compression ! = kNoCompression ) {
CompressionType ct = bdb_options_ . compression ;
CompressionOptions compression_opts ;
value = CompressBlock ( value_unc , compression_opts , & ct ,
kBlockBasedTableVersionFormat , Slice ( ) ,
& compression_output ) ;
}
Slice value = GetCompressedSlice ( value_unc , & compression_output ) ;
std : : string headerbuf ;
Writer : : ConstructBlobHeader ( & headerbuf , key , value , expiration , - 1 ) ;