12#ifndef O2_FRAMEWORK_AODNATIVE_BYTESOURCE_H_
13#define O2_FRAMEWORK_AODNATIVE_BYTESOURCE_H_
59 virtual uint64_t
size()
const = 0;
62 virtual void readvInto(std::span<ReadRequest> requests) = 0;
64 virtual std::span<const uint8_t>
tryMap(uint64_t off,
size_t len) {
return {}; }
66 virtual bool canMap()
const {
return false; }
68 virtual bool isRemote()
const {
return false; }
74 virtual std::string
url()
const = 0;
75 static std::unique_ptr<ByteSource>
open(std::string
url,
const Options&);
static std::unique_ptr< ByteSource > open(std::string url, const Options &)
virtual std::string url() const =0
virtual uint64_t bytesRead() const =0
virtual uint64_t size() const =0
virtual bool isRemote() const
Whether each read is a network round trip, worth hiding behind decoding.
virtual bool canMap() const
Whether tryMap() provides every range, so that nothing needs reading.
virtual void readInto(uint64_t off, size_t len, void *dst)=0
Throws IoError, or CorruptData when the range is past the end of the file.
virtual void dontNeed(uint64_t off, size_t len)
virtual uint64_t readCalls() const =0
virtual void willNeed(uint64_t off, size_t len)
Hints that a range will be needed soon, or is no longer needed.
virtual std::span< const uint8_t > tryMap(uint64_t off, size_t len)
A view of the bytes without copying them, if the backend can provide it.
virtual void readvInto(std::span< ReadRequest > requests)=0
GLenum GLenum GLsizei len