@ -702,6 +702,13 @@ class FSRandomAccessFile {
// RandomAccessFileWrapper too.
// RandomAccessFileWrapper too.
} ;
} ;
// A data structure brings the data verification information, which is
// used togther with data being written to a file.
struct DataVerificationInfo {
// checksum of the data being written.
Slice checksum ;
} ;
// A file abstraction for sequential writing. The implementation
// A file abstraction for sequential writing. The implementation
// must provide buffering since callers may append small fragments
// must provide buffering since callers may append small fragments
// at a time to the file.
// at a time to the file.
@ -729,6 +736,16 @@ class FSWritableFile {
virtual IOStatus Append ( const Slice & data , const IOOptions & options ,
virtual IOStatus Append ( const Slice & data , const IOOptions & options ,
IODebugContext * dbg ) = 0 ;
IODebugContext * dbg ) = 0 ;
// EXPERIMENTAL / CURRENTLY UNUSED
// Append data with verification information
// Note that this API change is experimental and it might be changed in
// the future. Currently, RocksDB does not use this API.
virtual IOStatus Append ( const Slice & data , const IOOptions & options ,
const DataVerificationInfo & /* verification_info */ ,
IODebugContext * dbg ) {
return Append ( data , options , dbg ) ;
}
// PositionedAppend data to the specified offset. The new EOF after append
// PositionedAppend data to the specified offset. The new EOF after append
// must be larger than the previous EOF. This is to be used when writes are
// must be larger than the previous EOF. This is to be used when writes are
// not backed by OS buffers and hence has to always start from the start of
// not backed by OS buffers and hence has to always start from the start of
@ -756,6 +773,18 @@ class FSWritableFile {
return IOStatus : : NotSupported ( ) ;
return IOStatus : : NotSupported ( ) ;
}
}
// EXPERIMENTAL / CURRENTLY UNUSED
// PositionedAppend data with verification information.
// Note that this API change is experimental and it might be changed in
// the future. Currently, RocksDB does not use this API.
virtual IOStatus PositionedAppend (
const Slice & /* data */ , uint64_t /* offset */ ,
const IOOptions & /*options*/ ,
const DataVerificationInfo & /* verification_info */ ,
IODebugContext * /*dbg*/ ) {
return IOStatus : : NotSupported ( ) ;
}
// Truncate is necessary to trim the file to the correct size
// Truncate is necessary to trim the file to the correct size
// before closing. It is not always possible to keep track of the file
// before closing. It is not always possible to keep track of the file
// size due to whole pages writes. The behavior is undefined if called
// size due to whole pages writes. The behavior is undefined if called
@ -1286,11 +1315,23 @@ class FSWritableFileWrapper : public FSWritableFile {
IODebugContext * dbg ) override {
IODebugContext * dbg ) override {
return target_ - > Append ( data , options , dbg ) ;
return target_ - > Append ( data , options , dbg ) ;
}
}
IOStatus Append ( const Slice & data , const IOOptions & options ,
const DataVerificationInfo & verification_info ,
IODebugContext * dbg ) override {
return target_ - > Append ( data , options , verification_info , dbg ) ;
}
IOStatus PositionedAppend ( const Slice & data , uint64_t offset ,
IOStatus PositionedAppend ( const Slice & data , uint64_t offset ,
const IOOptions & options ,
const IOOptions & options ,
IODebugContext * dbg ) override {
IODebugContext * dbg ) override {
return target_ - > PositionedAppend ( data , offset , options , dbg ) ;
return target_ - > PositionedAppend ( data , offset , options , dbg ) ;
}
}
IOStatus PositionedAppend ( const Slice & data , uint64_t offset ,
const IOOptions & options ,
const DataVerificationInfo & verification_info ,
IODebugContext * dbg ) override {
return target_ - > PositionedAppend ( data , offset , options , verification_info ,
dbg ) ;
}
IOStatus Truncate ( uint64_t size , const IOOptions & options ,
IOStatus Truncate ( uint64_t size , const IOOptions & options ,
IODebugContext * dbg ) override {
IODebugContext * dbg ) override {
return target_ - > Truncate ( size , options , dbg ) ;
return target_ - > Truncate ( size , options , dbg ) ;