Public Member Functions | Protected Member Functions | Protected Attributes | Private Attributes | List of all members
Aws::CloudWatch::CloudWatchService< D, T > Class Template Referenceabstract

#include <cloudwatch_service.h>

Inheritance diagram for Aws::CloudWatch::CloudWatchService< D, T >:
Inheritance graph
[legend]

Public Member Functions

virtual bool batchData (const D &data_to_batch)
 
virtual bool batchData (const D &data_to_batch, const std::chrono::milliseconds &milliseconds)
 
 CloudWatchService (std::shared_ptr< Publisher< std::list< T >>> publisher, std::shared_ptr< DataBatcher< T >> batcher)
 
virtual std::chrono::milliseconds getCurrentTimestamp ()
 
virtual std::chrono::milliseconds getDequeueDuration ()
 
int getNumberDequeued ()
 
virtual bool isConnected ()
 
virtual bool publishBatchedData ()
 
virtual bool setDequeueDuration (std::chrono::milliseconds new_value)
 
virtual bool shutdown ()
 
virtual bool start () override
 
 ~CloudWatchService ()=default
 
- Public Member Functions inherited from Aws::DataFlow::InputStage< TaskPtr< std::list< T > > >
std::shared_ptr< Source< TaskPtr< std::list< T > > > > getSource ()
 
void setSource (std::shared_ptr< Source< TaskPtr< std::list< T > > >> source)
 
- Public Member Functions inherited from RunnableService
std::string getStatusString () override
 
virtual bool isRunning ()
 
void join ()
 
 RunnableService ()
 
bool shutdown () override
 
bool start () override
 
void waitForShutdown ()
 
void waitForShutdown (std::chrono::milliseconds millis)
 
 ~RunnableService () override=default
 
- Public Member Functions inherited from Service
ServiceState getState ()
 
 Service ()
 
virtual ~Service ()=default
 

Protected Member Functions

virtual T convertInputToBatched (const D &input, const std::chrono::milliseconds &milliseconds)=0
 
virtual T convertInputToBatched (const D &input)=0
 
void work ()
 
- Protected Member Functions inherited from RunnableService
virtual void run ()
 
virtual bool startWorkerThread ()
 
virtual bool stopWorkerThread ()
 
- Protected Member Functions inherited from Service
void setState (ServiceState new_state)
 

Protected Attributes

std::shared_ptr< DataBatcher< T > > batcher_
 
std::chrono::milliseconds dequeue_duration_
 
std::shared_ptr< FileUploadStreamer< std::list< T > > > file_upload_streamer_
 
std::shared_ptr< Publisher< std::list< T > > > publisher_
 

Private Attributes

std::atomic< int > number_dequeued_
 

Detailed Description

template<typename D, typename T>
class Aws::CloudWatch::CloudWatchService< D, T >

Generic class to batch and publish data to CloudWatch. Note: if the file_upload_streamer is set then data will be stored on disk if offline (data cannot be successfully sent) and in the event of send success data will be read from disk and sent.

Template Parameters
Dthe type to be batched and converted to the CloudWatch published type T
Tthe type to be published to CloudWatch, specific to the AWS SDk

Definition at line 48 of file cloudwatch_service.h.

Constructor & Destructor Documentation

template<typename D , typename T >
Aws::CloudWatch::CloudWatchService< D, T >::CloudWatchService ( std::shared_ptr< Publisher< std::list< T >>>  publisher,
std::shared_ptr< DataBatcher< T >>  batcher 
)
inline
Exceptions
invalidargument if either publisher or batcher are null
Parameters
publisher
batcher
Returns

Definition at line 56 of file cloudwatch_service.h.

template<typename D , typename T >
Aws::CloudWatch::CloudWatchService< D, T >::~CloudWatchService ( )
default

Member Function Documentation

template<typename D , typename T >
virtual bool Aws::CloudWatch::CloudWatchService< D, T >::batchData ( const D &  data_to_batch)
inlinevirtual

Entry point to batch data for publishing

Parameters
data_to_batch
Returns
true of the data was successfully batched, false otherwise

Definition at line 129 of file cloudwatch_service.h.

template<typename D , typename T >
virtual bool Aws::CloudWatch::CloudWatchService< D, T >::batchData ( const D &  data_to_batch,
const std::chrono::milliseconds &  milliseconds 
)
inlinevirtual

Entry point to batch data for publishing

Parameters
data_to_batch
millisecondstimestamp of the data
Returns
true of the data was successfully batched, false otherwise

Definition at line 142 of file cloudwatch_service.h.

template<typename D , typename T >
virtual T Aws::CloudWatch::CloudWatchService< D, T >::convertInputToBatched ( const D &  input,
const std::chrono::milliseconds &  milliseconds 
)
protectedpure virtual
template<typename D , typename T >
virtual T Aws::CloudWatch::CloudWatchService< D, T >::convertInputToBatched ( const D &  input)
protectedpure virtual
template<typename D , typename T >
virtual std::chrono::milliseconds Aws::CloudWatch::CloudWatchService< D, T >::getCurrentTimestamp ( )
inlinevirtual

Return the current timestamp

Returns
current timestamp in std::chrono::milliseconds

Definition at line 204 of file cloudwatch_service.h.

template<typename D , typename T >
virtual std::chrono::milliseconds Aws::CloudWatch::CloudWatchService< D, T >::getDequeueDuration ( )
inlinevirtual

Return the amount of time to wait to dequeue a work item to attempt to publish.

Returns
std::chrono::milliseconds the amount of time to wait for tryDequeue

Definition at line 167 of file cloudwatch_service.h.

template<typename D , typename T >
int Aws::CloudWatch::CloudWatchService< D, T >::getNumberDequeued ( )
inline

Get the total number of items dequeued (and sent to the publishing mechanism) from the work thread.

Returns
the number of items dequeued and attempted to publish

Definition at line 185 of file cloudwatch_service.h.

template<typename D , typename T >
virtual bool Aws::CloudWatch::CloudWatchService< D, T >::isConnected ( )
inlinevirtual

Return the current connected state.

Returns
true if a connection to CloudWatch has been made, false if offline.

Definition at line 194 of file cloudwatch_service.h.

template<typename D , typename T >
virtual bool Aws::CloudWatch::CloudWatchService< D, T >::publishBatchedData ( )
inlinevirtual

Publishing mechanism, force the batcher to yield its data to the publisher and attempt to send.

Parameters
data_to_batch

Definition at line 155 of file cloudwatch_service.h.

template<typename D , typename T >
virtual bool Aws::CloudWatch::CloudWatchService< D, T >::setDequeueDuration ( std::chrono::milliseconds  new_value)
inlinevirtual

Definition at line 171 of file cloudwatch_service.h.

template<typename D , typename T >
virtual bool Aws::CloudWatch::CloudWatchService< D, T >::shutdown ( )
inlinevirtual

Shut all services down. Note: this method blocks and waits for the FileUploadStreamer's and its own RunnableService work threads to be complete.

Returns
true if everything shutdown correctly

Reimplemented from Service.

Definition at line 103 of file cloudwatch_service.h.

template<typename D , typename T >
virtual bool Aws::CloudWatch::CloudWatchService< D, T >::start ( )
inlineoverridevirtual

Start the publisher, batcher, and file upload streamer (collection of services).

Returns
true if everything started correctly

Reimplemented from Service.

Definition at line 81 of file cloudwatch_service.h.

template<typename D , typename T >
void Aws::CloudWatch::CloudWatchService< D, T >::work ( )
inlineprotectedvirtual

Main workhorse thread that dequeues from the source and calls Task run.

Implements RunnableService.

Definition at line 217 of file cloudwatch_service.h.

Member Data Documentation

template<typename D , typename T >
std::shared_ptr<DataBatcher<T> > Aws::CloudWatch::CloudWatchService< D, T >::batcher_
protected

Definition at line 242 of file cloudwatch_service.h.

template<typename D , typename T >
std::chrono::milliseconds Aws::CloudWatch::CloudWatchService< D, T >::dequeue_duration_
protected

Duration to wait for work from the queue.

Definition at line 247 of file cloudwatch_service.h.

template<typename D , typename T >
std::shared_ptr<FileUploadStreamer<std::list<T> > > Aws::CloudWatch::CloudWatchService< D, T >::file_upload_streamer_
protected

Definition at line 240 of file cloudwatch_service.h.

template<typename D , typename T >
std::atomic<int> Aws::CloudWatch::CloudWatchService< D, T >::number_dequeued_
private

Count of total items dequeued.

Definition at line 253 of file cloudwatch_service.h.

template<typename D , typename T >
std::shared_ptr<Publisher<std::list<T> > > Aws::CloudWatch::CloudWatchService< D, T >::publisher_
protected

Definition at line 241 of file cloudwatch_service.h.


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


dataflow_lite
Author(s): AWS RoboMaker
autogenerated on Fri May 7 2021 02:18:22