veriblock-pop-cpp
C++11 Libraries for leveraging VeriBlock Proof-Of-Proof blockchain technology.
altintegration::adaptors::InmemStorageImpl Struct Reference

Detailed Description

Definition at line 87 of file inmem_storage_impl.hpp.

+ Inheritance diagram for altintegration::adaptors::InmemStorageImpl:
+ Collaboration diagram for altintegration::adaptors::InmemStorageImpl:

Public Member Functions

void write (const std::vector< uint8_t > &key, const std::vector< uint8_t > &value) override
 
bool read (const std::vector< uint8_t > &key, std::vector< uint8_t > &value) override
 
std::shared_ptr< WriteBatchgenerateWriteBatch () override
 
std::shared_ptr< StorageIteratorgenerateIterator () override
 
virtual void write (const std::vector< uint8_t > &key, const std::vector< uint8_t > &value)=0
 
virtual bool read (const std::vector< uint8_t > &key, std::vector< uint8_t > &out)=0
 
virtual std::shared_ptr< WriteBatchgenerateWriteBatch ()=0
 
virtual std::shared_ptr< StorageIteratorgenerateIterator ()=0
 

Member Function Documentation

◆ generateIterator()

std::shared_ptr< StorageIterator > altintegration::adaptors::InmemStorageImpl::generateIterator ( )
inlineoverridevirtual

Implements altintegration::adaptors::Storage.

Definition at line 109 of file inmem_storage_impl.hpp.

109 {
110 return std::make_shared<InmemStorageIterator>(storage_);
111 }

◆ generateWriteBatch()

std::shared_ptr< WriteBatch > altintegration::adaptors::InmemStorageImpl::generateWriteBatch ( )
inlineoverridevirtual

Implements altintegration::adaptors::Storage.

Definition at line 105 of file inmem_storage_impl.hpp.

105 {
106 return std::make_shared<InmemWriteBatch>(storage_);
107 }

◆ read()

bool altintegration::adaptors::InmemStorageImpl::read ( const std::vector< uint8_t > &  key,
std::vector< uint8_t > &  value 
)
inlineoverridevirtual

Implements altintegration::adaptors::Storage.

Definition at line 95 of file inmem_storage_impl.hpp.

96 {
97 const auto& it = storage_.find(key);
98 if (it != storage_.end()) {
99 value = it->second;
100 return true;
101 }
102 return false;
103 }

◆ write()

void altintegration::adaptors::InmemStorageImpl::write ( const std::vector< uint8_t > &  key,
const std::vector< uint8_t > &  value 
)
inlineoverridevirtual

Implements altintegration::adaptors::Storage.

Definition at line 90 of file inmem_storage_impl.hpp.

91 {
92 storage_[key] = value;
93 }

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