Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-08-28 08:26:59

0001 // Licensed to the Apache Software Foundation (ASF) under one
0002 // or more contributor license agreements.  See the NOTICE file
0003 // distributed with this work for additional information
0004 // regarding copyright ownership.  The ASF licenses this file
0005 // to you under the Apache License, Version 2.0 (the
0006 // "License"); you may not use this file except in compliance
0007 // with the License.  You may obtain a copy of the License at
0008 //
0009 //   http://www.apache.org/licenses/LICENSE-2.0
0010 //
0011 // Unless required by applicable law or agreed to in writing,
0012 // software distributed under the License is distributed on an
0013 // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
0014 // KIND, either express or implied.  See the License for the
0015 // specific language governing permissions and limitations
0016 // under the License.
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 }  // namespace io
0067 }  // namespace arrow