Project
Loading...
Searching...
No Matches
o2::aod::native::FailoverByteSource Class Reference

#include <FailoverByteSource.h>

Inherits o2::aod::native::ByteSource.

Public Types

using Opener = std::function< std::unique_ptr< ByteSource >(std::string const &url, Options const &)>
 
using Log = std::function< void(std::string const &)>
 

Public Member Functions

 FailoverByteSource (std::vector< Replica > replicas, Options const &options, Opener opener, Log log)
 Throws IoError when no replica opens.
 
uint64_t size () const override
 
void readInto (uint64_t off, size_t len, void *dst) override
 Throws IoError, or CorruptData when the range is past the end of the file.
 
void readvInto (std::span< ReadRequest > requests) override
 
std::span< const uint8_t > tryMap (uint64_t off, size_t len) override
 A view of the bytes without copying them, if the backend can provide it.
 
bool canMap () const override
 Whether tryMap() provides every range, so that nothing needs reading.
 
bool isRemote () const override
 Whether each read is a network round trip, worth hiding behind decoding.
 
void willNeed (uint64_t off, size_t len) override
 Hints that a range will be needed soon, or is no longer needed.
 
void dontNeed (uint64_t off, size_t len) override
 
uint64_t bytesRead () const override
 
uint64_t readCalls () const override
 
std::string url () const override
 
std::string replicaLabel () const override
 The label of the replica being read, for a source opened with openReplicas().
 
- Public Member Functions inherited from o2::aod::native::ByteSource
virtual ~ByteSource ()
 

Additional Inherited Members

- Static Public Member Functions inherited from o2::aod::native::ByteSource
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

The replicas of one file, read as one ByteSource. A read which fails with an IoError is retried on the same replica, reopened, Options::readRetries times with a growing delay, and then on the next replica of the same size. Opening goes through the replicas in order too. Reads already in flight on a replica that is being replaced finish there, or fail and are retried.

Definition at line 28 of file FailoverByteSource.h.

Member Typedef Documentation

◆ Log

using o2::aod::native::FailoverByteSource::Log = std::function<void(std::string const&)>

Definition at line 32 of file FailoverByteSource.h.

◆ Opener

using o2::aod::native::FailoverByteSource::Opener = std::function<std::unique_ptr<ByteSource>(std::string const& url, Options const&)>

Definition at line 31 of file FailoverByteSource.h.

Constructor & Destructor Documentation

◆ FailoverByteSource()

o2::aod::native::FailoverByteSource::FailoverByteSource ( std::vector< Replica >  replicas,
Options const &  options,
Opener  opener,
Log  log 
)

Throws IoError when no replica opens.

Definition at line 29 of file FailoverByteSource.cxx.

Member Function Documentation

◆ bytesRead()

uint64_t o2::aod::native::FailoverByteSource::bytesRead ( ) const
overridevirtual

Implements o2::aod::native::ByteSource.

Definition at line 70 of file FailoverByteSource.cxx.

◆ canMap()

bool o2::aod::native::FailoverByteSource::canMap ( ) const
inlineoverridevirtual

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

Reimplemented from o2::aod::native::ByteSource.

Definition at line 41 of file FailoverByteSource.h.

◆ dontNeed()

void o2::aod::native::FailoverByteSource::dontNeed ( uint64_t  off,
size_t  len 
)
inlineoverridevirtual

Reimplemented from o2::aod::native::ByteSource.

Definition at line 44 of file FailoverByteSource.h.

◆ isRemote()

bool o2::aod::native::FailoverByteSource::isRemote ( ) const
inlineoverridevirtual

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

Reimplemented from o2::aod::native::ByteSource.

Definition at line 42 of file FailoverByteSource.h.

◆ readCalls()

uint64_t o2::aod::native::FailoverByteSource::readCalls ( ) const
overridevirtual

Implements o2::aod::native::ByteSource.

Definition at line 75 of file FailoverByteSource.cxx.

◆ readInto()

void o2::aod::native::FailoverByteSource::readInto ( uint64_t  off,
size_t  len,
void *  dst 
)
overridevirtual

Throws IoError, or CorruptData when the range is past the end of the file.

Implements o2::aod::native::ByteSource.

Definition at line 87 of file FailoverByteSource.cxx.

◆ readvInto()

void o2::aod::native::FailoverByteSource::readvInto ( std::span< ReadRequest >  requests)
overridevirtual

Implements o2::aod::native::ByteSource.

Definition at line 92 of file FailoverByteSource.cxx.

◆ replicaLabel()

std::string o2::aod::native::FailoverByteSource::replicaLabel ( ) const
overridevirtual

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

Reimplemented from o2::aod::native::ByteSource.

Definition at line 64 of file FailoverByteSource.cxx.

◆ size()

uint64_t o2::aod::native::FailoverByteSource::size ( ) const
inlineoverridevirtual

Implements o2::aod::native::ByteSource.

Definition at line 37 of file FailoverByteSource.h.

◆ tryMap()

std::span< const uint8_t > o2::aod::native::FailoverByteSource::tryMap ( uint64_t  off,
size_t  len 
)
inlineoverridevirtual

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

Reimplemented from o2::aod::native::ByteSource.

Definition at line 40 of file FailoverByteSource.h.

◆ url()

std::string o2::aod::native::FailoverByteSource::url ( ) const
inlineoverridevirtual

Implements o2::aod::native::ByteSource.

Definition at line 47 of file FailoverByteSource.h.

◆ willNeed()

void o2::aod::native::FailoverByteSource::willNeed ( uint64_t  off,
size_t  len 
)
inlineoverridevirtual

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

Reimplemented from o2::aod::native::ByteSource.

Definition at line 43 of file FailoverByteSource.h.


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