55 #include "../declspec.h"
101 virtual std::string dump()
const = 0;
104 static std::string _get_string_env(
105 const std::string& value_from_cf,
106 const std::string& cfname,
107 const std::string& envname,
108 const std::string& dflt);
110 static std::int64_t _get_numeric_env(
111 std::int64_t value_from_cf,
112 const std::string& cfname,
113 const std::string& envname,
115 std::int64_t min_value,
116 std::int64_t max_value);
118 static std::string _redact(
const std::string&);
125 virtual std::string dump()
const override;
131 typedef std::function<void(
const void*, std::int64_t)> delivery_t;
135 ReadRequest(std::int64_t offset_in, std::int64_t size_in,
const delivery_t& delivery_in)
138 , delivery(delivery_in)
143 typedef std::vector<ReadRequest> ReadList;
144 typedef std::vector<ReadList> ReadDoubleList;
158 virtual void xx_read(
void *data, std::int64_t offset, std::int64_t size, UsageHint usagehint=UsageHint::Unknown) = 0;
194 virtual void xx_readv(
const ReadList& requests,
bool parallel_ok=
false,
bool immutable_ok=
false,
bool transient_ok=
false, UsageHint usagehint=UsageHint::Unknown) = 0;
202 virtual void xx_write(
const void* data, std::int64_t offset, std::int64_t size, UsageHint usagehint=UsageHint::Unknown) = 0;
209 virtual void xx_close() = 0;
214 virtual std::int64_t xx_eof()
const = 0;
219 virtual bool xx_threadsafe()
const = 0;
225 virtual bool xx_iscloud()
const = 0;
228 static std::string _nice(std::int64_t n);
229 static void _validate_read(
void *data, std::int64_t offset, std::int64_t size, std::int64_t eof, OpenMode mode);
230 static void _validate_write(
const void *data, std::int64_t offset, std::int64_t size, OpenMode mode);
231 static void _validate_readv(
const ReadList& requests, std::int64_t eof, OpenMode mode);
234 static std::shared_ptr<FileADT> factory(
const std::string& filename, OpenMode mode,
const OpenZGY::IOContext *iocontext);
240 typedef std::function<std::shared_ptr<FileADT>(
const std::string&, OpenMode,
const OpenZGY::IOContext*)> factory_t;
243 std::shared_ptr<FileADT> create(
const std::string& filename, OpenMode mode,
const OpenZGY::IOContext *iocontext);
244 void add_factory(
const factory_t& factory);
253 std::vector<factory_t> _registry;
269 std::shared_ptr<SummaryTimer> _rtimer;
270 std::shared_ptr<SummaryTimer> _wtimer;
275 virtual std::int64_t _real_eof()
const;
276 virtual void _check_short_read(std::int64_t offset, std::int64_t size, std::int64_t got)
const;