Inside Bitcoin
Opening the selected file…
Inside Bitcoin
Opening the selected file…
The code behind the network, with room to understand it.
Release published 2026-10-28 · Snapshot fetched 2026-11-01. Latest stable release at fetch time; development branches and Git history are excluded. Only the selected code window and visible folders load here.
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 be3// found in the LICENSE file. See the AUTHORS file for names of contributors.4//5// File names used by DB code7#ifndef STORAGE_LEVELDB_DB_FILENAME_H_8#define STORAGE_LEVELDB_DB_FILENAME_H_10#include <stdint.h>12#include <string>14#include "leveldb/slice.h"15#include "leveldb/status.h"16#include "port/port.h"18namespace leveldb {20class Env;22enum FileType {23kLogFile,24kDBLockFile,25kTableFile,26kDescriptorFile,27kCurrentFile,28kTempFile,29kInfoLogFile // Either the current one, or an old one30};32// Return the name of the log file with the specified number33// in the db named by "dbname". The result will be prefixed with34// "dbname".35std::string LogFileName(const std::string& dbname, uint64_t number);37// Return the name of the sstable with the specified number38// in the db named by "dbname". The result will be prefixed with39// "dbname".40std::string TableFileName(const std::string& dbname, uint64_t number);42// Return the legacy file name for an sstable with the specified number43// in the db named by "dbname". The result will be prefixed with44// "dbname".45std::string SSTTableFileName(const std::string& dbname, uint64_t number);47// Return the name of the descriptor file for the db named by48// "dbname" and the specified incarnation number. The result will be49// prefixed with "dbname".50std::string DescriptorFileName(const std::string& dbname, uint64_t number);52// Return the name of the current file. This file contains the name53// of the current manifest file. The result will be prefixed with54// "dbname".55std::string CurrentFileName(const std::string& dbname);57// Return the name of the lock file for the db named by58// "dbname". The result will be prefixed with "dbname".59std::string LockFileName(const std::string& dbname);61// Return the name of a temporary file owned by the db named "dbname".62// The result will be prefixed with "dbname".63std::string TempFileName(const std::string& dbname, uint64_t number);65// Return the name of the info log file for "dbname".66std::string InfoLogFileName(const std::string& dbname);68// Return the name of the old info log file for "dbname".69std::string OldInfoLogFileName(const std::string& dbname);71// If filename is a leveldb file, store the type of the file in *type.72// The number encoded in the filename is stored in *number. If the73// filename was successfully parsed, returns true. Else return false.74bool ParseFileName(const std::string& filename, uint64_t* number,75FileType* type);77// Make the CURRENT file point to the descriptor file with the78// specified number.79Status SetCurrentFile(Env* env, const std::string& dbname,80uint64_t descriptor_number);82} // namespace leveldb84#endif // STORAGE_LEVELDB_DB_FILENAME_H_
Independent explanations by MyBitcoinExplorer. Not affiliated with or endorsed by Bitcoin Core. Guides are educational and do not replace the source or its tests.
Bitcoin Core source © its contributors, distributed under the MIT license. Original notices and bundled third-party licenses are retained in the source tree.