mirror of
https://github.com/facebook/rocksdb.git
synced 2024-11-27 02:44:18 +00:00
62d48571de
Summary: Added kMetaDatabase for meta-databases in db/filename.h along with supporting fuctions. Fixed switch in DBImpl so that it also handles kMetaDatabase. Fixed DestroyDB() that it can handle destroying meta-databases. Test Plan: make check Reviewers: sheki, emayanke, vamsi, dhruba Reviewed By: dhruba Differential Revision: https://reviews.facebook.net/D7245
98 lines
3.5 KiB
C++
98 lines
3.5 KiB
C++
// Copyright (c) 2011 The LevelDB Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
// found in the LICENSE file. See the AUTHORS file for names of contributors.
|
|
//
|
|
// File names used by DB code
|
|
|
|
#ifndef STORAGE_LEVELDB_DB_FILENAME_H_
|
|
#define STORAGE_LEVELDB_DB_FILENAME_H_
|
|
|
|
#include <stdint.h>
|
|
#include <string>
|
|
#include "leveldb/slice.h"
|
|
#include "leveldb/status.h"
|
|
#include "port/port.h"
|
|
|
|
namespace leveldb {
|
|
|
|
class Env;
|
|
|
|
enum FileType {
|
|
kLogFile,
|
|
kDBLockFile,
|
|
kTableFile,
|
|
kDescriptorFile,
|
|
kCurrentFile,
|
|
kTempFile,
|
|
kInfoLogFile, // Either the current one, or an old one
|
|
kMetaDatabase
|
|
};
|
|
|
|
// Return the name of the log file with the specified number
|
|
// in the db named by "dbname". The result will be prefixed with
|
|
// "dbname".
|
|
extern std::string LogFileName(const std::string& dbname, uint64_t number);
|
|
|
|
static const std::string ARCHIVAL_DIR = "archive";
|
|
|
|
extern std::string ArchivalDirectory(const std::string& dbname);
|
|
|
|
// Return the name of the archived log file with the specified number
|
|
// in the db named by "dbname". The result will be prefixed with "dbname".
|
|
extern std::string ArchivedLogFileName(const std::string& dbname,
|
|
uint64_t num);
|
|
|
|
// Return the name of the sstable with the specified number
|
|
// in the db named by "dbname". The result will be prefixed with
|
|
// "dbname".
|
|
extern std::string TableFileName(const std::string& dbname, uint64_t number);
|
|
|
|
// Return the name of the descriptor file for the db named by
|
|
// "dbname" and the specified incarnation number. The result will be
|
|
// prefixed with "dbname".
|
|
extern std::string DescriptorFileName(const std::string& dbname,
|
|
uint64_t number);
|
|
|
|
// Return the name of the current file. This file contains the name
|
|
// of the current manifest file. The result will be prefixed with
|
|
// "dbname".
|
|
extern std::string CurrentFileName(const std::string& dbname);
|
|
|
|
// Return the name of the lock file for the db named by
|
|
// "dbname". The result will be prefixed with "dbname".
|
|
extern std::string LockFileName(const std::string& dbname);
|
|
|
|
// Return the name of a temporary file owned by the db named "dbname".
|
|
// The result will be prefixed with "dbname".
|
|
extern std::string TempFileName(const std::string& dbname, uint64_t number);
|
|
|
|
// Return the name of the info log file for "dbname".
|
|
extern std::string InfoLogFileName(const std::string& dbname,
|
|
const std::string& db_path="", const std::string& log_dir="");
|
|
|
|
// Return the name of the old info log file for "dbname".
|
|
extern std::string OldInfoLogFileName(const std::string& dbname, uint64_t ts,
|
|
const std::string& db_path="", const std::string& log_dir="");
|
|
|
|
// Return the name to use for a metadatabase. The result will be prefixed with
|
|
// "dbname".
|
|
extern std::string MetaDatabaseName(const std::string& dbname,
|
|
uint64_t number);
|
|
|
|
// If filename is a leveldb file, store the type of the file in *type.
|
|
// The number encoded in the filename is stored in *number. If the
|
|
// filename was successfully parsed, returns true. Else return false.
|
|
extern bool ParseFileName(const std::string& filename,
|
|
uint64_t* number,
|
|
FileType* type);
|
|
|
|
// Make the CURRENT file point to the descriptor file with the
|
|
// specified number.
|
|
extern Status SetCurrentFile(Env* env, const std::string& dbname,
|
|
uint64_t descriptor_number);
|
|
|
|
|
|
} // namespace leveldb
|
|
|
|
#endif // STORAGE_LEVELDB_DB_FILENAME_H_
|