#include <folly/io/RecordIO.h>
#include <sys/types.h>
#include <folly/Exception.h>
#include <folly/FileUtil.h>
#include <folly/Memory.h>
#include <folly/Portability.h>
#include <folly/ScopeGuard.h>
#include <folly/String.h>
#include <folly/portability/Unistd.h>
namespace folly {
usingnamespacerecordio_helpers;
RecordIOWriter::RecordIOWriter(File file, uint32_t fileId)
: … { … }
void RecordIOWriter::write(std::unique_ptr<IOBuf> buf) { … }
RecordIOReader::RecordIOReader(File file, uint32_t fileId)
: … { … }
RecordIOReader::Iterator::Iterator(ByteRange range, uint32_t fileId, off_t pos)
: … { … }
void RecordIOReader::Iterator::advanceToValid() { … }
namespace recordio_helpers {
Header;
namespace {
constexpr uint32_t kHashSeed = …;
uint32_t headerHash(const Header& header) { … }
std::pair<size_t, std::size_t> dataLengthAndHash(const IOBuf* buf) { … }
std::size_t dataHash(ByteRange range) { … }
}
size_t prependHeader(std::unique_ptr<IOBuf>& buf, uint32_t fileId) { … }
bool validateRecordHeader(ByteRange range, uint32_t fileId) { … }
RecordInfo validateRecordData(ByteRange range) { … }
RecordInfo validateRecord(ByteRange range, uint32_t fileId) { … }
RecordInfo findRecord(
ByteRange searchRange, ByteRange wholeRange, uint32_t fileId) { … }
}
}