12#ifndef O2_FRAMEWORK_FAIRMQRESIZABLEBUFFER_H_
13#define O2_FRAMEWORK_FAIRMQRESIZABLEBUFFER_H_
17#include <arrow/buffer.h>
18#include "arrow/io/interfaces.h"
19#include "arrow/status.h"
20#include "arrow/util/future.h"
22#include <fairmq/FwdDecls.h>
41 static Result<std::shared_ptr<FairMQOutputStream>>
Create(
42 int64_t initial_capacity = 4096, MemoryPool* pool = default_memory_pool());
53 [[nodiscard]]
bool closed()
const override;
54 [[nodiscard]] Result<int64_t>
Tell()
const override;
58 using OutputStream::Write;
62 Result<std::shared_ptr<Buffer>>
Finish();
69 Status Reset(int64_t initial_capacity = 1024, MemoryPool* pool = default_memory_pool());
71 [[nodiscard]] int64_t
capacity()
const {
return capacity_; }
77 Status Reserve(int64_t nbytes);
79 std::shared_ptr<ResizableBuffer> buffer_;
83 uint8_t* mutable_data_;
93 using Creator = std::function<std::unique_ptr<fair::mq::Message>(
size_t)>;
104 arrow::Status
Resize(
const int64_t new_size,
bool shrink_to_fit)
override;
109 arrow::Status
Reserve(
const int64_t capacity)
override;
114 std::unique_ptr<fair::mq::Message>
Finalise();
117 std::unique_ptr<fair::mq::Message> mMessage;
~FairMQOutputStream() override=default
Status Reset(int64_t initial_capacity=1024, MemoryPool *pool=default_memory_pool())
Initialize state of OutputStream with newly allocated memory and set position to 0.
Status Close() override
Close the stream, preserving the buffer (retrieve it with Finish()).
static Result< std::shared_ptr< FairMQOutputStream > > Create(int64_t initial_capacity=4096, MemoryPool *pool=default_memory_pool())
Create in-memory output stream with indicated capacity using a memory pool.
Result< std::shared_ptr< Buffer > > Finish()
Close the stream and return the buffer.
Result< int64_t > Tell() const override
bool closed() const override
arrow::Status Reserve(const int64_t capacity) override
arrow::Status Resize(const int64_t new_size, bool shrink_to_fit) override
std::unique_ptr< fair::mq::Message > Finalise()
std::function< std::unique_ptr< fair::mq::Message >(size_t)> Creator
~FairMQResizableBuffer() override
Defining PrimaryVertex explicitly as messageable.