Clio  develop
The XRP Ledger API server.
Loading...
Searching...
No Matches
data::LedgerCacheLoadingState Class Reference

Concrete implementation of LedgerCacheLoadingStateInterface. More...

#include <LedgerCacheLoadingState.hpp>

Inheritance diagram for data::LedgerCacheLoadingState:
Collaboration diagram for data::LedgerCacheLoadingState:

Public Member Functions

 LedgerCacheLoadingState (LedgerCacheInterface const &cache)
 Construct a new LedgerCacheLoadingState.
void allowLoading () override
 Allow this node to begin loading the cache from the backend.
bool isLoadingAllowed () const override
 Check whether loading has been permitted.
void waitForLoadingAllowed () const override
 Block until loading is permitted.
bool isCurrentlyLoading () const override
 Check whether the cache is currently being loaded from the backend.
std::unique_ptr< LedgerCacheLoadingStateInterfaceclone () const override
 Create a clone that shares the same loading-allowed flag.

Detailed Description

Concrete implementation of LedgerCacheLoadingStateInterface.

Stores a reference to the ledger cache to delegate isCurrentlyLoading(), and a shared atomic flag for the loading-allowed coordination.

Constructor & Destructor Documentation

◆ LedgerCacheLoadingState()

data::LedgerCacheLoadingState::LedgerCacheLoadingState ( LedgerCacheInterface const & cache)
explicit

Construct a new LedgerCacheLoadingState.

Parameters
cacheThe cache whose loading status will be monitored

Member Function Documentation

◆ allowLoading()

void data::LedgerCacheLoadingState::allowLoading ( )
overridevirtual

Allow this node to begin loading the cache from the backend.

Implements data::LedgerCacheLoadingStateInterface.

◆ clone()

std::unique_ptr< LedgerCacheLoadingStateInterface > data::LedgerCacheLoadingState::clone ( ) const
nodiscardoverridevirtual

Create a clone that shares the same loading-allowed flag.

Note
Clones share the isLoadingAllowed_ atomic, so allowLoading() on any copy is visible to all clones.
Returns
A new instance sharing the same loading permission state

Implements data::LedgerCacheLoadingStateInterface.

◆ isCurrentlyLoading()

bool data::LedgerCacheLoadingState::isCurrentlyLoading ( ) const
nodiscardoverridevirtual

Check whether the cache is currently being loaded from the backend.

Returns
true if the underlying cache has been marked as loading and is not yet full

Implements data::LedgerCacheLoadingStateInterface.

◆ isLoadingAllowed()

bool data::LedgerCacheLoadingState::isLoadingAllowed ( ) const
nodiscardoverridevirtual

Check whether loading has been permitted.

Returns
true if allowLoading() has been called

Implements data::LedgerCacheLoadingStateInterface.

◆ waitForLoadingAllowed()

void data::LedgerCacheLoadingState::waitForLoadingAllowed ( ) const
overridevirtual

Block until loading is permitted.

Note
Returns immediately if allowLoading() was already called.

Implements data::LedgerCacheLoadingStateInterface.


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