NebulaStream
0.6.213
NebulaStream is a data and application management framework for the internet of things
|
A sink for testing that is instantiated using 'Type'. The CollectSink uses 'Type' as a template parameter for the TupleBuffer that it writes results into. More...
#include <TestSink.hpp>
Public Member Functions | |
CollectTestSink (const SchemaPtr &schema, const Runtime::NodeEnginePtr &nodeEngine, uint32_t numOfProducers=1) | |
Construct a new Collect Test Sink object. More... | |
bool | writeData (Runtime::TupleBuffer &inputBuffer, Runtime::WorkerContext &) override |
method to write a TupleBuffer More... | |
std::vector< Type > & | getResult () |
Get the results vector using the template Type of the CollectSink class. More... | |
void | setup () override |
virtual method to setup sink @Note this method will be overwritten by derived classes More... | |
std::string | toString () const override |
virtual function to get a string describing the particular sink @Note this function is overwritten by the particular data sink More... | |
SinkMediumTypes | getSinkMediumType () override |
method to return the type of medium More... | |
void | waitTillCompleted (size_t numberOfRecords) |
Waits until numberOfRecords records are produced. More... | |
void | waitTillCompletedOrTimeout (size_t numberOfRecords, uint64_t timeoutInMilliseconds) |
Either waits until numberOfRecords records are produced, or until the timeout is reached. More... | |
void | shutdown () override |
virtual method to shutdown sink @Note this method will be overwritten by derived classes More... | |
![]() | |
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... | |
![]() | |
~Reconfigurable () NES_NOEXCEPT(false) override=default | |
![]() | |
~virtual_enable_shared_from_this () NES_NOEXCEPT(isNoexceptDestructible) override=default | |
std::shared_ptr< T1 > | shared_from_this () |
std::weak_ptr< T1 > | weak_from_this () |
![]() | |
virtual | ~virtual_enable_shared_from_this_base () NES_NOEXCEPT(isNoexceptDestructible)=default |
Static Public Member Functions | |
static std::shared_ptr< CollectTestSink< Type > > | create (const SchemaPtr &schema, const Runtime::NodeEnginePtr &engine, uint32_t numOfProducers=1) |
Create factory function that calls the constructor of CollectTestSink and returns a shared pointer. More... | |
Public Attributes | |
std::mutex | m |
std::condition_variable | cv |
std::vector< Type > | results |
std::atomic< bool > | running |
Additional Inherited Members | |
![]() | |
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 is instantiated using 'Type'. The CollectSink uses 'Type' as a template parameter for the TupleBuffer that it writes results into.
Type | Used to determine the record layout (field types) of the TupleBuffer. |
|
inline |
Construct a new Collect Test Sink object.
schema | Used to create an object of the parent class 'SinkMedium'. |
nodeEngine | Also used to create a SinkMedium. Is used to manage queries. |
numOfProducers | Also used to create a SinkMedium. |
References NES_ASSERT, NES::SinkMedium::nodeEngine, and NES::Schema::ROW_LAYOUT.
|
inlinestatic |
Create factory function that calls the constructor of CollectTestSink and returns a shared pointer.
Referenced by NES::Testing::TestExecutionEngine::createCollectSink(), and NES::TEST_F().
|
inline |
Get the results vector using the template Type of the CollectSink class.
References NES::CollectTestSink< Type >::results.
|
inlineoverridevirtual |
method to return the type of medium
Implements NES::SinkMedium.
References NES::PRINT_SINK.
|
inlineoverridevirtual |
virtual method to setup sink @Note this method will be overwritten by derived classes
Implements NES::SinkMedium.
References NES::CollectTestSink< Type >::running.
|
inlineoverridevirtual |
virtual method to shutdown sink @Note this method will be overwritten by derived classes
Implements NES::SinkMedium.
References NES::CollectTestSink< Type >::cv, and NES::CollectTestSink< Type >::running.
|
inlineoverridevirtual |
virtual function to get a string describing the particular sink @Note this function is overwritten by the particular data sink
Implements NES::SinkMedium.
|
inline |
Waits until numberOfRecords records are produced.
numberOfRecords | The number of records to produce until we stop waiting. |
References NES::CollectTestSink< Type >::waitTillCompletedOrTimeout().
|
inline |
Either waits until numberOfRecords records are produced, or until the timeout is reached.
numberOfRecords | The number of records to produce until we stop waiting. |
timeoutInMilliseconds | Amount of time that needs to pass until we stop waiting. |
References NES::CollectTestSink< Type >::cv, NES::CollectTestSink< Type >::m, NES_DEBUG, NES_ERROR, NES::CollectTestSink< Type >::results, and NES::CollectTestSink< Type >::running.
Referenced by NES::CollectTestSink< Type >::waitTillCompleted().
|
inlineoverridevirtual |
method to write a TupleBuffer
a | tuple buffers pointer |
Implements NES::SinkMedium.
References NES::CollectTestSink< Type >::cv, NES::Runtime::TupleBuffer::getBuffer(), NES::Runtime::TupleBuffer::getNumberOfTuples(), NES::CollectTestSink< Type >::m, NES_DEBUG, and NES::CollectTestSink< Type >::results.
std::condition_variable NES::CollectTestSink< Type >::cv |
|
mutable |
std::vector<Type> NES::CollectTestSink< Type >::results |
std::atomic<bool> NES::CollectTestSink< Type >::running |