MXL : Media eXchange Layer
MXL
Loading...
Searching...
No Matches
PosixEventFlowWriter.hpp
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2026 Contributors to the Media eXchange Layer project.
2// SPDX-License-Identifier: Apache-2.0
3
7
8#pragma once
9#include <vector>
12
13namespace mxl::lib
14{
15 class FlowManager;
16
22 {
23 public:
34 PosixEventFlowWriter(FlowManager const& manager, uuids::uuid const& flowId, std::unique_ptr<EventFlowData>&& data,
35 std::shared_ptr<DomainWatcher> const& watcher);
37 virtual ~PosixEventFlowWriter() override;
39 virtual FlowData const& getFlowData() const override;
41 virtual mxlFlowInfo getFlowInfo() const override;
43 virtual mxlFlowConfigInfo getFlowConfigInfo() const override;
45 virtual mxlFlowRuntimeInfo getFlowRuntimeInfo() const override;
47 virtual FlowData& getFlowData() override;
49 virtual mxlStatus openEvent(mxlEventInfo* info, std::uint8_t** payload) override;
51 virtual mxlStatus commit(mxlEventInfo const& info) override;
53 virtual mxlStatus cancel() override;
55 virtual bool isExclusive() const override;
57 virtual bool makeExclusive() override;
58
59 private:
60 std::unique_ptr<EventFlowData> _flowData;
61
62 bool _open;
63 std::uint64_t _lastTimestamp;
64 std::vector<std::uint8_t> _payload;
65 std::shared_ptr<DomainWatcher> _watcher;
66 };
67}
Owned mappings and runtime access for event flows.
Backend contract for the single event producer.
Backend contract for a single event producer with private write staging. Callers guarantee one writer...
virtual bool isExclusive() const override
std::vector< std::uint8_t > _payload
Private staging buffer; publication copies only eventSize bytes.
virtual mxlFlowRuntimeInfo getFlowRuntimeInfo() const override
std::uint64_t _lastTimestamp
Last committed timestamp, restored from the ring on attachment.
virtual ~PosixEventFlowWriter() override
Unregister from the watcher and release mappings and the common flow lock.
virtual mxlStatus cancel() override
Discard an open write without advancing the queue or timestamp.
virtual FlowData const & getFlowData() const override
std::shared_ptr< DomainWatcher > _watcher
Watcher kept alive while the writer is registered.
virtual mxlStatus commit(mxlEventInfo const &info) override
Publish the staged bytes as one complete event or fragment.
std::unique_ptr< EventFlowData > _flowData
Owns common metadata, ring mappings and the common flow lock.
bool _open
True while one caller-owned write transaction is open.
virtual mxlStatus openEvent(mxlEventInfo *info, std::uint8_t **payload) override
Begin a write and reset metadata to the event defaults.
virtual mxlFlowInfo getFlowInfo() const override
PosixEventFlowWriter(FlowManager const &manager, uuids::uuid const &flowId, std::unique_ptr< EventFlowData > &&data, std::shared_ptr< DomainWatcher > const &watcher)
Attach the sole writer, recover an interrupted publication and restore timestamp ordering.
virtual mxlFlowConfigInfo getFlowConfigInfo() const override
struct mxlEventInfo_t mxlEventInfo
Metadata for one event queue entry, either a complete event or a fragment.
struct mxlFlowRuntimeInfo_t mxlFlowRuntimeInfo
struct mxlFlowConfigInfo_t mxlFlowConfigInfo
struct mxlFlowInfo_t mxlFlowInfo
mxlStatus
MXL SDK Status codes.
Definition mxl.h:22
auto const flowId