6#ifndef BITCOIN_FLATFILE_H
7#define BITCOIN_FLATFILE_H
29 return (
a.nFile ==
b.nFile &&
a.nPos ==
b.nPos);
FlatFileSeq represents a sequence of numbered files storing raw data.
fs::path FileName(const FlatFilePos &pos) const
Get the name of the file at the given position.
const size_t m_chunk_size
size_t Allocate(const FlatFilePos &pos, size_t add_size, bool &out_of_space)
Allocate additional space in a file after the given starting position.
bool Flush(const FlatFilePos &pos, bool finalize=false)
Commit a file to disk, and optionally truncate off extra pre-allocated bytes if final.
const char *const m_prefix
FILE * Open(const FlatFilePos &pos, bool read_only=false)
Open a handle to the file at the given position.
Path class wrapper to block calls to the fs::path(std::string) implicit constructor and the fs::path:...
T GetRand(T nMax=std::numeric_limits< T >::max()) noexcept
Generate a uniform random integer of type T in the range [0..nMax) nMax defaults to std::numeric_limi...
#define VARINT_MODE(obj, mode)
friend bool operator==(const FlatFilePos &a, const FlatFilePos &b)
FlatFilePos(int nFileIn, unsigned int nPosIn)
friend bool operator!=(const FlatFilePos &a, const FlatFilePos &b)
std::string ToString() const
SERIALIZE_METHODS(FlatFilePos, obj)