MCPcopy Create free account
hub / github.com/apache/arrow / PurgeLocalFileFromOsCache

Function PurgeLocalFileFromOsCache

cpp/src/arrow/io/test_common.cc:54–74  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

52bool FileExists(const std::string& path) { return std::ifstream(path.c_str()).good(); }
53
54Status PurgeLocalFileFromOsCache(const std::string& path) {
55#if defined(POSIX_FADV_WILLNEED)
56 int fd = open(path.c_str(), O_WRONLY);
57 if (fd < 0) {
58 return IOErrorFromErrno(errno, "open on ", path,
59 " to clear from cache did not succeed.");
60 }
61 int err = posix_fadvise(fd, 0, 0, POSIX_FADV_DONTNEED);
62 if (err != 0) {
63 return IOErrorFromErrno(err, "fadvise on ", path,
64 " to clear from cache did not succeed");
65 }
66 err = close(fd);
67 if (err == 0) {
68 return Status::OK();
69 }
70 return IOErrorFromErrno(err, "close on ", path, " to clear from cache did not succeed");
71#else
72 return Status::NotImplemented("posix_fadvise is not implemented on this machine");
73#endif
74}
75
76Status ZeroMemoryMap(MemoryMappedFile* file) {
77 constexpr int64_t kBufferSize = 512;

Callers

nothing calls this directly

Calls 3

IOErrorFromErrnoFunction · 0.85
OKFunction · 0.50
NotImplementedFunction · 0.50

Tested by

no test coverage detected