|
MXL : Media eXchange Layer
MXL
|
#include <FlowManager.hpp>
Public Member Functions | |
| 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::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::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. | |
| bool | deleteFlow (std::unique_ptr< FlowData > &&flowData) |
| bool | deleteFlow (uuids::uuid const &flowId) |
| FlowManager (std::filesystem::path const &in_mxlDomain) | |
| std::filesystem::path const & | getDomain () const |
| std::string | getFlowDef (uuids::uuid const &flowId) const |
| std::vector< uuids::uuid > | listFlows () const |
| std::unique_ptr< FlowData > | openFlow (uuids::uuid const &flowId, AccessMode mode) |
Private Member Functions | |
| std::unique_ptr< ContinuousFlowData > | openContinuousFlow (std::filesystem::path const &flowDir, SharedMemoryInstance< Flow > &&sharedFlowInstance) |
| std::unique_ptr< DiscreteFlowData > | openDiscreteFlow (std::filesystem::path const &flowDir, SharedMemoryInstance< Flow > &&sharedFlowInstance) |
Private Attributes | |
| std::filesystem::path | _mxlDomain |
Performs Flow CRUD operations
CREATE Creates the flow resources in the base path (the MXL 'domain'). Flow resource contain
After creation, the FlowData associated with the new flow is stored in an internal cache.
GET Return a cached FlowData for a flowId. The flow must opened first.
DELETE Delete a flow by flowId. If the flow is opened it is first closed than all physical resources (see above) are deleted
LIST List all the flows found in the domain.
Definition at line 42 of file FlowManager.hpp.
| mxl::lib::FlowManager::FlowManager | ( | std::filesystem::path const & | in_mxlDomain | ) |
Creates a FlowManager. Ideally there should only be on instance of the manager per instance of the SDK.
\in_mxlDomain : The directory where the flows are stored.
| std::filesystem::filesystem_error | if the directory does not exist or is not accessible. |
Definition at line 155 of file FlowManager.cpp.
| std::pair< bool, std::unique_ptr< ContinuousFlowData > > mxl::lib::FlowManager::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 ) |
Create a new continuous flow together with its associated channel store and open it in read-write mode.
| [in] | flowId | The id of the flow. |
| [in] | flowDef | The json definition of the flow (NMOS Resource format). The flow is not parsed or validated. It is written as is. |
| [in] | flowFormat | The flow data format. Must be one of the continuous formats. |
| [in] | sampleRate | The sample rate. |
| [in] | channelCount | The number of channels in the flow. |
| [in] | sampleWordSize | The size of one sample in bytes. |
| [in] | bufferLength | The length of each channel buffer in samples. |
| [in] | maxSyncBatchSizeHintOpt | Optional max sync batch size hint. |
| [in] | maxCommitBatchSizeHintOpt | Optional max commit batch size hint |
Definition at line 327 of file FlowManager.cpp.
| std::pair< bool, std::unique_ptr< DiscreteFlowData > > mxl::lib::FlowManager::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 ) |
Create a new discrete flow together with its associated grains and open it in read-write mode.
| [in] | flowId | The id of the flow. |
| [in] | flowDef | The json definition of the flow (NMOS Resource format). The flow is not parsed or validated. It is written as is. |
| [in] | flowFormat | The flow data format. Must be one of the discrete formats. |
| [in] | grainCount | How many individual grains to create. |
| [in] | grainRate | The grain rate. |
| [in] | grainPayloadSize | Size of the grain in host memory. 0 if the grain payload lives in device memory. |
| [in] | grainNumOfSlices | Number of slices per grain. |
| [in] | grainSliceLengths | Length of each slice in bytes. |
| [in] | maxSyncBatchSizeHintOpt | Optional max sync batch size hint. |
| [in] | maxCommitBatchSizeHintOpt | Optional max commit batch size hint |
Definition at line 165 of file FlowManager.cpp.
| std::pair< bool, std::unique_ptr< EventFlowData > > mxl::lib::FlowManager::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.
| flowId | Identifier of the flow to create or open. |
| flowDef | Flow descriptor JSON to store when creating the flow. |
| eventCount | Number of slots to create, in the range 2 through 65536. |
| grainRate | Rate recorded in the common configuration. |
| eventPayloadSize | Per-entry payload capacity, in the range 1 through 1048576 bytes. |
| std::invalid_argument | The requested geometry is invalid. |
| std::filesystem::filesystem_error | Flow files cannot be created or opened. |
| std::runtime_error | Existing flow type or stored headers are incompatible. |
Definition at line 256 of file FlowManager.cpp.
| bool mxl::lib::FlowManager::deleteFlow | ( | std::unique_ptr< FlowData > && | flowData | ) |
Delete all resources associated to a flow
| flowData | The flowdata resource if the flow was previously opened or created |
Definition at line 480 of file FlowManager.cpp.
| bool mxl::lib::FlowManager::deleteFlow | ( | uuids::uuid const & | flowId | ) |
Delete all resources associated to a flow
| flowId | The ID of the flow to delete. |
Definition at line 498 of file FlowManager.cpp.
| std::filesystem::path const & mxl::lib::FlowManager::getDomain | ( | ) | const |
Accessor for the mxl domain (base path where shared memory will be stored)
Definition at line 576 of file FlowManager.cpp.
| std::string mxl::lib::FlowManager::getFlowDef | ( | uuids::uuid const & | flowId | ) | const |
| flowId | The ID of the flow to get the information about. |
| std::filesystem::filesystem_error | on flow not found |
| std::runtime_error | on any other error |
Definition at line 551 of file FlowManager.cpp.
| std::vector< uuids::uuid > mxl::lib::FlowManager::listFlows | ( | ) | const |
Definition at line 523 of file FlowManager.cpp.
|
private |
Definition at line 470 of file FlowManager.cpp.
|
private |
Definition at line 440 of file FlowManager.cpp.
| std::unique_ptr< FlowData > mxl::lib::FlowManager::openFlow | ( | uuids::uuid const & | flowId, |
| AccessMode | mode ) |
Open an existing flow by id.
| [in] | flowId | The flow to open |
| [in] | mode | The flow access mode |
Definition at line 394 of file FlowManager.cpp.
|
private |
Definition at line 153 of file FlowManager.hpp.