Project
Loading...
Searching...
No Matches
o2::framework::DataAllocator Class Reference

#include <DataAllocator.h>

Classes

struct  CacheId
 
struct  UninitializedVector
 

Public Types

enum struct  CacheStrategy : int { Never = 0 , Always = 1 }
 
using AllowedOutputRoutes = std::vector< OutputRoute >
 
using DataHeader = o2::header::DataHeader
 
using DataOrigin = o2::header::DataOrigin
 
using DataDescription = o2::header::DataDescription
 
using SubSpecificationType = o2::header::DataHeader::SubSpecificationType
 

Public Member Functions

 DataAllocator (ServiceRegistryRef ref)
 
DataChunknewChunk (const Output &, size_t)
 
DataChunknewChunk (OutputRef &&ref, size_t size)
 
void adoptChunk (const Output &, char *, size_t, fair::mq::FreeFn *, void *)
 
void cookDeadBeef (const Output &spec)
 
template<typename T , typename... Args>
requires is_specialization_v<T, o2::framework::DataAllocator::UninitializedVector>
decltype(auto) make (const Output &spec, Args... args)
 
template<typename T , typename... Args>
requires VectorOfMessageableTypes<T>
decltype(auto) make (const Output &spec, Args... args)
 
template<typename T , typename... Args>
requires (!VectorOfMessageableTypes<T> && has_root_dictionary<T>::value == true && is_messageable<T>::value == false)
decltype(auto) make (const Output &spec, Args... args)
 
template<typename T , typename... Args>
requires std::is_base_of_v<std::string, T>
decltype(auto) make (const Output &spec, Args... args)
 
template<typename T , typename... Args>
requires (requires { static_cast<struct TableBuilder>(std::declval<std::decay_t<T>>()); })
decltype(auto) make (const Output &spec, Args... args)
 
template<typename T , typename... Args>
requires (requires { static_cast<struct FragmentToBatch>(std::declval<std::decay_t<T>>()); })
decltype(auto) make (const Output &spec, Args... args)
 
template<typename T >
requires is_messageable<T>
::value &&!is_specialization_v< T, UninitializedVector > decltype(auto) make (const Output &spec)
 
template<typename T >
requires is_messageable<T>
::value &&!is_specialization_v< T, UninitializedVector > decltype(auto) make (const Output &spec, std::integral auto nElements)
 
template<typename T , typename Arg >
decltype(auto) make (const Output &spec, std::same_as< std::shared_ptr< arrow::Schema > > auto schema)
 
void adopt (const Output &spec, std::string *)
 
void adopt (const Output &spec, LifetimeHolder< struct TableBuilder > &)
 
void adopt (const Output &spec, LifetimeHolder< struct FragmentToBatch > &)
 
void adopt (const Output &spec, std::shared_ptr< class arrow::Table >)
 Adopt an Arrow table and send it to all consumers of spec.
 
template<typename T >
requires (!std::ranges::contiguous_range<T> && is_messageable<T>::value)
void snapshot (const Output &spec, T const &object)
 
void snapshot (const Output &spec, std::string_view const &object)
 
template<typename T >
requires (ContiguousMessageablesRange<T> && !std::is_pointer_v<typename T::value_type>)
void snapshot (const Output &spec, T const &object)
 
template<typename T >
requires (std::ranges::random_access_range<T> && is_messageable<typename std::remove_pointer_t<typename T::value_type>>::value && std::is_pointer_v<typename T::value_type>)
void snapshot (const Output &spec, T const &object)
 
template<typename T >
requires (!std::ranges::contiguous_range<T> && std::ranges::sized_range<T> && has_messageable_value_type<T>::value)
void snapshot (const Output &spec, T const &object)
 
template<typename T >
requires (is_specialization_v<T, ROOTSerialized>)
void snapshot (const Output &spec, T const &object)
 
template<typename T >
requires (!is_messageable<T>::value && !ContiguousMessageablesRange<T> && has_root_dictionary<T>::value && !is_specialization_v<T, ROOTSerialized>)
void snapshot (const Output &spec, T const &object)
 
void snapshot (const Output &spec, const char *payload, size_t payloadSize, o2::header::SerializationMethod serializationMethod=o2::header::gSerializationMethodNone)
 
template<typename T , typename... Args>
decltype(auto) make (OutputRef &&ref, Args &&... args)
 
template<typename T >
void adopt (OutputRef &&ref, T *obj)
 
o2::pmr::FairMQMemoryResourcegetMemoryResource (const Output &spec)
 
template<typename T , typename... Args>
o2::pmr::vector< T > makeVector (const Output &spec, Args &&... args)
 
template<typename ContainerT >
CacheId adoptContainer (const Output &, ContainerT &, CacheStrategy, o2::header::SerializationMethod)
 
template<typename ContainerT >
CacheId adoptContainer (const Output &spec, ContainerT &&container, CacheStrategy cache=CacheStrategy::Never, o2::header::SerializationMethod method=header::gSerializationMethodNone)
 
void adoptFromCache (Output const &spec, CacheId id, header::SerializationMethod method=header::gSerializationMethodNone)
 Adopt an already cached message, using an already provided CacheId.
 
template<typename... Args>
auto snapshot (OutputRef &&ref, Args &&... args)
 
bool isAllowed (Output const &query)
 check if a certain output is allowed
 
o2::header::DataHeaderfindMessageHeader (const Output &spec)
 
o2::header::DataHeaderfindMessageHeader (OutputRef &&ref)
 
o2::header::StackfindMessageHeaderStack (const Output &spec)
 
o2::header::StackfindMessageHeaderStack (OutputRef &&ref)
 
int countDeviceOutputs (bool excludeDPLOrigin=false)
 

Static Public Attributes

static constexpr ServiceKind service_kind = ServiceKind::Stream
 

Detailed Description

This allocator is responsible to make sure that the messages created match the provided spec and that depending on how many pipelined reader we have, messages get created on the channel for the reader of the current timeframe.

Definition at line 138 of file DataAllocator.h.

Member Typedef Documentation

◆ AllowedOutputRoutes

Definition at line 142 of file DataAllocator.h.

◆ DataDescription

◆ DataHeader

◆ DataOrigin

◆ SubSpecificationType

Member Enumeration Documentation

◆ CacheStrategy

Enumerator
Never 
Always 

Definition at line 501 of file DataAllocator.h.

Constructor & Destructor Documentation

◆ DataAllocator()

o2::framework::DataAllocator::DataAllocator ( ServiceRegistryRef  ref)

Definition at line 50 of file DataAllocator.cxx.

Member Function Documentation

◆ adopt() [1/5]

void o2::framework::DataAllocator::adopt ( const Output spec,
LifetimeHolder< struct FragmentToBatch > &  f2b 
)

Adopt a Source2Batch in the framework and serialise / send it as an Arrow Dataset to all consumers of spec once done

Definition at line 249 of file DataAllocator.cxx.

◆ adopt() [2/5]

void o2::framework::DataAllocator::adopt ( const Output spec,
LifetimeHolder< struct TableBuilder > &  tb 
)

Adopt a TableBuilder in the framework and serialise / send it as an Arrow table to all consumers of spec once done

To finalise this we write the table to the buffer.

Definition at line 219 of file DataAllocator.cxx.

◆ adopt() [3/5]

void o2::framework::DataAllocator::adopt ( const Output spec,
std::shared_ptr< class arrow::Table >   
)

Adopt an Arrow table and send it to all consumers of spec.

◆ adopt() [4/5]

void o2::framework::DataAllocator::adopt ( const Output spec,
std::string *  ptr 
)

Adopt a string in the framework and serialize / send it to the consumers of spec once done.

Definition at line 156 of file DataAllocator.cxx.

◆ adopt() [5/5]

template<typename T >
void o2::framework::DataAllocator::adopt ( OutputRef &&  ref,
T *  obj 
)
inline

adopt an object of type T and route to output specified by OutputRef Framework takes ownership of the object

OutputRef descriptors are expected to be passed as rvalue, i.e. a temporary object in the function call

Definition at line 475 of file DataAllocator.h.

◆ adoptChunk()

void o2::framework::DataAllocator::adoptChunk ( const Output spec,
char buffer,
size_t  size,
fair::mq::FreeFn *  freefn,
void hint = nullptr 
)

Definition at line 92 of file DataAllocator.cxx.

◆ adoptContainer() [1/2]

template<typename ContainerT >
CacheId o2::framework::DataAllocator::adoptContainer ( const Output ,
ContainerT &  ,
CacheStrategy  ,
o2::header::SerializationMethod   
)
inline

Definition at line 507 of file DataAllocator.h.

◆ adoptContainer() [2/2]

template<typename ContainerT >
DataAllocator::CacheId o2::framework::DataAllocator::adoptContainer ( const Output spec,
ContainerT &&  container,
CacheStrategy  cache = CacheStrategy::Never,
o2::header::SerializationMethod  method = header::gSerializationMethodNone 
)

Adopt a PMR container. Notice that the container must be moveable and eventually backed / by a o2::pmr::FairMQMemoryResource. spec where to send the message container the container whose resource needs to be sent cache: if true, the messages being sent are shallow copies of a cached copy. The entry in the cache can be subsequently be sent using the returned CacheId.

Returns
a unique id of the adopted message which can be used to resend the message or can be pruned via the DataAllocator::prune() method.

Definition at line 583 of file DataAllocator.h.

◆ adoptFromCache()

void o2::framework::DataAllocator::adoptFromCache ( Output const &  spec,
CacheId  id,
header::SerializationMethod  method = header::gSerializationMethodNone 
)

Adopt an already cached message, using an already provided CacheId.

Definition at line 364 of file DataAllocator.cxx.

◆ cookDeadBeef()

void o2::framework::DataAllocator::cookDeadBeef ( const Output spec)

Definition at line 382 of file DataAllocator.cxx.

◆ countDeviceOutputs()

int o2::framework::DataAllocator::countDeviceOutputs ( bool  excludeDPLOrigin = false)
inline

Definition at line 562 of file DataAllocator.h.

◆ findMessageHeader() [1/2]

o2::header::DataHeader * o2::framework::DataAllocator::findMessageHeader ( const Output spec)
inline

Definition at line 542 of file DataAllocator.h.

◆ findMessageHeader() [2/2]

o2::header::DataHeader * o2::framework::DataAllocator::findMessageHeader ( OutputRef &&  ref)
inline

Definition at line 547 of file DataAllocator.h.

◆ findMessageHeaderStack() [1/2]

o2::header::Stack * o2::framework::DataAllocator::findMessageHeaderStack ( const Output spec)
inline

Definition at line 552 of file DataAllocator.h.

◆ findMessageHeaderStack() [2/2]

o2::header::Stack * o2::framework::DataAllocator::findMessageHeaderStack ( OutputRef &&  ref)
inline

Definition at line 557 of file DataAllocator.h.

◆ getMemoryResource()

o2::pmr::FairMQMemoryResource * o2::framework::DataAllocator::getMemoryResource ( const Output spec)
inline

Definition at line 481 of file DataAllocator.h.

◆ isAllowed()

bool o2::framework::DataAllocator::isAllowed ( Output const &  query)

check if a certain output is allowed

Definition at line 353 of file DataAllocator.cxx.

◆ make() [1/10]

template<typename T >
requires is_messageable<T>
::value &&!is_specialization_v< T, UninitializedVector > decltype(auto) o2::framework::DataAllocator::make ( const Output spec)
inline

Definition at line 251 of file DataAllocator.h.

◆ make() [2/10]

template<typename T , typename... Args>
requires is_specialization_v<T, o2::framework::DataAllocator::UninitializedVector>
decltype(auto) o2::framework::DataAllocator::make ( const Output spec,
Args...  args 
)
inline

Definition at line 170 of file DataAllocator.h.

◆ make() [3/10]

template<typename T , typename... Args>
requires VectorOfMessageableTypes<T>
decltype(auto) o2::framework::DataAllocator::make ( const Output spec,
Args...  args 
)
inline

Definition at line 188 of file DataAllocator.h.

◆ make() [4/10]

template<typename T , typename... Args>
requires (!VectorOfMessageableTypes<T> && has_root_dictionary<T>::value == true && is_messageable<T>::value == false)
decltype(auto) o2::framework::DataAllocator::make ( const Output spec,
Args...  args 
)
inline

Definition at line 205 of file DataAllocator.h.

◆ make() [5/10]

template<typename T , typename... Args>
requires std::is_base_of_v<std::string, T>
decltype(auto) o2::framework::DataAllocator::make ( const Output spec,
Args...  args 
)
inline

Definition at line 224 of file DataAllocator.h.

◆ make() [6/10]

template<typename T , typename... Args>
requires (requires { static_cast<struct TableBuilder>(std::declval<std::decay_t<T>>()); })
decltype(auto) o2::framework::DataAllocator::make ( const Output spec,
Args...  args 
)
inline

Definition at line 233 of file DataAllocator.h.

◆ make() [7/10]

template<typename T , typename... Args>
requires (requires { static_cast<struct FragmentToBatch>(std::declval<std::decay_t<T>>()); })
decltype(auto) o2::framework::DataAllocator::make ( const Output spec,
Args...  args 
)
inline

Definition at line 242 of file DataAllocator.h.

◆ make() [8/10]

template<typename T >
requires is_messageable<T>
::value &&!is_specialization_v< T, UninitializedVector > decltype(auto) o2::framework::DataAllocator::make ( const Output spec,
std::integral auto  nElements 
)
inline

Definition at line 258 of file DataAllocator.h.

◆ make() [9/10]

template<typename T , typename Arg >
decltype(auto) o2::framework::DataAllocator::make ( const Output spec,
std::same_as< std::shared_ptr< arrow::Schema > > auto  schema 
)
inline

Definition at line 269 of file DataAllocator.h.

◆ make() [10/10]

template<typename T , typename... Args>
decltype(auto) o2::framework::DataAllocator::make ( OutputRef &&  ref,
Args &&...  args 
)
inline

make an object of type T and route to output specified by OutputRef The object is owned by the framework, returned reference can be used to fill the object.

OutputRef descriptors are expected to be passed as rvalue, i.e. a temporary object in the function call

Definition at line 464 of file DataAllocator.h.

◆ makeVector()

template<typename T , typename... Args>
o2::pmr::vector< T > o2::framework::DataAllocator::makeVector ( const Output spec,
Args &&...  args 
)
inline

Definition at line 491 of file DataAllocator.h.

◆ newChunk() [1/2]

DataChunk & o2::framework::DataAllocator::newChunk ( const Output spec,
size_t  size 
)

Definition at line 78 of file DataAllocator.cxx.

◆ newChunk() [2/2]

DataChunk & o2::framework::DataAllocator::newChunk ( OutputRef &&  ref,
size_t  size 
)
inline

Definition at line 158 of file DataAllocator.h.

◆ snapshot() [1/9]

void o2::framework::DataAllocator::snapshot ( const Output spec,
const char payload,
size_t  payloadSize,
o2::header::SerializationMethod  serializationMethod = o2::header::gSerializationMethodNone 
)

Take a snapshot of a raw data array which can be either POD or may contain a serialized object (in such case the serialization method should be specified accordingly). Changes to the data after the call will not be sent.

Definition at line 319 of file DataAllocator.cxx.

◆ snapshot() [2/9]

void o2::framework::DataAllocator::snapshot ( const Output spec,
std::string_view const &  object 
)
inline

Definition at line 322 of file DataAllocator.h.

◆ snapshot() [3/9]

template<typename T >
requires (!std::ranges::contiguous_range<T> && is_messageable<T>::value)
void o2::framework::DataAllocator::snapshot ( const Output spec,
T const &  object 
)
inline

Send a snapshot of an object, depending on the object type it is serialized before. The method always takes a copy of the data, which will then be sent once the computation ends. Framework does not take ownership of the object. Changes to object after the call will not be sent.

Supported types:

  • messageable types (trivially copyable, non-polymorphic
  • contiguous_range of messageable types
  • random_access_ranges of pointers of messageable type
  • sized range of messageable type
  • types with ROOT dictionary and implementing the ROOT ClassDef interface

Note: for many use cases, especially for the messageable types, the make interface might be better suited as the objects are allocated directly in the underlying memory resource and the copy can be avoided.

Note: messageable objects with ROOT dictionary are preferably sent unserialized. Use ROOTSerialized type wrapper to force ROOT serialization. Same applies to types which do not implement the ClassDef interface but have a dictionary.

Definition at line 317 of file DataAllocator.h.

◆ snapshot() [4/9]

template<typename T >
requires (ContiguousMessageablesRange<T> && !std::is_pointer_v<typename T::value_type>)
void o2::framework::DataAllocator::snapshot ( const Output spec,
T const &  object 
)
inline

Definition at line 330 of file DataAllocator.h.

◆ snapshot() [5/9]

template<typename T >
requires (std::ranges::random_access_range<T> && is_messageable<typename std::remove_pointer_t<typename T::value_type>>::value && std::is_pointer_v<typename T::value_type>)
void o2::framework::DataAllocator::snapshot ( const Output spec,
T const &  object 
)
inline

Definition at line 354 of file DataAllocator.h.

◆ snapshot() [6/9]

template<typename T >
requires (!std::ranges::contiguous_range<T> && std::ranges::sized_range<T> && has_messageable_value_type<T>::value)
void o2::framework::DataAllocator::snapshot ( const Output spec,
T const &  object 
)
inline

Definition at line 380 of file DataAllocator.h.

◆ snapshot() [7/9]

template<typename T >
requires (is_specialization_v<T, ROOTSerialized>)
void o2::framework::DataAllocator::snapshot ( const Output spec,
T const &  object 
)
inline

Definition at line 402 of file DataAllocator.h.

◆ snapshot() [8/9]

template<typename T >
requires (!is_messageable<T>::value && !ContiguousMessageablesRange<T> && has_root_dictionary<T>::value && !is_specialization_v<T, ROOTSerialized>)
void o2::framework::DataAllocator::snapshot ( const Output spec,
T const &  object 
)
inline

Definition at line 441 of file DataAllocator.h.

◆ snapshot() [9/9]

template<typename... Args>
auto o2::framework::DataAllocator::snapshot ( OutputRef &&  ref,
Args &&...  args 
)
inline

snapshot object and route to output specified by OutputRef Framework makes a (serialized) copy of object content.

OutputRef descriptors are expected to be passed as rvalue, i.e. a temporary object in the function call

Definition at line 534 of file DataAllocator.h.

Member Data Documentation

◆ service_kind

constexpr ServiceKind o2::framework::DataAllocator::service_kind = ServiceKind::Stream
staticconstexpr

Definition at line 141 of file DataAllocator.h.


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