Project
Loading...
Searching...
No Matches
o2::aod::native::ByteSource Class Referenceabstract

#include <ByteSource.h>

Inherited by o2::aod::native::FailoverByteSource, o2::aod::native::HttpByteSource, o2::aod::native::LocalByteSource, o2::aod::native::PlannedByteSource, o2::aod::native::XRootDByteSource, and o2::aod::native::test::MemoryByteSource.

Public Member Functions

virtual ~ByteSource ()
 
virtual uint64_t size () const =0
 
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 readvInto (std::span< ReadRequest > requests)=0
 
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 bool canMap () const
 Whether tryMap() provides every range, so that nothing needs reading.
 
virtual bool isRemote () const
 Whether each read is a network round trip, worth hiding behind decoding.
 
virtual void willNeed (uint64_t off, size_t len)
 Hints that a range will be needed soon, or is no longer needed.
 
virtual void dontNeed (uint64_t off, size_t len)
 
virtual uint64_t bytesRead () const =0
 
virtual uint64_t readCalls () const =0
 
virtual std::string url () const =0
 
virtual std::string replicaLabel () const
 The label of the replica being read, for a source opened with openReplicas().
 

Static Public Member Functions

static std::unique_ptr< ByteSource > open (std::string url, const Options &)
 
static std::unique_ptr< ByteSource > openReplicas (std::vector< Replica > replicas, const Options &, std::function< void(std::string const &)> log={})
 

Detailed Description

Random access to the bytes of a file. Everything above this is I/O-agnostic. The caller always owns the destination. Implementations are thread-safe for concurrent reads.

Definition at line 79 of file ByteSource.h.

Constructor & Destructor Documentation

◆ ~ByteSource()

o2::aod::native::ByteSource::~ByteSource ( )
virtualdefault

Member Function Documentation

◆ bytesRead()

◆ canMap()

virtual bool o2::aod::native::ByteSource::canMap ( ) const
inlinevirtual

Whether tryMap() provides every range, so that nothing needs reading.

Reimplemented in o2::aod::native::FailoverByteSource, and o2::aod::native::LocalByteSource.

Definition at line 90 of file ByteSource.h.

◆ dontNeed()

virtual void o2::aod::native::ByteSource::dontNeed ( uint64_t  off,
size_t  len 
)
inlinevirtual

Reimplemented in o2::aod::native::FailoverByteSource, and o2::aod::native::LocalByteSource.

Definition at line 95 of file ByteSource.h.

◆ isRemote()

virtual bool o2::aod::native::ByteSource::isRemote ( ) const
inlinevirtual

Whether each read is a network round trip, worth hiding behind decoding.

Reimplemented in o2::aod::native::FailoverByteSource, o2::aod::native::HttpByteSource, and o2::aod::native::XRootDByteSource.

Definition at line 92 of file ByteSource.h.

◆ open()

std::unique_ptr< ByteSource > o2::aod::native::ByteSource::open ( std::string  url,
const Options &  options 
)
static

Definition at line 28 of file ByteSource.cxx.

◆ openReplicas()

std::unique_ptr< ByteSource > o2::aod::native::ByteSource::openReplicas ( std::vector< Replica >  replicas,
const Options &  options,
std::function< void(std::string const &)>  log = {} 
)
static

Opens the first replica which opens, and on a read error retries it (Options::readRetries times, reopened) and then moves on to the next replica of the same size. log, if given, is told about every retry and every change of replica. Throws IoError when no replica is left.

Definition at line 63 of file ByteSource.cxx.

◆ readCalls()

◆ readInto()

virtual void o2::aod::native::ByteSource::readInto ( uint64_t  off,
size_t  len,
void *  dst 
)
pure virtual

◆ readvInto()

◆ replicaLabel()

virtual std::string o2::aod::native::ByteSource::replicaLabel ( ) const
inlinevirtual

The label of the replica being read, for a source opened with openReplicas().

Reimplemented in o2::aod::native::FailoverByteSource.

Definition at line 100 of file ByteSource.h.

◆ size()

◆ tryMap()

virtual std::span< const uint8_t > o2::aod::native::ByteSource::tryMap ( uint64_t  off,
size_t  len 
)
inlinevirtual

A view of the bytes without copying them, if the backend can provide it.

Reimplemented in o2::aod::native::PlannedByteSource, o2::aod::native::FailoverByteSource, o2::aod::native::LocalByteSource, and o2::aod::native::test::MemoryByteSource.

Definition at line 88 of file ByteSource.h.

◆ url()

◆ willNeed()

virtual void o2::aod::native::ByteSource::willNeed ( uint64_t  off,
size_t  len 
)
inlinevirtual

Hints that a range will be needed soon, or is no longer needed.

Reimplemented in o2::aod::native::FailoverByteSource, and o2::aod::native::LocalByteSource.

Definition at line 94 of file ByteSource.h.


The documentation for this class was generated from the following files: