|
NebulaStream
0.6.213
NebulaStream is a data and application management framework for the internet of things
|
A sink for testing that can be part of a query plan and enables executing queries and producing results. More...
#include <TestSink.hpp>
Public Member Functions | |
| TestSink (uint64_t expectedTuples, const SchemaPtr &schema, const Runtime::NodeEnginePtr &nodeEngine, uint32_t numOfProducers=1) | |
| Constructor for a TestSink. More... | |
| bool | writeData (Runtime::TupleBuffer &inputBuffer, Runtime::WorkerContext &) override |
| Writes the input Buffer to the resultBuffer. More... | |
| Runtime::TupleBuffer | get (uint64_t index) |
| Returns the TupleBuffer at the index. More... | |
| Runtime::MemoryLayouts::TestTupleBuffer | getResultBuffer (uint64_t index) |
| Returns the TestTupleBuffer at the index. More... | |
| std::vector< Runtime::MemoryLayouts::TestTupleBuffer > | getResultBuffers () |
| Returns all buffers as TestTupleBuffers. More... | |
| void | setup () override |
| Setup method. More... | |
| std::string | toString () const override |
| Creates a string representation. More... | |
| uint32_t | getNumberOfResultBuffers () |
| Returns the number of buffers that have been received. More... | |
| SinkMediumTypes | getSinkMediumType () override |
| Returns the MediumType. More... | |
| void | cleanupBuffers () |
| Clears all resultBuffers. More... | |
| void | waitTillCompleted () |
| Waits in a blocking fashion until all the number of expected buffers have been received. More... | |
| void | waitTillCompletedOrTimeout (uint64_t timeoutInMilliseconds) |
| Waits in a blocking fashion until all the number of expected buffers have been received or until the provided timeout is met. More... | |
| void | shutdown () override |
| Shuts this sink down. More... | |
Public Member Functions inherited from NES::SinkMedium | |
| SinkMedium (SinkFormatPtr sinkFormat, Runtime::NodeEnginePtr nodeEngine, uint32_t numOfProducers, SharedQueryId sharedQueryId, DecomposedQueryId decomposedQueryId, DecomposedQueryPlanVersion decomposedQueryVersion) | |
| public constructor for data sink More... | |
| SinkMedium (SinkFormatPtr sinkFormat, Runtime::NodeEnginePtr nodeEngine, uint32_t numOfProducers, SharedQueryId sharedQueryId, DecomposedQueryId decomposedQueryId, DecomposedQueryPlanVersion decomposedQueryVersion, uint64_t numberOfOrigins) | |
| public constructor for data sink More... | |
| SharedQueryId | getSharedQueryId () const |
| get the id of the owning plan More... | |
| DecomposedQueryId | getParentPlanId () const |
| get the subplan id of the owning plan More... | |
| DecomposedQueryPlanVersion | getParentPlanVersion () const |
| get the subplan version of the owning plan More... | |
| uint64_t | getNumberOfWrittenOutBuffers () |
| debug function for testing to get number of written buffers More... | |
| uint64_t | getNumberOfWrittenOutTuples () |
| debug function for testing to get number of written tuples More... | |
| SchemaPtr | getSchemaPtr () const |
| method to return the current schema of the sink More... | |
| std::string | getSinkFormat () |
| method to get the format as string More... | |
| void | reconfigure (Runtime::ReconfigurationMessage &message, Runtime::WorkerContext &context) override |
| void | postReconfigurationCallback (Runtime::ReconfigurationMessage &message) override |
| OperatorId | getOperatorId () const |
| Get operator id. More... | |
| void | setMigrationFlag () |
| Sets that sink is used for state migration. More... | |
| bool | isForMigration () const |
| Check whether this sink is used for state migration. More... | |
Public Member Functions inherited from NES::Runtime::Reconfigurable | |
| ~Reconfigurable () NES_NOEXCEPT(false) override=default | |
Public Member Functions inherited from NES::detail::virtual_enable_shared_from_this< Reconfigurable, false > | |
| ~virtual_enable_shared_from_this () NES_NOEXCEPT(isNoexceptDestructible) override=default | |
| std::shared_ptr< T1 > | shared_from_this () |
| std::weak_ptr< T1 > | weak_from_this () |
Public Member Functions inherited from NES::detail::virtual_enable_shared_from_this_base< isNoexceptDestructible > | |
| virtual | ~virtual_enable_shared_from_this_base () NES_NOEXCEPT(isNoexceptDestructible)=default |
Static Public Member Functions | |
| static std::shared_ptr< TestSink > | create (uint64_t expectedTuples, const SchemaPtr &schema, const Runtime::NodeEnginePtr &engine, uint32_t numOfProducers=1) |
| Factory method for a TestSink. More... | |
Public Attributes | |
| std::recursive_mutex | m |
| uint64_t | numOfExpectedTuples |
| std::promise< uint64_t > | completed |
| std::vector< Runtime::TupleBuffer > | resultBuffers |
| this vector must be cleanup by the test – do not rely on the engine to clean it up for you!! More... | |
| Runtime::MemoryLayouts::MemoryLayoutPtr | memoryLayout |
Additional Inherited Members | |
Protected Attributes inherited from NES::SinkMedium | |
| SinkFormatPtr | sinkFormat |
| bool | schemaWritten |
| Runtime::NodeEnginePtr | nodeEngine |
| std::atomic< uint32_t > | activeProducers |
| termination machinery More... | |
| SharedQueryId | sharedQueryId |
| DecomposedQueryId | decomposedQueryId |
| DecomposedQueryPlanVersion | decomposedQueryVersion |
| uint64_t | numberOfOrigins |
| uint64_t | sentBuffer {0} |
| uint64_t | sentTuples {0} |
| std::recursive_mutex | writeMutex |
| bool | migration {false} |
A sink for testing that can be part of a query plan and enables executing queries and producing results.
| NES::TestSink::TestSink | ( | uint64_t | expectedTuples, |
| const SchemaPtr & | schema, | ||
| const Runtime::NodeEnginePtr & | nodeEngine, | ||
| uint32_t | numOfProducers = 1 |
||
| ) |
Constructor for a TestSink.
| expectedTuples | |
| schema | |
| nodeEngine | |
| numOfProducers |
References NES::Schema::COLUMNAR_LAYOUT, NES::Runtime::MemoryLayouts::ColumnLayout::create(), NES::Runtime::MemoryLayouts::RowLayout::create(), memoryLayout, NES::SinkMedium::nodeEngine, and NES::Schema::ROW_LAYOUT.
| void NES::TestSink::cleanupBuffers | ( | ) |
Clears all resultBuffers.
References m, NES_DEBUG, and resultBuffers.
Referenced by shutdown().
|
static |
| Runtime::TupleBuffer NES::TestSink::get | ( | uint64_t | index | ) |
Returns the TupleBuffer at the index.
| index |
References index, m, and resultBuffers.
Referenced by getResultBuffer().
| uint32_t NES::TestSink::getNumberOfResultBuffers | ( | ) |
Returns the number of buffers that have been received.
References m, and resultBuffers.
Referenced by getResultBuffers().
| Runtime::MemoryLayouts::TestTupleBuffer NES::TestSink::getResultBuffer | ( | uint64_t | index | ) |
Returns the TestTupleBuffer at the index.
| index |
References get(), index, and memoryLayout.
Referenced by getResultBuffers().
| std::vector< Runtime::MemoryLayouts::TestTupleBuffer > NES::TestSink::getResultBuffers | ( | ) |
Returns all buffers as TestTupleBuffers.
References getNumberOfResultBuffers(), and getResultBuffer().
|
overridevirtual |
Returns the MediumType.
Implements NES::SinkMedium.
References NES::PRINT_SINK.
|
overridevirtual |
Setup method.
Implements NES::SinkMedium.
|
overridevirtual |
Shuts this sink down.
Implements NES::SinkMedium.
References cleanupBuffers().
|
overridevirtual |
| void NES::TestSink::waitTillCompleted | ( | ) |
Waits in a blocking fashion until all the number of expected buffers have been received.
References completed.
| void NES::TestSink::waitTillCompletedOrTimeout | ( | uint64_t | timeoutInMilliseconds | ) |
Waits in a blocking fashion until all the number of expected buffers have been received or until the provided timeout is met.
References completed.
|
overridevirtual |
Writes the input Buffer to the resultBuffer.
| inputBuffer |
Implements NES::SinkMedium.
References completed, NES::TestUtils::countTuples(), m, NES_DEBUG, NES_ERROR, numOfExpectedTuples, and resultBuffers.
| std::promise<uint64_t> NES::TestSink::completed |
Referenced by waitTillCompleted(), waitTillCompletedOrTimeout(), and writeData().
|
mutable |
Referenced by cleanupBuffers(), get(), getNumberOfResultBuffers(), and writeData().
| Runtime::MemoryLayouts::MemoryLayoutPtr NES::TestSink::memoryLayout |
Referenced by getResultBuffer(), and TestSink().
| uint64_t NES::TestSink::numOfExpectedTuples |
Referenced by writeData().
| std::vector<Runtime::TupleBuffer> NES::TestSink::resultBuffers |
this vector must be cleanup by the test – do not rely on the engine to clean it up for you!!
Referenced by cleanupBuffers(), get(), getNumberOfResultBuffers(), and writeData().