@ -172,7 +172,7 @@ public:
*
*
* @ return [ description ]
* @ return [ description ]
*/
*/
Status InvalidateCache ( size_t offset , size_t length ) {
Status InvalidateCache ( size_t /*offset*/ , size_t /*length*/ ) {
return Status : : OK ( ) ;
return Status : : OK ( ) ;
}
}
} ;
} ;
@ -237,8 +237,7 @@ public:
} ;
} ;
//enum AccessPattern { NORMAL, RANDOM, SEQUENTIAL, WILLNEED, DONTNEED };
//enum AccessPattern { NORMAL, RANDOM, SEQUENTIAL, WILLNEED, DONTNEED };
void Hint ( AccessPattern pattern ) {
void Hint ( AccessPattern /*pattern*/ ) { /* Do nothing */
/* Do nothing */
}
}
/**
/**
@ -250,7 +249,7 @@ public:
*
*
* @ return [ description ]
* @ return [ description ]
*/
*/
Status InvalidateCache ( size_t offset , size_t length ) {
Status InvalidateCache ( size_t /*offset*/ , size_t /*length*/ ) {
return Status : : OK ( ) ;
return Status : : OK ( ) ;
}
}
} ;
} ;
@ -315,6 +314,7 @@ class LibradosWritableFile : public WritableFile {
Sync ( ) ;
Sync ( ) ;
}
}
using WritableFile : : Append ;
/**
/**
* @ brief append data to file
* @ brief append data to file
* @ details
* @ details
@ -324,7 +324,7 @@ class LibradosWritableFile : public WritableFile {
* @ param data [ description ]
* @ param data [ description ]
* @ return [ description ]
* @ return [ description ]
*/
*/
Status Append ( const Slice & data ) {
Status Append ( const Slice & data ) override {
// append buffer
// append buffer
LOG_DEBUG ( " [IN] %i | %s \n " , ( int ) data . size ( ) , data . data ( ) ) ;
LOG_DEBUG ( " [IN] %i | %s \n " , ( int ) data . size ( ) , data . data ( ) ) ;
int r = 0 ;
int r = 0 ;
@ -341,14 +341,14 @@ class LibradosWritableFile : public WritableFile {
return err_to_status ( r ) ;
return err_to_status ( r ) ;
}
}
using WritableFile : : PositionedAppend ;
/**
/**
* @ brief not supported
* @ brief not supported
* @ details [ long description ]
* @ details [ long description ]
* @ return [ description ]
* @ return [ description ]
*/
*/
Status PositionedAppend (
Status PositionedAppend ( const Slice & /* data */ ,
const Slice & /* data */ ,
uint64_t /* offset */ ) override {
uint64_t /* offset */ ) {
return Status : : NotSupported ( ) ;
return Status : : NotSupported ( ) ;
}
}
@ -359,7 +359,7 @@ class LibradosWritableFile : public WritableFile {
* @ param size [ description ]
* @ param size [ description ]
* @ return [ description ]
* @ return [ description ]
*/
*/
Status Truncate ( uint64_t size ) {
Status Truncate ( uint64_t size ) override {
LOG_DEBUG ( " [IN]%lld|%lld|%lld \n " , ( long long ) size , ( long long ) _file_size , ( long long ) _buffer_size ) ;
LOG_DEBUG ( " [IN]%lld|%lld|%lld \n " , ( long long ) size , ( long long ) _file_size , ( long long ) _buffer_size ) ;
int r = 0 ;
int r = 0 ;
@ -391,7 +391,7 @@ class LibradosWritableFile : public WritableFile {
* @ details [ long description ]
* @ details [ long description ]
* @ return [ description ]
* @ return [ description ]
*/
*/
Status Close ( ) {
Status Close ( ) override {
LOG_DEBUG ( " %s | %lld | %lld \n " , _hint . c_str ( ) , ( long long ) _buffer_size , ( long long ) _file_size ) ;
LOG_DEBUG ( " %s | %lld | %lld \n " , _hint . c_str ( ) , ( long long ) _buffer_size , ( long long ) _file_size ) ;
return Sync ( ) ;
return Sync ( ) ;
}
}
@ -402,7 +402,7 @@ class LibradosWritableFile : public WritableFile {
*
*
* @ return [ description ]
* @ return [ description ]
*/
*/
Status Flush ( ) {
Status Flush ( ) override {
librados : : AioCompletion * write_completion = librados : : Rados : : aio_create_completion ( ) ;
librados : : AioCompletion * write_completion = librados : : Rados : : aio_create_completion ( ) ;
int r = 0 ;
int r = 0 ;
@ -425,7 +425,7 @@ class LibradosWritableFile : public WritableFile {
* @ details initiate an aio write and wait for result
* @ details initiate an aio write and wait for result
* @ return [ description ]
* @ return [ description ]
*/
*/
Status Sync ( ) { // sync data
Status Sync ( ) override { // sync data
int r = 0 ;
int r = 0 ;
std : : lock_guard < std : : mutex > lock ( _mutex ) ;
std : : lock_guard < std : : mutex > lock ( _mutex ) ;
@ -441,18 +441,14 @@ class LibradosWritableFile : public WritableFile {
* @ details [ long description ]
* @ details [ long description ]
* @ return true if Sync ( ) and Fsync ( ) are safe to call concurrently with Append ( ) and Flush ( ) .
* @ return true if Sync ( ) and Fsync ( ) are safe to call concurrently with Append ( ) and Flush ( ) .
*/
*/
bool IsSyncThreadSafe ( ) const {
bool IsSyncThreadSafe ( ) const override { return true ; }
return true ;
}
/**
/**
* @ brief Indicates the upper layers if the current WritableFile implementation uses direct IO .
* @ brief Indicates the upper layers if the current WritableFile implementation uses direct IO .
* @ details [ long description ]
* @ details [ long description ]
* @ return [ description ]
* @ return [ description ]
*/
*/
bool use_direct_io ( ) const {
bool use_direct_io ( ) const override { return false ; }
return false ;
}
/**
/**
* @ brief Get file size
* @ brief Get file size
@ -460,7 +456,7 @@ class LibradosWritableFile : public WritableFile {
* This API will use cached file_size .
* This API will use cached file_size .
* @ return [ description ]
* @ return [ description ]
*/
*/
uint64_t GetFileSize ( ) {
uint64_t GetFileSize ( ) override {
LOG_DEBUG ( " %lld|%lld \n " , ( long long ) _buffer_size , ( long long ) _file_size ) ;
LOG_DEBUG ( " %lld|%lld \n " , ( long long ) _buffer_size , ( long long ) _file_size ) ;
std : : lock_guard < std : : mutex > lock ( _mutex ) ;
std : : lock_guard < std : : mutex > lock ( _mutex ) ;
@ -478,7 +474,7 @@ class LibradosWritableFile : public WritableFile {
*
*
* @ return [ description ]
* @ return [ description ]
*/
*/
size_t GetUniqueId ( char * id , size_t max_size ) const {
size_t GetUniqueId ( char * id , size_t max_size ) const override {
// All fid has the same db_id prefix, so we need to ignore db_id prefix
// All fid has the same db_id prefix, so we need to ignore db_id prefix
size_t s = std : : min ( max_size , _fid . size ( ) ) ;
size_t s = std : : min ( max_size , _fid . size ( ) ) ;
strncpy ( id , _fid . c_str ( ) + ( _fid . size ( ) - s ) , s ) ;
strncpy ( id , _fid . c_str ( ) + ( _fid . size ( ) - s ) , s ) ;
@ -495,11 +491,10 @@ class LibradosWritableFile : public WritableFile {
*
*
* @ return [ description ]
* @ return [ description ]
*/
*/
Status InvalidateCache ( size_t offset , size_t length ) {
Status InvalidateCache ( size_t /*offset*/ , size_t /*length*/ ) override {
return Status : : OK ( ) ;
return Status : : OK ( ) ;
}
}
using WritableFile : : RangeSync ;
/**
/**
* @ brief No RangeSync support , just call Sync ( )
* @ brief No RangeSync support , just call Sync ( )
* @ details [ long description ]
* @ details [ long description ]
@ -509,12 +504,11 @@ class LibradosWritableFile : public WritableFile {
*
*
* @ return [ description ]
* @ return [ description ]
*/
*/
Status RangeSync ( off_t offset , off_t nbytes ) {
Status RangeSync ( uint64_t /*offset*/ , uint64_t /*nbytes*/ ) override {
return Sync ( ) ;
return Sync ( ) ;
}
}
protected :
protected :
using WritableFile : : Allocate ;
/**
/**
* @ brief noop
* @ brief noop
* @ details [ long description ]
* @ details [ long description ]
@ -524,7 +518,7 @@ protected:
*
*
* @ return [ description ]
* @ return [ description ]
*/
*/
Status Allocate ( off_t offset , off_t len ) {
Status Allocate ( uint64_t /*offset*/ , uint64_t /*len*/ ) override {
return Status : : OK ( ) ;
return Status : : OK ( ) ;
}
}
} ;
} ;
@ -533,16 +527,14 @@ protected:
// Directory object represents collection of files and implements
// Directory object represents collection of files and implements
// filesystem operations that can be executed on directories.
// filesystem operations that can be executed on directories.
class LibradosDirectory : public Directory {
class LibradosDirectory : public Directory {
librados : : IoCtx * _io_ctx ;
std : : string _fid ;
std : : string _fid ;
public :
public :
explicit LibradosDirectory ( librados : : IoCtx * io_ctx , std : : string fid ) :
explicit LibradosDirectory ( librados : : IoCtx * /*io_ctx*/ , std : : string fid )
_io_ctx ( io_ctx ) , _fid ( fid ) { }
: _fid ( fid ) { }
// Fsync directory. Can be called concurrently from multiple threads.
// Fsync directory. Can be called concurrently from multiple threads.
Status Fsync ( ) {
Status Fsync ( ) { return Status : : OK ( ) ; }
return Status : : OK ( ) ;
}
} ;
} ;
// Identifies a locked file.
// Identifies a locked file.
@ -552,7 +544,7 @@ class LibradosFileLock : public FileLock {
const std : : string _obj_name ;
const std : : string _obj_name ;
const std : : string _lock_name ;
const std : : string _lock_name ;
const std : : string _cookie ;
const std : : string _cookie ;
int lock_state ;
public :
public :
LibradosFileLock (
LibradosFileLock (
librados : : IoCtx * io_ctx ,
librados : : IoCtx * io_ctx ,
@ -870,11 +862,9 @@ librados::IoCtx* EnvLibrados::_GetIoctx(const std::string& fpath) {
* @ param options [ description ]
* @ param options [ description ]
* @ return [ description ]
* @ return [ description ]
*/
*/
Status EnvLibrados : : NewSequentialFile (
Status EnvLibrados : : NewSequentialFile ( const std : : string & fname ,
const std : : string & fname ,
std : : unique_ptr < SequentialFile > * result ,
std : : unique_ptr < SequentialFile > * result ,
const EnvOptions & options )
const EnvOptions & /*options*/ ) {
{
LOG_DEBUG ( " [IN]%s \n " , fname . c_str ( ) ) ;
LOG_DEBUG ( " [IN]%s \n " , fname . c_str ( ) ) ;
std : : string dir , file , fid ;
std : : string dir , file , fid ;
split ( fname , & dir , & file ) ;
split ( fname , & dir , & file ) ;
@ -914,10 +904,8 @@ Status EnvLibrados::NewSequentialFile(
* @ return [ description ]
* @ return [ description ]
*/
*/
Status EnvLibrados : : NewRandomAccessFile (
Status EnvLibrados : : NewRandomAccessFile (
const std : : string & fname ,
const std : : string & fname , std : : unique_ptr < RandomAccessFile > * result ,
std : : unique_ptr < RandomAccessFile > * result ,
const EnvOptions & /*options*/ ) {
const EnvOptions & options )
{
LOG_DEBUG ( " [IN]%s \n " , fname . c_str ( ) ) ;
LOG_DEBUG ( " [IN]%s \n " , fname . c_str ( ) ) ;
std : : string dir , file , fid ;
std : : string dir , file , fid ;
split ( fname , & dir , & file ) ;
split ( fname , & dir , & file ) ;
@ -1374,6 +1362,8 @@ Status EnvLibrados::LinkFile(
const std : : string & src ,
const std : : string & src ,
const std : : string & target_in )
const std : : string & target_in )
{
{
( void ) src ;
( void ) target_in ;
LOG_DEBUG ( " [IO]%s => %s \n " , src . c_str ( ) , target_in . c_str ( ) ) ;
LOG_DEBUG ( " [IO]%s => %s \n " , src . c_str ( ) , target_in . c_str ( ) ) ;
return Status : : NotSupported ( ) ;
return Status : : NotSupported ( ) ;
}
}
@ -1455,10 +1445,9 @@ Status EnvLibrados::UnlockFile(FileLock* lock)
*
*
* @ return [ description ]
* @ return [ description ]
*/
*/
Status EnvLibrados : : GetAbsolutePath (
Status EnvLibrados : : GetAbsolutePath ( const std : : string & db_path ,
const std : : string & db_path ,
std : : string * /*output_path*/ ) {
std : : string * output_path )
( void ) db_path ;
{
LOG_DEBUG ( " [IO]%s \n " , db_path . c_str ( ) ) ;
LOG_DEBUG ( " [IO]%s \n " , db_path . c_str ( ) ) ;
return Status : : NotSupported ( ) ;
return Status : : NotSupported ( ) ;
}
}