10225501448 李度 10225101546 陈胤遒 10215501422 高宇菲
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

83 lignes
2.8 KiB

  1. // Copyright (c) 2011 The LevelDB Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file. See the AUTHORS file for names of contributors.
  4. //
  5. // File names used by DB code
  6. #ifndef STORAGE_LEVELDB_DB_FILENAME_H_
  7. #define STORAGE_LEVELDB_DB_FILENAME_H_
  8. #include <stdint.h>
  9. #include <string>
  10. #include "leveldb/slice.h"
  11. #include "leveldb/status.h"
  12. #include "port/port.h"
  13. namespace leveldb {
  14. class Env;
  15. enum FileType {
  16. kLogFile,
  17. kDBLockFile,
  18. kTableFile,
  19. kDescriptorFile,
  20. kCurrentFile,
  21. kTempFile,
  22. kInfoLogFile // Either the current one, or an old one
  23. };
  24. // Return the name of the log file with the specified number
  25. // in the db named by "dbname". The result will be prefixed with
  26. // "dbname".
  27. std::string LogFileName(const std::string& dbname, uint64_t number);
  28. // Return the name of the sstable with the specified number
  29. // in the db named by "dbname". The result will be prefixed with
  30. // "dbname".
  31. std::string TableFileName(const std::string& dbname, uint64_t number);
  32. // Return the legacy file name for an sstable with the specified number
  33. // in the db named by "dbname". The result will be prefixed with
  34. // "dbname".
  35. std::string SSTTableFileName(const std::string& dbname, uint64_t number);
  36. // Return the name of the descriptor file for the db named by
  37. // "dbname" and the specified incarnation number. The result will be
  38. // prefixed with "dbname".
  39. std::string DescriptorFileName(const std::string& dbname, uint64_t number);
  40. // Return the name of the current file. This file contains the name
  41. // of the current manifest file. The result will be prefixed with
  42. // "dbname".
  43. std::string CurrentFileName(const std::string& dbname);
  44. // Return the name of the lock file for the db named by
  45. // "dbname". The result will be prefixed with "dbname".
  46. std::string LockFileName(const std::string& dbname);
  47. // Return the name of a temporary file owned by the db named "dbname".
  48. // The result will be prefixed with "dbname".
  49. std::string TempFileName(const std::string& dbname, uint64_t number);
  50. // Return the name of the info log file for "dbname".
  51. std::string InfoLogFileName(const std::string& dbname);
  52. // Return the name of the old info log file for "dbname".
  53. std::string OldInfoLogFileName(const std::string& dbname);
  54. // If filename is a leveldb file, store the type of the file in *type.
  55. // The number encoded in the filename is stored in *number. If the
  56. // filename was successfully parsed, returns true. Else return false.
  57. bool ParseFileName(const std::string& filename,
  58. uint64_t* number,
  59. FileType* type);
  60. // Make the CURRENT file point to the descriptor file with the
  61. // specified number.
  62. Status SetCurrentFile(Env* env, const std::string& dbname,
  63. uint64_t descriptor_number);
  64. } // namespace leveldb
  65. #endif // STORAGE_LEVELDB_DB_FILENAME_H_