NebulaStream
0.6.213
NebulaStream is a data and application management framework for the internet of things
|
This represent a sink operator that acts as a connecting API between query processing and network stack. More...
#include <NetworkSink.hpp>
Public Member Functions | |
NetworkSink (const SchemaPtr &schema, OperatorId uniqueNetworkSinkDescriptorId, SharedQueryId sharedQueryId, DecomposedQueryId decomposedQueryId, DecomposedQueryPlanVersion decomposedQueryVersion, NodeLocation const &destination, NesPartition nesPartition, Runtime::NodeEnginePtr nodeEngine, size_t numOfProducers, std::chrono::milliseconds waitTime, uint8_t retryTimes, uint64_t numberOfOrigins, DecomposedQueryPlanVersion version) | |
constructor for the network sink More... | |
bool | writeData (Runtime::TupleBuffer &inputBuffer, Runtime::WorkerContext &workerContext) override |
Writes data to the underlying output channel. More... | |
std::string | toString () const override |
void | reconfigure (Runtime::ReconfigurationMessage &task, Runtime::WorkerContext &workerContext) override |
reconfiguration machinery for the network sink More... | |
void | postReconfigurationCallback (Runtime::ReconfigurationMessage &) override |
callback that will be called on the last thread the executes the reconfiguration More... | |
void | setup () override |
setup method to configure the network sink via a reconfiguration More... | |
void | preSetup () |
void | shutdown () override |
Destroys the network sink. More... | |
SinkMediumTypes | getSinkMediumType () override |
method to return the type of medium More... | |
OperatorId | getUniqueNetworkSinkDescriptorId () const |
method to return the network sinks descriptor id More... | |
Runtime::NodeEnginePtr | getNodeEngine () |
method to return the node engine pointer More... | |
DecomposedQueryPlanVersion | getVersion () |
method to return the plan version More... | |
void | configureNewSinkDescriptor (const NetworkSinkDescriptor &newNetworkSinkDescriptor) |
reconfigure this sink to point to another downstream network source More... | |
bool | scheduleNewDescriptor (const NetworkSinkDescriptor &networkSinkDescriptor) |
schedule a new receiver location and new receiver partition and versio number to be set for this sink. More... | |
bool | applyNextSinkDescriptor () |
apply pending changes to the receiver location, receiver partition and version number 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 |
![]() | |
~virtual_enable_shared_from_this () NES_NOEXCEPT(isNoexceptDestructible) override=default | |
std::shared_ptr< T1 > | shared_from_this () |
std::weak_ptr< T1 > | weak_from_this () |
Protected Member Functions | |
void | onEvent (Runtime::BaseEvent &event) override |
This method is called once an event is triggered for the current sink. More... | |
void | onEvent (Runtime::BaseEvent &event, Runtime::WorkerContextRef workerContext) |
API method called upon receiving an event. More... | |
Friends | |
bool | operator< (const NetworkSink &lhs, const NetworkSink &rhs) |
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} |
This represent a sink operator that acts as a connecting API between query processing and network stack.
|
explicit |
constructor for the network sink
schema | |
networkManager | |
nodeLocation | |
nesPartition | |
version | The initial version of this sink when it starts |
References NES_ASSERT, and NES_DEBUG.
bool NES::Network::NetworkSink::applyNextSinkDescriptor | ( | ) |
apply pending changes to the receiver location, receiver partition and version number
References configureNewSinkDescriptor().
void NES::Network::NetworkSink::configureNewSinkDescriptor | ( | const NetworkSinkDescriptor & | newNetworkSinkDescriptor | ) |
reconfigure this sink to point to another downstream network source
newPartition | the partition of the new downstram source |
newReceiverLocation | the location of the node where the new downstream source is located |
newVersion | The new version number assigned to this sink |
References NES::Runtime::ConnectToNewReceiver, NES::SinkMedium::decomposedQueryId, NES_ASSERT2_FMT, NES::detail::virtual_enable_shared_from_this< Reconfigurable, false >::shared_from_this(), and NES::detail::virtual_enable_shared_from_this< RuntimeEventListener, false >::shared_from_this().
Referenced by applyNextSinkDescriptor().
Runtime::NodeEnginePtr NES::Network::NetworkSink::getNodeEngine | ( | ) |
method to return the node engine pointer
|
overridevirtual |
method to return the type of medium
Implements NES::SinkMedium.
References NES::NETWORK_SINK.
OperatorId NES::Network::NetworkSink::getUniqueNetworkSinkDescriptorId | ( | ) | const |
method to return the network sinks descriptor id
Referenced by reconfigure(), and writeData().
DecomposedQueryPlanVersion NES::Network::NetworkSink::getVersion | ( | ) |
method to return the plan version
|
overrideprotectedvirtual |
This method is called once an event is triggered for the current sink.
event |
Implements NES::Runtime::RuntimeEventListener.
References NES::SinkMedium::decomposedQueryId, NES::Runtime::BaseEvent::getEventType(), NES::Runtime::kStartSourceEvent, and NES_DEBUG.
Referenced by onEvent().
|
protected |
|
overridevirtual |
callback that will be called on the last thread the executes the reconfiguration
Reimplemented from NES::Runtime::Reconfigurable.
References NES::Runtime::ConnectToNewReceiver, NES::SinkMedium::decomposedQueryId, NES::SinkMedium::decomposedQueryVersion, NES::Runtime::ReconfigurationMessage::getType(), NES::Runtime::ReconfigurationMessage::getUserData(), NES::ReconfigurationMetadata::instanceOf(), NES_ASSERT2_FMT, NES_DEBUG, NES_ERROR, NES_NOT_IMPLEMENTED, NES_WARNING, NES::SinkMedium::postReconfigurationCallback(), and NES::Runtime::ReconfigurationMarker.
void NES::Network::NetworkSink::preSetup | ( | ) |
References NES::SinkMedium::decomposedQueryId, NES_DEBUG, NES_WARNING, and NES::detail::virtual_enable_shared_from_this< RuntimeEventListener, false >::shared_from_this().
|
overridevirtual |
reconfiguration machinery for the network sink
task | descriptor of the reconfiguration |
workerContext | the thread on which this is called |
Reimplemented from NES::Runtime::Reconfigurable.
References NES::Runtime::WorkerContext::abortConnectionProcess(), NES::Runtime::ConnectionEstablished, NES::Runtime::ConnectToNewReceiver, NES::Runtime::WorkerContext::createStorage(), NES::SinkMedium::decomposedQueryId, NES::SinkMedium::decomposedQueryVersion, NES::Runtime::WorkerContext::decreaseObjectRefCnt(), NES::Runtime::FailEndOfStream, NES::Runtime::Failure, NES::Runtime::NesThread::getId(), NES::Runtime::ReconfigurationMessage::getType(), getUniqueNetworkSinkDescriptorId(), NES::Runtime::ReconfigurationMessage::getUserData(), NES::Runtime::Graceful, NES::Runtime::HardEndOfStream, NES::Runtime::HardStop, NES::Runtime::Initialize, NES::Runtime::Invalid, NES::Runtime::WorkerContext::isAsyncConnectionInProgress(), backward::details::move(), NES_ASSERT, NES_ASSERT2_FMT, NES_DEBUG, NES_NOT_IMPLEMENTED, NES_THROW_RUNTIME_ERROR, NES_WARNING, NES::Network::VersionUpdate::nodeLocation, NES::Runtime::ReconfigurationMarker, NES::Runtime::reconfigurationTypeToTerminationType(), NES::SinkMedium::reconfigure(), NES::Runtime::WorkerContext::releaseNetworkChannel(), NES::Runtime::WorkerContext::setObjectRefCnt(), NES::detail::virtual_enable_shared_from_this< Reconfigurable, false >::shared_from_this(), NES::SinkMedium::sharedQueryId, NES::Runtime::SoftEndOfStream, NES::Runtime::WorkerContext::storeNetworkChannel(), NES::Runtime::WorkerContext::storeNetworkChannelFuture(), and NES::Runtime::WorkerContext::waitForAsyncConnection().
bool NES::Network::NetworkSink::scheduleNewDescriptor | ( | const NetworkSinkDescriptor & | networkSinkDescriptor | ) |
schedule a new receiver location and new receiver partition and versio number to be set for this sink.
networkSinkDescriptor | : a sink descriptor containing the new location and partition which will be set as pending |
|
overridevirtual |
setup method to configure the network sink via a reconfiguration
Implements NES::SinkMedium.
References NES::SinkMedium::decomposedQueryId, NES::Runtime::Initialize, NES_DEBUG, NES::detail::virtual_enable_shared_from_this< Reconfigurable, false >::shared_from_this(), and NES::SinkMedium::sharedQueryId.
|
overridevirtual |
Destroys the network sink.
Implements NES::SinkMedium.
References NES::SinkMedium::decomposedQueryId, NES_DEBUG, and NES::SinkMedium::sharedQueryId.
|
overridevirtual |
Implements NES::SinkMedium.
|
overridevirtual |
Writes data to the underlying output channel.
inputBuffer | |
workerContext |
Implements NES::SinkMedium.
References NES::SinkMedium::decomposedQueryId, NES::SinkMedium::decomposedQueryVersion, NES::Runtime::WorkerContext::getId(), NES::Runtime::WorkerContext::getNetworkChannel(), NES::Runtime::TupleBuffer::getOriginId(), NES::Runtime::TupleBuffer::getSequenceNumber(), getUniqueNetworkSinkDescriptorId(), NES::Runtime::WorkerContext::insertIntoReconnectBufferStorage(), NES::Runtime::WorkerContext::isAsyncConnectionInProgress(), NES_ASSERT2_FMT, NES_DEBUG, NES_TRACE, and NES::SinkMedium::sinkFormat.
|
friend |