#include "rocksdb/utilities/db_ttl.h"
#include "rocksdb/utilities/ldb_cmd_execute_result.h"
-namespace rocksdb {
+namespace ROCKSDB_NAMESPACE {
class LDBCommand {
public:
// Command-line arguments
+ static const std::string ARG_ENV_URI;
static const std::string ARG_DB;
static const std::string ARG_PATH;
+ static const std::string ARG_SECONDARY_PATH;
static const std::string ARG_HEX;
static const std::string ARG_KEY_HEX;
static const std::string ARG_VALUE_HEX;
protected:
LDBCommandExecuteResult exec_state_;
+ std::string env_uri_;
std::string db_path_;
+ // If empty, open DB as primary. If non-empty, open the DB as secondary
+ // with this secondary path. When running against a database opened by
+ // another process, ldb wll leave the source directory completely intact.
+ std::string secondary_path_;
std::string column_family_name_;
DB* db_;
DBWithTTL* db_ttl_;
/** List of command-line options valid for this command */
const std::vector<std::string> valid_cmd_line_options_;
+ /** Shared pointer to underlying environment if applicable **/
+ std::shared_ptr<Env> env_guard_;
+
bool ParseKeyValue(const std::string& line, std::string* key,
std::string* value, bool is_key_hex, bool is_value_hex);
public:
static void PrintHelp(const LDBOptions& ldb_options, const char* exec_name);
- static void RunCommand(
+ // Returns the status code to return. 0 is no error.
+ static int RunCommand(
int argc, char** argv, Options options, const LDBOptions& ldb_options,
const std::vector<ColumnFamilyDescriptor>* column_families);
};
-} // namespace rocksdb
+} // namespace ROCKSDB_NAMESPACE
#endif // ROCKSDB_LITE