Feathercoin  0.5.0
P2P Digital Currency
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros
filename.h
Go to the documentation of this file.
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 
7 #ifndef STORAGE_LEVELDB_DB_FILENAME_H_
8 #define STORAGE_LEVELDB_DB_FILENAME_H_
9 
10 #include <stdint.h>
11 #include <string>
12 #include "leveldb/slice.h"
13 #include "leveldb/status.h"
14 #include "port/port.h"
15 
16 namespace leveldb {
17 
18 class Env;
19 
20 enum FileType {
27  kInfoLogFile // Either the current one, or an old one
28 };
29 
30 // Return the name of the log file with the specified number
31 // in the db named by "dbname". The result will be prefixed with
32 // "dbname".
33 extern std::string LogFileName(const std::string& dbname, uint64_t number);
34 
35 // Return the name of the sstable with the specified number
36 // in the db named by "dbname". The result will be prefixed with
37 // "dbname".
38 extern std::string TableFileName(const std::string& dbname, uint64_t number);
39 
40 // Return the name of the descriptor file for the db named by
41 // "dbname" and the specified incarnation number. The result will be
42 // prefixed with "dbname".
43 extern std::string DescriptorFileName(const std::string& dbname,
44  uint64_t number);
45 
46 // Return the name of the current file. This file contains the name
47 // of the current manifest file. The result will be prefixed with
48 // "dbname".
49 extern std::string CurrentFileName(const std::string& dbname);
50 
51 // Return the name of the lock file for the db named by
52 // "dbname". The result will be prefixed with "dbname".
53 extern std::string LockFileName(const std::string& dbname);
54 
55 // Return the name of a temporary file owned by the db named "dbname".
56 // The result will be prefixed with "dbname".
57 extern std::string TempFileName(const std::string& dbname, uint64_t number);
58 
59 // Return the name of the info log file for "dbname".
60 extern std::string InfoLogFileName(const std::string& dbname);
61 
62 // Return the name of the old info log file for "dbname".
63 extern std::string OldInfoLogFileName(const std::string& dbname);
64 
65 // If filename is a leveldb file, store the type of the file in *type.
66 // The number encoded in the filename is stored in *number. If the
67 // filename was successfully parsed, returns true. Else return false.
68 extern bool ParseFileName(const std::string& filename,
69  uint64_t* number,
70  FileType* type);
71 
72 // Make the CURRENT file point to the descriptor file with the
73 // specified number.
74 extern Status SetCurrentFile(Env* env, const std::string& dbname,
75  uint64_t descriptor_number);
76 
77 
78 } // namespace leveldb
79 
80 #endif // STORAGE_LEVELDB_DB_FILENAME_H_
bool ParseFileName(const std::string &fname, uint64_t *number, FileType *type)
Definition: filename.cc:75
std::string OldInfoLogFileName(const std::string &dbname)
Definition: filename.cc:63
std::string TempFileName(const std::string &dbname, uint64_t number)
Definition: filename.cc:53
std::string InfoLogFileName(const std::string &dbname)
Definition: filename.cc:58
std::string TableFileName(const std::string &name, uint64_t number)
Definition: filename.cc:32
std::string DescriptorFileName(const std::string &dbname, uint64_t number)
Definition: filename.cc:37
unsigned long long uint64_t
Definition: stdint.h:22
Status SetCurrentFile(Env *env, const std::string &dbname, uint64_t descriptor_number)
Definition: filename.cc:121
std::string CurrentFileName(const std::string &dbname)
Definition: filename.cc:45
std::string LogFileName(const std::string &name, uint64_t number)
Definition: filename.cc:27
FileType
Definition: filename.h:20
std::string LockFileName(const std::string &dbname)
Definition: filename.cc:49