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.5#ifndef STORAGE_LEVELDB_DB_LOG_WRITER_H_6#define STORAGE_LEVELDB_DB_LOG_WRITER_H_8#include <stdint.h>10#include "db/log_format.h"11#include "leveldb/slice.h"12#include "leveldb/status.h"14namespace leveldb {16class WritableFile;18namespace log {20class Writer {21public:22// Create a writer that will append data to "*dest".23// "*dest" must be initially empty.24// "*dest" must remain live while this Writer is in use.25explicit Writer(WritableFile* dest);27// Create a writer that will append data to "*dest".28// "*dest" must have initial length "dest_length".29// "*dest" must remain live while this Writer is in use.30Writer(WritableFile* dest, uint64_t dest_length);32Writer(const Writer&) = delete;33Writer& operator=(const Writer&) = delete;35~Writer();37Status AddRecord(const Slice& slice);39private:40Status EmitPhysicalRecord(RecordType type, const char* ptr, size_t length);42WritableFile* dest_;43int block_offset_; // Current offset in block45// crc32c values for all supported record types. These are46// pre-computed to reduce the overhead of computing the crc of the47// record type stored in the header.48uint32_t type_crc_[kMaxRecordType + 1];49};51} // namespace log52} // namespace leveldb54#endif // STORAGE_LEVELDB_DB_LOG_WRITER_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.