rippled
Public Types | Public Member Functions | Private Attributes | List of all members
ripple::BookListeners Class Reference

Listen to public/subscribe messages from a book. More...

Collaboration diagram for ripple::BookListeners:
Collaboration graph
[legend]

Public Types

using pointer = std::shared_ptr< BookListeners >
 

Public Member Functions

 BookListeners ()
 
void addSubscriber (InfoSub::ref sub)
 Add a new subscription for this book. More...
 
void removeSubscriber (std::uint64_t sub)
 Stop publishing to a subscriber. More...
 
void publish (Json::Value const &jvObj, hash_set< std::uint64_t > &havePublished)
 Publish a transaction to subscribers. More...
 

Private Attributes

std::recursive_mutex mLock
 
hash_map< std::uint64_t, InfoSub::wptrmListeners
 

Detailed Description

Listen to public/subscribe messages from a book.

Definition at line 30 of file BookListeners.h.

Member Typedef Documentation

◆ pointer

Definition at line 33 of file BookListeners.h.

Constructor & Destructor Documentation

◆ BookListeners()

ripple::BookListeners::BookListeners ( )

Definition at line 35 of file BookListeners.h.

Member Function Documentation

◆ addSubscriber()

void ripple::BookListeners::addSubscriber ( InfoSub::ref  sub)

Add a new subscription for this book.

Definition at line 27 of file BookListeners.cpp.

◆ removeSubscriber()

void ripple::BookListeners::removeSubscriber ( std::uint64_t  sub)

Stop publishing to a subscriber.

Definition at line 34 of file BookListeners.cpp.

◆ publish()

void ripple::BookListeners::publish ( Json::Value const &  jvObj,
hash_set< std::uint64_t > &  havePublished 
)

Publish a transaction to subscribers.

Publish a transaction to clients subscribed to changes on this book. Uses havePublished to prevent sending duplicate transactions to clients that have subscribed to multiple books.

Parameters
jvObjJSON transaction data to publish
havePublishedInfoSub sequence numbers that have already published this transaction.

Definition at line 41 of file BookListeners.cpp.

Member Data Documentation

◆ mLock

std::recursive_mutex ripple::BookListeners::mLock
private

Definition at line 64 of file BookListeners.h.

◆ mListeners

hash_map<std::uint64_t, InfoSub::wptr> ripple::BookListeners::mListeners
private

Definition at line 66 of file BookListeners.h.