MXL : Media eXchange Layer
MXL
Loading...
Searching...
No Matches
FlowManager.cpp
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2025 Contributors to the Media eXchange Layer project.
2// SPDX-License-Identifier: Apache-2.0
3
5#include <cstring>
6#include <filesystem>
7#include <fstream>
8#include <ios>
9#include <memory>
10#include <stdexcept>
11#include <system_error>
12#include <fcntl.h>
13#include <unistd.h>
14#include <sys/stat.h>
15#include <mxl/flow.h>
16#include <mxl/mxl.h>
21#include "Deferred.hpp"
23
24namespace mxl::lib
25{
26 namespace
27 {
40 std::filesystem::path createTemporaryFlowDirectory(std::filesystem::path const& base)
41 {
42 auto pathBuffer = (base / ".mxl-tmp-XXXXXXXXXXXXXXXX").string();
43 if (::mkdtemp(pathBuffer.data()) == nullptr)
44 {
45 auto const error = errno;
46 MXL_ERROR("mkdtemp failed for path '{}' (errno {}: {}).", base.string(), error, std::strerror(error));
47 throw std::filesystem::filesystem_error{
48 "Could not create temporary directory.", base, std::error_code{error, std::generic_category()}
49 };
50 }
51 return pathBuffer;
52 }
53
54 bool publishFlowDirectory(std::filesystem::path const& source, std::filesystem::path const& dest)
55 {
56 permissions(source,
57 std::filesystem::perms::group_read | std::filesystem::perms::group_exec | std::filesystem::perms::others_read |
58 std::filesystem::perms::others_exec,
59 std::filesystem::perm_options::add);
60
61#if defined __linux__
62 if (::renameat2(AT_FDCWD, source.c_str(), AT_FDCWD, dest.c_str(), RENAME_NOREPLACE) < 0)
63#elif defined __APPLE__
64 if (::renamex_np(source.c_str(), dest.c_str(), RENAME_EXCL) < 0)
65#endif
66 {
67 auto const error = errno;
68 switch (error)
69 {
70 case EEXIST:
71 case ENOTEMPTY: return false;
72 default:
73 throw std::system_error{error, std::system_category(), "Failed to publish flow directory by renaming it to its public name."};
74 }
75 }
76
77 return true;
78 }
79
84 mxlDataFormat sanitizeFlowFormat(mxlDataFormat format)
85 {
87 }
88
89 void writeFlowDescriptor(std::filesystem::path const& flowDir, std::string const& flowDef)
90 {
91 auto const flowJsonFile = makeFlowDescriptorFilePath(flowDir);
92 if (auto out = std::ofstream{flowJsonFile, std::ios::out | std::ios::trunc}; out)
93 {
94 out << flowDef;
95 }
96 else
97 {
98 throw std::filesystem::filesystem_error{
99 "Failed to create flow resource definition.", flowJsonFile, std::make_error_code(std::errc::io_error)};
100 }
101 }
102
103 mxlCommonFlowConfigInfo initCommonFlowConfigInfo(uuids::uuid const& flowId, mxlDataFormat format, mxlRational grainRate,
104 std::uint32_t maxSyncBatchSizeHintOpt, std::uint32_t maxCommitBatchSizeHintOpt)
105 {
106 auto result = mxlCommonFlowConfigInfo{};
107
108 auto const idSpan = flowId.as_bytes();
109 std::memcpy(result.id, idSpan.data(), idSpan.size());
110 result.format = format;
111 result.grainRate = grainRate;
112
113 result.maxCommitBatchSizeHint = maxCommitBatchSizeHintOpt;
114 result.maxSyncBatchSizeHint = maxSyncBatchSizeHintOpt;
115
116 // FIXME: This should come from the configuration when device memory is supported
117 result.payloadLocation = MXL_PAYLOAD_LOCATION_HOST_MEMORY;
118 result.deviceIndex = -1;
119
120 return result;
121 }
122
123 mxlFlowRuntimeInfo initFlowRuntimeInfo()
124 {
125 auto result = mxlFlowRuntimeInfo{};
126
128 result.lastReadTime = result.lastWriteTime;
129
130 return result;
131 }
132
133 FlowState initFlowState(std::filesystem::path const& flowDataPath)
134 {
135 auto result = FlowState{};
136
137 // Get the inode of the flow data file
138 struct ::stat st;
139 if (::stat(flowDataPath.string().c_str(), &st) != 0)
140 {
141 auto const error = errno;
142 throw std::filesystem::filesystem_error{
143 "Could not stat flow data file.", flowDataPath, std::error_code{error, std::generic_category()}
144 };
145 }
146 else
147 {
148 result.inode = st.st_ino;
149 }
150
151 return result;
152 }
153 }
154
155 FlowManager::FlowManager(std::filesystem::path const& in_mxlDomain)
156 : _mxlDomain{std::filesystem::canonical(in_mxlDomain)}
157 {
158 if (!exists(in_mxlDomain) || !is_directory(in_mxlDomain))
159 {
160 throw std::filesystem::filesystem_error{
161 "Path does not exist or is not a directory.", in_mxlDomain, std::make_error_code(std::errc::no_such_file_or_directory)};
162 }
163 }
164
165 std::pair<bool, std::unique_ptr<DiscreteFlowData>> FlowManager::createOrOpenDiscreteFlow(uuids::uuid const& flowId, std::string const& flowDef,
166 mxlDataFormat flowFormat, std::size_t grainCount, mxlRational const& grainRate, std::size_t grainPayloadSize, std::size_t grainNumOfSlices,
167 std::array<uint32_t, MXL_MAX_PLANES_PER_GRAIN> grainSliceLengths, std::uint32_t maxSyncBatchSizeHintOpt,
168 std::uint32_t maxCommitBatchSizeHintOpt)
169 {
170 auto const uuidString = uuids::to_string(flowId);
171 MXL_DEBUG("Create discrete flow. id: {}, grainCount: {}, grain payload size: {}", uuidString, grainCount, grainPayloadSize);
172
173 flowFormat = sanitizeFlowFormat(flowFormat);
174 if (!mxlIsDiscreteDataFormat(flowFormat))
175 {
176 throw std::runtime_error{"Attempt to create discrete flow with unsupported or non matching format."};
177 }
178
179 auto const tempDirectory = createTemporaryFlowDirectory(_mxlDomain);
180 auto _ = defer(
181 [&]() noexcept
182 {
183 std::error_code ec;
184 std::filesystem::remove_all(tempDirectory, ec);
185 if (ec)
186 {
187 MXL_WARN("Failed to remove temporary flow directory: {}", ec.message());
188 }
189 });
190
191 // Write the json file to disk.
192 writeFlowDescriptor(tempDirectory, flowDef);
193
194 // Create the dummy file.
195 auto readAccessFile = makeFlowAccessFilePath(tempDirectory);
196 if (auto out = std::ofstream{readAccessFile, std::ios::out | std::ios::trunc}; !out)
197 {
198 throw std::filesystem::filesystem_error{
199 "Failed to create flow access file.", readAccessFile, std::make_error_code(std::errc::file_exists)};
200 }
201
202 auto const flowDataPath = makeFlowDataFilePath(tempDirectory);
203 auto flowData = std::make_unique<DiscreteFlowData>(flowDataPath.string().c_str(), AccessMode::CREATE_READ_WRITE, LockMode::Shared);
204
205 auto& info = *flowData->flowInfo();
206 info.version = FLOW_DATA_VERSION;
207 info.size = sizeof info;
208 info.config.common = initCommonFlowConfigInfo(flowId, flowFormat, grainRate, maxSyncBatchSizeHintOpt, maxCommitBatchSizeHintOpt);
209 info.config.discrete = {};
210 info.config.discrete.grainCount = grainCount;
211 std::ranges::copy(grainSliceLengths, info.config.discrete.sliceSizes);
212
213 info.runtime = initFlowRuntimeInfo();
214
215 auto& state = *flowData->flowState();
216 state = initFlowState(flowDataPath);
217
218 auto const grainDir = makeGrainDirectoryName(tempDirectory);
219 if (!create_directory(grainDir))
220 {
221 throw std::filesystem::filesystem_error{"Could not create grain directory.", grainDir, std::make_error_code(std::errc::io_error)};
222 }
223
224 for (auto i = std::size_t{0}; i < grainCount; ++i)
225 {
226 auto const grainPath = makeGrainDataFilePath(grainDir, i);
227 MXL_TRACE("Creating grain: {}", grainPath.string());
228
229 // \todo Handle payload stored device memory
230 auto const grain = flowData->emplaceGrain(grainPath.string().c_str(), grainPayloadSize);
231 auto& gInfo = grain->header.info;
232 gInfo.grainSize = grainPayloadSize;
233 gInfo.totalSlices = grainNumOfSlices;
234 gInfo.validSlices = 0;
235 gInfo.version = GRAIN_HEADER_VERSION;
236 gInfo.size = sizeof gInfo;
237 }
238
239 auto const finalDir = makeFlowDirectoryName(_mxlDomain, uuidString);
240 if (publishFlowDirectory(tempDirectory, finalDir))
241 {
242 return {true, std::move(flowData)};
243 }
244 else
245 {
247 if (!existingFlowData)
248 {
249 throw std::runtime_error("Could not open existing flow because it is of a different format");
250 }
251
252 return {false, std::move(existingFlowData)};
253 }
254 }
255
256 std::pair<bool, std::unique_ptr<EventFlowData>> FlowManager::createOrOpenEventFlow(uuids::uuid const& flowId, std::string const& flowDef,
257 std::size_t eventCount, mxlRational const& grainRate, std::size_t eventPayloadSize)
258 {
259 auto const uuidString = uuids::to_string(flowId);
260 MXL_DEBUG("Create event flow. id: {}, eventCount: {}, event payload size: {}", uuidString, eventCount, eventPayloadSize);
261
262 auto const flowFormat = mxlDataFormat{MXL_DATA_FORMAT_EVENT};
263 if ((eventCount < 2) || (eventCount > 65536) || (eventPayloadSize == 0) || (eventPayloadSize > 1048576))
264 {
265 throw std::invalid_argument{"Invalid event buffer dimensions."};
266 }
267
268 auto const tempDirectory = createTemporaryFlowDirectory(_mxlDomain);
269 auto _ = defer(
270 [&]() noexcept
271 {
272 auto ec = std::error_code{};
273 std::filesystem::remove_all(tempDirectory, ec);
274 if (ec)
275 {
276 MXL_WARN("Failed to remove temporary flow directory: {}", ec.message());
277 }
278 });
279
280 // Write the json file to disk.
281 writeFlowDescriptor(tempDirectory, flowDef);
282
283 // Create the dummy file.
284 auto readAccessFile = makeFlowAccessFilePath(tempDirectory);
285 if (auto out = std::ofstream{readAccessFile, std::ios::out | std::ios::trunc}; !out)
286 {
287 throw std::filesystem::filesystem_error{
288 "Failed to create flow access file.", readAccessFile, std::make_error_code(std::errc::file_exists)};
289 }
290
291 auto const flowDataPath = makeFlowDataFilePath(tempDirectory);
292 auto flowData = std::make_unique<EventFlowData>(flowDataPath.string().c_str(), AccessMode::CREATE_READ_WRITE, LockMode::Shared);
293
294 auto& info = *flowData->flowInfo();
295 info.version = FLOW_DATA_VERSION;
296 info.size = sizeof info;
297 info.config.common = initCommonFlowConfigInfo(flowId, flowFormat, grainRate, 1, 1);
298 info.config.event = {};
299 info.config.event.eventCount = eventCount;
300 info.config.event.eventPayloadSize = eventPayloadSize;
301
302 info.runtime = initFlowRuntimeInfo();
303 info.runtime.headIndex = MXL_UNDEFINED_INDEX;
304
305 auto& state = *flowData->flowState();
306 state = initFlowState(flowDataPath);
307
308 flowData->openEventBuffer(makeEventDataFilePath(tempDirectory).string().c_str());
309
310 auto const finalDir = makeFlowDirectoryName(_mxlDomain, uuidString);
311 if (publishFlowDirectory(tempDirectory, finalDir))
312 {
313 return {true, std::move(flowData)};
314 }
315 else
316 {
318 if (!existingFlowData)
319 {
320 throw std::runtime_error("Could not open existing flow because it is of a different format");
321 }
322
323 return {false, std::move(existingFlowData)};
324 }
325 }
326
327 std::pair<bool, std::unique_ptr<ContinuousFlowData>> FlowManager::createOrOpenContinuousFlow(uuids::uuid const& flowId,
328 std::string const& flowDef, mxlDataFormat flowFormat, mxlRational const& sampleRate, std::size_t channelCount, std::size_t sampleWordSize,
329 std::size_t bufferLength, std::uint32_t maxSyncBatchSizeHintOpt, std::uint32_t maxCommitBatchSizeHintOpt)
330 {
331 auto const uuidString = uuids::to_string(flowId);
332 MXL_DEBUG("Create continuous flow. id: {}, channel count: {}, word size: {}, buffer length: {}",
333 uuidString,
334 channelCount,
335 sampleWordSize,
336 bufferLength);
337
338 flowFormat = sanitizeFlowFormat(flowFormat);
339 if (!mxlIsContinuousDataFormat(flowFormat))
340 {
341 throw std::runtime_error{"Attempt to create continuous flow with unsupported or non matching format."};
342 }
343
344 auto const tempDirectory = createTemporaryFlowDirectory(_mxlDomain);
345 auto _ = defer(
346 [&]() noexcept
347 {
348 auto ec = std::error_code{};
349 std::filesystem::remove_all(tempDirectory, ec);
350 if (ec)
351 {
352 MXL_WARN("Failed to remove temporary flow directory: {}", ec.message());
353 }
354 });
355
356 // Write the json file to disk.
357 writeFlowDescriptor(tempDirectory, flowDef);
358
359 auto const flowDataPath = makeFlowDataFilePath(tempDirectory);
360 auto flowData = std::make_unique<ContinuousFlowData>(flowDataPath.string().c_str(), AccessMode::CREATE_READ_WRITE, LockMode::Shared);
361
362 auto& info = *flowData->flowInfo();
363 info.version = FLOW_DATA_VERSION;
364 info.size = sizeof info;
365 info.config.common = initCommonFlowConfigInfo(flowId, flowFormat, sampleRate, maxSyncBatchSizeHintOpt, maxCommitBatchSizeHintOpt);
366 info.config.continuous = {};
367 info.config.continuous.channelCount = channelCount;
368 info.config.continuous.bufferLength = bufferLength;
369
370 info.runtime = initFlowRuntimeInfo();
371
372 auto& state = *flowData->flowState();
373 state = initFlowState(flowDataPath);
374
375 flowData->openChannelBuffers(makeChannelDataFilePath(tempDirectory).string().c_str(), sampleWordSize);
376
377 auto const finalDir = makeFlowDirectoryName(_mxlDomain, uuidString);
378 if (publishFlowDirectory(tempDirectory, finalDir))
379 {
380 return {true, std::move(flowData)};
381 }
382 else
383 {
385 if (!existingFlowData)
386 {
387 throw std::runtime_error{"Could not open existing flow because it is of a different format"};
388 }
389
390 return {false, std::move(existingFlowData)};
391 }
392 }
393
394 std::unique_ptr<FlowData> FlowManager::openFlow(uuids::uuid const& in_flowId, AccessMode in_mode)
395 {
396 if (in_mode == AccessMode::CREATE_READ_WRITE)
397 {
398 throw std::invalid_argument{"Attempt to open flow with invalid access mode."};
399 }
400
401 auto uuid = uuids::to_string(in_flowId);
402 auto const base = makeFlowDirectoryName(_mxlDomain, uuid);
403
404 // Verify that the flow file exists.
405 if (auto const flowFile = makeFlowDataFilePath(base); exists(flowFile))
406 {
407 auto flowSegment = SharedMemoryInstance<Flow>{flowFile.string().c_str(), in_mode, 0U, LockMode::Shared};
408 if (flowSegment.get()->info.version != FLOW_DATA_VERSION)
409 {
410 throw std::invalid_argument{
411 fmt::format("Unsupported flow data version: {}, supported is: {}", flowSegment.get()->info.version, FLOW_DATA_VERSION)};
412 }
413
414 if (auto const flowFormat = flowSegment.get()->info.config.common.format; mxlIsDiscreteDataFormat(flowFormat))
415 {
416 return openDiscreteFlow(base, std::move(flowSegment));
417 }
418 else if (flowFormat == MXL_DATA_FORMAT_EVENT)
419 {
420 auto data = std::make_unique<EventFlowData>(std::move(flowSegment));
421 data->openEventBuffer(makeEventDataFilePath(base).string().c_str());
422 return data;
423 }
424 else if (mxlIsContinuousDataFormat(flowFormat))
425 {
426 return openContinuousFlow(base, std::move(flowSegment));
427 }
428 else
429 {
430 // This should never happen for a valid flow.
431 throw std::runtime_error{"Attempt to open flow with unsupported data format."};
432 }
433 }
434 else
435 {
436 throw std::filesystem::filesystem_error{"Flow file not found.", flowFile, std::make_error_code(std::errc::no_such_file_or_directory)};
437 }
438 }
439
440 std::unique_ptr<DiscreteFlowData> FlowManager::openDiscreteFlow(std::filesystem::path const& flowDir,
441 SharedMemoryInstance<Flow>&& sharedFlowInstance)
442 {
443 auto flowData = std::make_unique<DiscreteFlowData>(std::move(sharedFlowInstance));
444
445 auto const grainCount = flowData->flowInfo()->config.discrete.grainCount;
446 if (grainCount > 0U)
447 {
448 auto const grainDir = makeGrainDirectoryName(flowDir);
449 if (exists(grainDir) && is_directory(grainDir))
450 {
451 // Open each grain with per-item error handling
452 for (auto i = 0U; i < grainCount; ++i)
453 {
454 auto const grainPath = makeGrainDataFilePath(grainDir, i).string();
455 MXL_TRACE("Opening grain: {}", grainPath);
456
457 flowData->emplaceGrain(grainPath.c_str(), /*grainPayloadSize=*/0U);
458 }
459 }
460 else
461 {
462 throw std::filesystem::filesystem_error{
463 "Grain directory not found.", grainDir, std::make_error_code(std::errc::no_such_file_or_directory)};
464 }
465 }
466
467 return flowData;
468 }
469
470 std::unique_ptr<ContinuousFlowData> FlowManager::openContinuousFlow(std::filesystem::path const& flowDir,
471 SharedMemoryInstance<Flow>&& sharedFlowInstance)
472 {
473 auto flowData = std::make_unique<ContinuousFlowData>(std::move(sharedFlowInstance));
474
475 flowData->openChannelBuffers(makeChannelDataFilePath(flowDir).string().c_str(), /*sampleWordSize=*/0U);
476
477 return flowData;
478 }
479
480 bool FlowManager::deleteFlow(std::unique_ptr<FlowData>&& flowData)
481 {
482 if (flowData)
483 {
484 // Extract the ID
485 auto const span = uuids::span<std::uint8_t, sizeof flowData->flowInfo()->config.common.id>{
486 const_cast<std::uint8_t*>(flowData->flowInfo()->config.common.id), sizeof flowData->flowInfo()->config.common.id};
487 auto const id = uuids::uuid(span);
488
489 // Close the flow
490 flowData.reset();
491
492 // Delegate to the other deleteFlow overload
493 return deleteFlow(id);
494 }
495 return false;
496 }
497
498 bool FlowManager::deleteFlow(uuids::uuid const& flowId)
499 {
500 auto uuid = uuids::to_string(flowId);
501 MXL_TRACE("Delete flow: {}", uuid);
502
503 try
504 {
505 // Compute the flow directory path
506 auto const flowPath = makeFlowDirectoryName(_mxlDomain, uuid);
507 auto const removed = remove_all(flowPath);
508 if (removed == 0)
509 {
510 MXL_TRACE("Flow not found or already deleted: {}", uuid);
511 return false;
512 }
513 return true;
514 }
515 catch (...)
516 {
517 // Convert any filesystem exception to false return
518 // This makes the method effectively noexcept while indicating failure
519 return false;
520 }
521 }
522
523 std::vector<uuids::uuid> FlowManager::listFlows() const
524 {
525 auto base = std::filesystem::path{_mxlDomain};
526
527 auto flowIds = std::vector<uuids::uuid>{};
528 if (exists(base) && is_directory(base))
529 {
530 for (auto const& entry : std::filesystem::directory_iterator{_mxlDomain})
531 {
532 if (is_directory(entry) && (entry.path().extension() == FLOW_DIRECTORY_NAME_SUFFIX))
533 {
534 // this looks like a uuid. try to parse it an confirm it is valid.
535 auto id = uuids::uuid::from_string(entry.path().stem().string());
536 if (id.has_value())
537 {
538 flowIds.push_back(*id);
539 }
540 }
541 }
542 }
543 else
544 {
545 throw std::filesystem::filesystem_error{"Base directory not found.", base, std::make_error_code(std::errc::no_such_file_or_directory)};
546 }
547
548 return flowIds;
549 }
550
551 std::string FlowManager::getFlowDef(uuids::uuid const& flowId) const
552 {
553 auto const uuid = uuids::to_string(flowId);
554 auto const flowPath = makeFlowDirectoryName(_mxlDomain, uuid);
555 auto const flowJsonFile = makeFlowDescriptorFilePath(flowPath);
556 if (auto in = std::ifstream{flowJsonFile, std::ios::in}; in)
557 {
558 auto const result = std::string{std::istreambuf_iterator<char>{in}, std::istreambuf_iterator<char>{}};
559 if (!in)
560 {
561 throw std::runtime_error{"Error while reading the flow definition."};
562 }
563 return result;
564 }
565 // Here is a race condition, but plain C++ API does not provide a way to check whether it was not possible to open a file because it does
566 // not exist, or whether the access rights are wrong.
567 if (!exists(flowJsonFile))
568 {
569 throw std::filesystem::filesystem_error{"Failed to open flow resource definition - file not found.",
570 flowJsonFile,
571 std::make_error_code(std::errc::no_such_file_or_directory)};
572 }
573 throw std::runtime_error{"Failed to open flow resource definition."};
574 }
575
576 std::filesystem::path const& FlowManager::getDomain() const
577 {
578 return _mxlDomain;
579 }
580}
#define MXL_ERROR(...)
Definition Logging.hpp:67
#define MXL_WARN(...)
Definition Logging.hpp:56
#define MXL_DEBUG(...)
Definition Logging.hpp:34
#define MXL_TRACE(...)
Definition Logging.hpp:23
Paths and filenames utilities used by the MXL SDK.
bool deleteFlow(std::unique_ptr< FlowData > &&flowData)
std::unique_ptr< DiscreteFlowData > openDiscreteFlow(std::filesystem::path const &flowDir, SharedMemoryInstance< Flow > &&sharedFlowInstance)
std::filesystem::path _mxlDomain
std::unique_ptr< ContinuousFlowData > openContinuousFlow(std::filesystem::path const &flowDir, SharedMemoryInstance< Flow > &&sharedFlowInstance)
std::vector< uuids::uuid > listFlows() const
std::pair< bool, std::unique_ptr< EventFlowData > > createOrOpenEventFlow(uuids::uuid const &flowId, std::string const &flowDef, std::size_t eventCount, mxlRational const &grainRate, std::size_t eventPayloadSize)
Create an event flow atomically, or open the existing flow with the same ID.
FlowManager(std::filesystem::path const &in_mxlDomain)
std::string getFlowDef(uuids::uuid const &flowId) const
std::pair< bool, std::unique_ptr< DiscreteFlowData > > createOrOpenDiscreteFlow(uuids::uuid const &flowId, std::string const &flowDef, mxlDataFormat flowFormat, std::size_t grainCount, mxlRational const &grainRate, std::size_t grainPayloadSize, std::size_t grainNumOfSlices, std::array< std::uint32_t, MXL_MAX_PLANES_PER_GRAIN > grainSliceLengths, std::uint32_t maxSyncBatchSizeHintOpt=1, std::uint32_t maxCommitBatchSizeHintOpt=1)
std::filesystem::path const & getDomain() const
std::pair< bool, std::unique_ptr< ContinuousFlowData > > createOrOpenContinuousFlow(uuids::uuid const &flowId, std::string const &flowDef, mxlDataFormat flowFormat, mxlRational const &sampleRate, std::size_t channelCount, std::size_t sampleWordSize, std::size_t bufferLength, std::uint32_t maxSyncBatchSizeHintOpt=1, std::uint32_t maxCommitBatchSizeHintOpt=1)
std::unique_ptr< FlowData > openFlow(uuids::uuid const &flowId, AccessMode mode)
int mxlIsSupportedDataFormat(int format)
Definition dataformat.h:56
int mxlIsContinuousDataFormat(int format)
Definition dataformat.h:106
int mxlIsDiscreteDataFormat(int format)
Definition dataformat.h:75
mxlDataFormat
Definition dataformat.h:25
@ MXL_DATA_FORMAT_EVENT
Asynchronous queue of complete events or event fragments.
Definition dataformat.h:30
@ MXL_DATA_FORMAT_UNSPECIFIED
Definition dataformat.h:26
Public flow reader, writer, payload and synchronization APIs.
@ MXL_PAYLOAD_LOCATION_HOST_MEMORY
Definition flowinfo.h:39
struct mxlCommonFlowConfigInfo_t mxlCommonFlowConfigInfo
struct mxlFlowRuntimeInfo_t mxlFlowRuntimeInfo
std::filesystem::path makeChannelDataFilePath(std::filesystem::path const &flowDirectory)
Definition PathUtils.cpp:47
std::filesystem::path makeEventDataFilePath(std::filesystem::path const &flowDirectory)
Locate an event ring file within its flow directory.
Definition PathUtils.cpp:53
std::filesystem::path makeFlowDescriptorFilePath(std::filesystem::path const &flowDirectory)
Definition PathUtils.cpp:23
std::filesystem::path makeFlowAccessFilePath(std::filesystem::path const &flowDirectory)
Definition PathUtils.cpp:29
constexpr auto GRAIN_HEADER_VERSION
The version of the grain header structs in shared memory that we expect an support.
Definition Flow.hpp:24
std::filesystem::path makeFlowDataFilePath(std::filesystem::path const &flowDirectory)
Definition PathUtils.cpp:17
constexpr Deferred< F > defer(F &&f) noexcept
Definition Deferred.hpp:48
constexpr auto const FLOW_DIRECTORY_NAME_SUFFIX
Definition PathUtils.hpp:14
std::unique_ptr< To > dynamic_pointer_cast(std::unique_ptr< From > &&source) noexcept
std::filesystem::path makeGrainDirectoryName(std::filesystem::path const &flowDirectory)
Definition PathUtils.cpp:35
std::filesystem::path makeFlowDirectoryName(std::filesystem::path const &domain, std::string const &uuid)
Definition PathUtils.cpp:11
constexpr auto FLOW_DATA_VERSION
The version of the flow data structs in shared memory that we expect and support.
Definition Flow.hpp:21
std::filesystem::path makeGrainDataFilePath(std::filesystem::path const &grainDirectory, unsigned int index)
Definition PathUtils.cpp:41
#define MXL_UNDEFINED_INDEX
Definition rational.h:17
struct mxlRational_t mxlRational
uint64_t lastWriteTime
Definition flowinfo.h:202
auto const flowId
auto flowDef
mxlGrainInfo gInfo
Open the grain.
auto const currentTime
Definition test_time.cpp:58