NebulaStream  0.6.213
NebulaStream is a data and application management framework for the internet of things
NES::RequestProcessor::DummyRequest Class Reference
Collaboration diagram for NES::RequestProcessor::DummyRequest:
[legend]

Public Member Functions

 DummyRequest (uint8_t maxRetries, uint32_t initialValue, uint32_t additionValue, uint32_t returnNewRequestFrequency)
 
std::vector< AbstractRequestPtrexecuteRequestLogic () override
 executes the logic of the main thread. sub-requests can be scheduled from withing this function. Access to any data structure via the storage handler requires scheduling a sub-request which will make the resource access More...
 
std::vector< AbstractRequestPtrrollBack (std::exception_ptr, const StorageHandlerPtr &) override
 Roll back any changes made by a request that did not complete due to errors. More...
 
 DummyRequest (const std::vector< ResourceType > &requiredResources, uint8_t maxRetries, uint32_t responseValue)
 
std::vector< AbstractRequestPtrexecuteRequestLogic (const StorageHandlerPtr &) override
 Executes the request logic. More...
 
std::vector< AbstractRequestPtrrollBack (std::exception_ptr, const StorageHandlerPtr &) override
 Roll back any changes made by a request that did not complete due to errors. More...
 
- Public Member Functions inherited from NES::RequestProcessor::AbstractMultiRequest
 AbstractMultiRequest (uint8_t maxRetries)
 Constructor. More...
 
std::vector< AbstractRequestPtrexecute (const StorageHandlerPtr &storageHandle) final
 Executes the request logic. The first thread to execute this function for this request will be in charge of scheduling tasks for the following threads. More...
 
bool isDone ()
 Indicates if this request has finished its execution. More...
 
- Public Member Functions inherited from NES::RequestProcessor::AbstractRequest
 AbstractRequest (uint8_t maxRetries)
 constructor More...
 
void setId (RequestId requestId)
 set the id of this object. This has to be done before any resource is locked. More...
 
std::vector< AbstractRequestPtrhandleError (const std::exception_ptr &ex, const StorageHandlerPtr &storageHandle)
 Calls rollBack and executes additional error handling based on the exception if necessary. More...
 
bool retry ()
 Check if the request has already reached the maximum allowed retry attempts or if it can be retried again. If the maximum is not reached yet, increase the amount of recorded actual retries. More...
 
std::future< AbstractRequestResponsePtrgetFuture ()
 creates a future which will contain the response supplied by this request More...
 
virtual ~AbstractRequest ()=default
 destructor More...
 
template<class RequestType >
bool instanceOf ()
 Checks if this object is of type AbstractRequest. More...
 
template<class RequestType >
std::shared_ptr< RequestTypeas ()
 Dynamically casts the exception to the given type. More...
 
- Public Member Functions inherited from NES::RequestProcessor::AbstractUniRequest
 AbstractUniRequest (const std::vector< ResourceType > &requiredResources, uint8_t maxRetries)
 constructor More...
 
std::vector< AbstractRequestPtrexecute (const StorageHandlerPtr &storageHandle) final
 Acquires locks on the needed resources and executes the request logic. More...
 

Public Attributes

std::atomic< uint32_t > responseValue
 

Protected Member Functions

void preRollbackHandle (std::exception_ptr, const StorageHandlerPtr &) override
 Performs request specific error handling to be done before changes to the storage are rolled back. More...
 
void postRollbackHandle (std::exception_ptr, const StorageHandlerPtr &) override
 Performs request specific error handling to be done after changes to the storage are rolled back. More...
 
void preRollbackHandle (std::exception_ptr, const StorageHandlerPtr &) override
 Performs request specific error handling to be done before changes to the storage are rolled back. More...
 
void postRollbackHandle (std::exception_ptr, const StorageHandlerPtr &) override
 Performs request specific error handling to be done after changes to the storage are rolled back. More...
 
void postExecution (const StorageHandlerPtr &) override
 Performs steps to be done after execution of the request logic, e.g. unlocking the required data structures. More...
 
- Protected Member Functions inherited from NES::RequestProcessor::AbstractMultiRequest
SubRequestFuture scheduleSubRequest (AbstractSubRequestPtr subRequest)
 schedule a sub-request to be executed More...
 
- Protected Member Functions inherited from NES::RequestProcessor::AbstractRequest
void trySetExceptionInPromise (std::exception_ptr exception)
 if no exception or value has been set in this requests response promise yet, set the supplied exception. If a value has already been set, this method has no effect More...
 
void setExceptionInPromiseOrRethrow (std::exception_ptr exception)
 set and exception on the response promise if no value or exception has been set yet. If the promise already has a value or exception set, rethrow the exception in thsi thread More...
 
- Protected Member Functions inherited from NES::RequestProcessor::AbstractUniRequest
RequestId getResourceLockingId () override
 get an id that identifies this object to lock resources for exclusive use by this object More...
 
- Protected Member Functions inherited from NES::RequestProcessor::StorageResourceLocker
 StorageResourceLocker (std::vector< ResourceType > requiredResources)
 Constructor. More...
 
virtual void preExecution (const StorageHandlerPtr &storageHandle)
 Performs steps to be done before execution of the request logic, e.g. locking the required data structures. More...
 

Additional Inherited Members

- Protected Attributes inherited from NES::RequestProcessor::AbstractRequest
RequestId requestId {INVALID_REQUEST_ID}
 
std::promise< AbstractRequestResponsePtrresponsePromise
 

Constructor & Destructor Documentation

◆ DummyRequest() [1/2]

NES::RequestProcessor::DummyRequest::DummyRequest ( uint8_t  maxRetries,
uint32_t  initialValue,
uint32_t  additionValue,
uint32_t  returnNewRequestFrequency 
)
inline

◆ DummyRequest() [2/2]

NES::RequestProcessor::DummyRequest::DummyRequest ( const std::vector< ResourceType > &  requiredResources,
uint8_t  maxRetries,
uint32_t  responseValue 
)
inline

Member Function Documentation

◆ executeRequestLogic() [1/2]

std::vector<AbstractRequestPtr> NES::RequestProcessor::DummyRequest::executeRequestLogic ( )
inlineoverridevirtual

executes the logic of the main thread. sub-requests can be scheduled from withing this function. Access to any data structure via the storage handler requires scheduling a sub-request which will make the resource access

Returns
a list of follow up requests to returned to the request executor (can be empty if no further actions are required)

Implements NES::RequestProcessor::AbstractMultiRequest.

References NES::RequestProcessor::AbstractRequest::responsePromise, responseValue, and NES::RequestProcessor::AbstractMultiRequest::scheduleSubRequest().

Here is the call graph for this function:

◆ executeRequestLogic() [2/2]

std::vector<AbstractRequestPtr> NES::RequestProcessor::DummyRequest::executeRequestLogic ( const StorageHandlerPtr storageHandle)
inlineoverridevirtual

Executes the request logic.

Parameters
storageHandlea handle to access the coordinators data structures which might be needed for executing the request
Returns
a list of follow up requests to be executed (can be empty if no further actions are required)

Implements NES::RequestProcessor::AbstractUniRequest.

References NES::RequestProcessor::AbstractRequest::responsePromise, and responseValue.

◆ postExecution()

void NES::RequestProcessor::DummyRequest::postExecution ( const StorageHandlerPtr storageHandle)
inlineoverrideprotectedvirtual

Performs steps to be done after execution of the request logic, e.g. unlocking the required data structures.

Parameters
storageHandleThe storage access handle used by the request

Reimplemented from NES::RequestProcessor::StorageResourceLocker.

◆ postRollbackHandle() [1/2]

void NES::RequestProcessor::DummyRequest::postRollbackHandle ( std::exception_ptr  ex,
const StorageHandlerPtr storageHandle 
)
inlineoverrideprotectedvirtual

Performs request specific error handling to be done after changes to the storage are rolled back.

Parameters
exThe exception thrown during request execution. std::exception_ptr is used to be able to allow setting an exception state on the requests response promise without losing data to slicing in case the request cannot handle the exception itself
storageHandleThe storage access handle used by the request

Implements NES::RequestProcessor::AbstractRequest.

◆ postRollbackHandle() [2/2]

void NES::RequestProcessor::DummyRequest::postRollbackHandle ( std::exception_ptr  ex,
const StorageHandlerPtr storageHandle 
)
inlineoverrideprotectedvirtual

Performs request specific error handling to be done after changes to the storage are rolled back.

Parameters
exThe exception thrown during request execution. std::exception_ptr is used to be able to allow setting an exception state on the requests response promise without losing data to slicing in case the request cannot handle the exception itself
storageHandleThe storage access handle used by the request

Implements NES::RequestProcessor::AbstractRequest.

◆ preRollbackHandle() [1/2]

void NES::RequestProcessor::DummyRequest::preRollbackHandle ( std::exception_ptr  ex,
const StorageHandlerPtr storageHandle 
)
inlineoverrideprotectedvirtual

Performs request specific error handling to be done before changes to the storage are rolled back.

Parameters
exThe exception thrown during request execution. std::exception_ptr is used to be able to allow setting an exception state on the requests response promise without losing data to slicing in case the request cannot handle the exception itself
storageHandleThe storage access handle used by the request

Implements NES::RequestProcessor::AbstractRequest.

◆ preRollbackHandle() [2/2]

void NES::RequestProcessor::DummyRequest::preRollbackHandle ( std::exception_ptr  ex,
const StorageHandlerPtr storageHandle 
)
inlineoverrideprotectedvirtual

Performs request specific error handling to be done before changes to the storage are rolled back.

Parameters
exThe exception thrown during request execution. std::exception_ptr is used to be able to allow setting an exception state on the requests response promise without losing data to slicing in case the request cannot handle the exception itself
storageHandleThe storage access handle used by the request

Implements NES::RequestProcessor::AbstractRequest.

◆ rollBack() [1/2]

std::vector<AbstractRequestPtr> NES::RequestProcessor::DummyRequest::rollBack ( std::exception_ptr  ex,
const StorageHandlerPtr storageHandle 
)
inlineoverridevirtual

Roll back any changes made by a request that did not complete due to errors.

Parameters
exThe exception thrown during request execution. std::exception_ptr is used to be able to allow setting an exception state on the requests response promise without losing data to slicing in case the request cannot handle the exception itself
storageHandleThe storage access handle that was used by the request to modify the system state.
Returns
a list of follow up requests to be executed (can be empty if no further actions are required)

Implements NES::RequestProcessor::AbstractRequest.

◆ rollBack() [2/2]

std::vector<AbstractRequestPtr> NES::RequestProcessor::DummyRequest::rollBack ( std::exception_ptr  ex,
const StorageHandlerPtr storageHandle 
)
inlineoverridevirtual

Roll back any changes made by a request that did not complete due to errors.

Parameters
exThe exception thrown during request execution. std::exception_ptr is used to be able to allow setting an exception state on the requests response promise without losing data to slicing in case the request cannot handle the exception itself
storageHandleThe storage access handle that was used by the request to modify the system state.
Returns
a list of follow up requests to be executed (can be empty if no further actions are required)

Implements NES::RequestProcessor::AbstractRequest.

Member Data Documentation

◆ responseValue

std::atomic<uint32_t> NES::RequestProcessor::DummyRequest::responseValue

Referenced by executeRequestLogic().


The documentation for this class was generated from the following files: