37 bool updateFileAccessTime(
int fd)
noexcept
39 auto const times = std::array<timespec, 2>{
40 {{.tv_sec = 0, .tv_nsec = UTIME_NOW}, {.tv_sec = 0, .tv_nsec = UTIME_OMIT}}
42 return (::futimens(fd, times.data()) == 0);
55 _accessFileFd = ::open(accessFile.string().c_str(), O_RDWR | O_CLOEXEC);
68 auto const error = errno;
69 MXL_ERROR(
"Failed to close access file fd: {}", std::strerror(error));
81 throw std::runtime_error{
"No open flow."};
102 auto sync = std::atomic_ref{flow->state.syncCounter};
105 auto const previous = sync.load(std::memory_order_acquire);
106 auto const oldest =
_flowData->oldestIndex();
149 auto const flowState =
_flowData->flowState();
152 using FileStatus =
struct stat;
153 auto st = FileStatus{};
154 if (::stat(flowDataPath.string().c_str(), &st) != 0)
158 return (st.st_ino == flowState->inode);
Internal shared-memory headers for discrete grains and event slots.
Paths and filenames utilities used by the MXL SDK.
POSIX event reader declaration and reader-owned snapshot state.
Backend contract for reading complete event entries or fragments in queue order. Each reader has one ...
@ Overwritten
The slot advanced past this index or changed while being copied.
@ Invalid
A stable snapshot contains unsupported or invalid metadata.
@ Ready
Metadata and payload form a validated snapshot of the requested entry.
constexpr mxlFlowInfo * flowInfo() noexcept
std::filesystem::path const & getDomain() const
uuids::uuid const & getId() const
std::filesystem::path const & getDomain() const
virtual mxlFlowInfo getFlowInfo() const override
virtual FlowData const & getFlowData() const override
std::vector< std::uint8_t > _snapshot
Payload storage reused on the next read attempt.
virtual ~PosixEventFlowReader() override
Close the access descriptor and release the snapshot and shared mappings.
int _accessFileFd
Access notification descriptor, or -1 if unavailable.
std::unique_ptr< EventFlowData > _flowData
Owned common metadata and read-only event mappings.
PosixEventFlowReader(FlowManager const &manager, uuids::uuid const &flowId, std::unique_ptr< EventFlowData > &&data)
Attach a reader at the oldest retained entry.
virtual mxlFlowConfigInfo getFlowConfigInfo() const override
virtual mxlStatus getEvent(Timepoint deadline, mxlEventInfo *info, std::uint8_t **payload) override
Copy the next available entry and advance this reader's cursor.
virtual bool isFlowValid() const override
virtual mxlFlowRuntimeInfo getFlowRuntimeInfo() const override
std::uint64_t _nextIndex
Next queue entry for this reader's owning thread.
bool isFlowValidImpl() const
Public flow reader, writer, payload and synchronization APIs.
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.
@ MXL_ERR_OUT_OF_RANGE_TOO_EARLY
@ MXL_ERR_OUT_OF_RANGE_TOO_LATE
std::filesystem::path makeFlowAccessFilePath(std::filesystem::path const &flowDirectory)
std::filesystem::path makeFlowDataFilePath(std::filesystem::path const &flowDirectory)
bool waitUntilChanged(T const *in_addr, T in_expected, Timepoint in_deadline)
mxlFlowRuntimeInfo runtime