File indexing completed on 2025-08-28 08:26:59
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018 #pragma once
0019
0020 #include <memory>
0021 #include <string>
0022 #include <vector>
0023
0024 #include "arrow/io/interfaces.h"
0025 #include "arrow/testing/visibility.h"
0026 #include "arrow/type_fwd.h"
0027
0028 namespace arrow {
0029 namespace io {
0030
0031 class MemoryMappedFile;
0032
0033 ARROW_TESTING_EXPORT
0034 void AssertFileContents(const std::string& path, const std::string& contents);
0035
0036 ARROW_TESTING_EXPORT bool FileExists(const std::string& path);
0037
0038 ARROW_TESTING_EXPORT Status PurgeLocalFileFromOsCache(const std::string& path);
0039
0040 ARROW_TESTING_EXPORT
0041 Status ZeroMemoryMap(MemoryMappedFile* file);
0042
0043 class ARROW_TESTING_EXPORT MemoryMapFixture {
0044 public:
0045 void TearDown();
0046
0047 void CreateFile(const std::string& path, int64_t size);
0048
0049 Result<std::shared_ptr<MemoryMappedFile>> InitMemoryMap(int64_t size,
0050 const std::string& path);
0051
0052 void AppendFile(const std::string& path);
0053
0054 private:
0055 std::vector<std::string> tmp_files_;
0056 };
0057
0058 class ARROW_TESTING_EXPORT TrackedRandomAccessFile : public io::RandomAccessFile {
0059 public:
0060 virtual int64_t num_reads() const = 0;
0061 virtual int64_t bytes_read() const = 0;
0062 virtual const std::vector<io::ReadRange>& get_read_ranges() const = 0;
0063 static std::unique_ptr<TrackedRandomAccessFile> Make(io::RandomAccessFile* target);
0064 };
0065
0066 }
0067 }