@ -12,10 +12,7 @@ namespace rocksdb {
LDBOptions : : LDBOptions ( ) { }
LDBOptions : : LDBOptions ( ) { }
class LDBCommandRunner {
void LDBCommandRunner : : PrintHelp ( const char * exec_name ) {
public :
static void PrintHelp ( const char * exec_name ) {
std : : string ret ;
std : : string ret ;
ret . append ( " ldb - LevelDB Tool " ) ;
ret . append ( " ldb - LevelDB Tool " ) ;
@ -23,7 +20,8 @@ public:
ret . append ( " commands MUST specify -- " + LDBCommand : : ARG_DB +
ret . append ( " commands MUST specify -- " + LDBCommand : : ARG_DB +
" =<full_path_to_db_directory> when necessary \n " ) ;
" =<full_path_to_db_directory> when necessary \n " ) ;
ret . append ( " \n " ) ;
ret . append ( " \n " ) ;
ret . append ( " The following optional parameters control if keys/values are "
ret . append (
" The following optional parameters control if keys/values are "
" input/output as hex or as plain strings: \n " ) ;
" input/output as hex or as plain strings: \n " ) ;
ret . append ( " -- " + LDBCommand : : ARG_KEY_HEX +
ret . append ( " -- " + LDBCommand : : ARG_KEY_HEX +
" : Keys are input/output as hex \n " ) ;
" : Keys are input/output as hex \n " ) ;
@ -37,7 +35,8 @@ public:
" family \n " ) ;
" family \n " ) ;
ret . append ( " \n " ) ;
ret . append ( " \n " ) ;
ret . append ( " The following optional parameters control the database "
ret . append (
" The following optional parameters control the database "
" internals: \n " ) ;
" internals: \n " ) ;
ret . append ( " -- " + LDBCommand : : ARG_TTL +
ret . append ( " -- " + LDBCommand : : ARG_TTL +
" with 'put','get','scan','dump','query','batchput' "
" with 'put','get','scan','dump','query','batchput' "
@ -48,8 +47,7 @@ public:
" =<no|snappy|zlib|bzip2|lz4|lz4hc|xpress|zstd> \n " ) ;
" =<no|snappy|zlib|bzip2|lz4|lz4hc|xpress|zstd> \n " ) ;
ret . append ( " -- " + LDBCommand : : ARG_COMPRESSION_MAX_DICT_BYTES +
ret . append ( " -- " + LDBCommand : : ARG_COMPRESSION_MAX_DICT_BYTES +
" =<int,e.g.:14> \n " ) ;
" =<int,e.g.:14> \n " ) ;
ret . append ( " -- " + LDBCommand : : ARG_BLOCK_SIZE +
ret . append ( " -- " + LDBCommand : : ARG_BLOCK_SIZE + " =<block_size_in_bytes> \n " ) ;
" =<block_size_in_bytes> \n " ) ;
ret . append ( " -- " + LDBCommand : : ARG_AUTO_COMPACTION + " =<true|false> \n " ) ;
ret . append ( " -- " + LDBCommand : : ARG_AUTO_COMPACTION + " =<true|false> \n " ) ;
ret . append ( " -- " + LDBCommand : : ARG_DB_WRITE_BUFFER_SIZE +
ret . append ( " -- " + LDBCommand : : ARG_DB_WRITE_BUFFER_SIZE +
" =<int,e.g.:16777216> \n " ) ;
" =<int,e.g.:16777216> \n " ) ;
@ -83,9 +81,9 @@ public:
RepairCommand : : Help ( ret ) ;
RepairCommand : : Help ( ret ) ;
fprintf ( stderr , " %s \n " , ret . c_str ( ) ) ;
fprintf ( stderr , " %s \n " , ret . c_str ( ) ) ;
}
}
static void RunCommand (
void LDBCommandRunner : : RunCommand (
int argc , char * * argv , Options options , const LDBOptions & ldb_options ,
int argc , char * * argv , Options options , const LDBOptions & ldb_options ,
const std : : vector < ColumnFamilyDescriptor > * column_families ) {
const std : : vector < ColumnFamilyDescriptor > * column_families ) {
if ( argc < = 2 ) {
if ( argc < = 2 ) {
@ -111,9 +109,7 @@ public:
delete cmdObj ;
delete cmdObj ;
exit ( ret . IsFailed ( ) ) ;
exit ( ret . IsFailed ( ) ) ;
}
}
} ;
void LDBTool : : Run ( int argc , char * * argv , Options options ,
void LDBTool : : Run ( int argc , char * * argv , Options options ,
const LDBOptions & ldb_options ,
const LDBOptions & ldb_options ,