Changeset View
Changeset View
Standalone View
Standalone View
src/interfaces/chain.h
Show All 9 Lines | |||||
#include <vector> | #include <vector> | ||||
namespace interfaces { | namespace interfaces { | ||||
//! Interface for giving wallet processes access to blockchain state. | //! Interface for giving wallet processes access to blockchain state. | ||||
class Chain { | class Chain { | ||||
public: | public: | ||||
virtual ~Chain() {} | virtual ~Chain() {} | ||||
//! Interface for querying locked chain state, used by legacy code that | |||||
//! assumes state won't change between calls. New code should avoid using | |||||
//! the Lock interface and instead call higher-level Chain methods | |||||
//! that return more information so the chain doesn't need to stay locked | |||||
//! between calls. | |||||
class Lock { | |||||
public: | |||||
virtual ~Lock() {} | |||||
}; | |||||
//! Return Lock interface. Chain is locked when this is called, and | |||||
//! unlocked when the returned interface is freed. | |||||
virtual std::unique_ptr<Lock> lock(bool try_lock = false) = 0; | |||||
//! Return Lock interface assuming chain is already locked. This | |||||
//! method is temporary and is only used in a few places to avoid changing | |||||
//! behavior while code is transitioned to use the Chain::Lock interface. | |||||
virtual std::unique_ptr<Lock> assumeLocked() = 0; | |||||
}; | }; | ||||
//! Interface to let node manage chain clients (wallets, or maybe tools for | //! Interface to let node manage chain clients (wallets, or maybe tools for | ||||
//! monitoring and analysis in the future). | //! monitoring and analysis in the future). | ||||
class ChainClient { | class ChainClient { | ||||
public: | public: | ||||
virtual ~ChainClient() {} | virtual ~ChainClient() {} | ||||
}; | }; | ||||
Show All 18 Lines |