hyperledger/iroha
Iroha - A simple, decentralized ledger http://iroha.tech
iroha::ametsuchi::FlatFile Class Reference

#include "flat_file.hpp"

Inheritance diagram for iroha::ametsuchi::FlatFile:
Inheritance graph
Collaboration diagram for iroha::ametsuchi::FlatFile:
Collaboration graph

Public Member Functions

bool add (Identifier id, const Bytes &blob) override
 
boost::optional< Bytesget (Identifier id) const override
 
std::string directory () const override
 
Identifier last_id () const override
 
void dropAll () override
 
 FlatFile (const FlatFile &rhs)=delete
 
 FlatFile (FlatFile &&rhs)=delete
 
FlatFileoperator= (const FlatFile &rhs)=delete
 
FlatFileoperator= (FlatFile &&rhs)=delete
 
 FlatFile (Identifier last_id, const std::string &path, FlatFile::private_tag, logger::Logger log=logger::log("FlatFile"))
 
 ~FlatFile ()=default
 
- Public Member Functions inherited from iroha::ametsuchi::KeyValueStorage
virtual ~KeyValueStorage ()=default
 

Static Public Member Functions

static std::string id_to_name (Identifier id)
 
static boost::optional< std::unique_ptr< FlatFile > > create (const std::string &path)
 
static boost::optional< Identifiercheck_consistency (const std::string &dump_dir)
 

Static Public Attributes

static const uint32_t DIGIT_CAPACITY = 16
 

Additional Inherited Members

- Public Types inherited from iroha::ametsuchi::KeyValueStorage
using Identifier = uint32_t
 
using Bytes = std::vector< uint8_t >
 

Detailed Description

Solid storage based on raw files

Constructor & Destructor Documentation

iroha::ametsuchi::FlatFile::FlatFile ( const FlatFile rhs)
delete
iroha::ametsuchi::FlatFile::FlatFile ( FlatFile &&  rhs)
delete
FlatFile::FlatFile ( Identifier  last_id,
const std::string path,
FlatFile::private_tag  ,
logger::Logger  log = logger::log("FlatFile") 
)

Create storage in path with respect to last key

Parameters
last_id- maximal key written in storage
path- folder of storage
logto print progress
iroha::ametsuchi::FlatFile::~FlatFile ( )
default

Member Function Documentation

bool FlatFile::add ( Identifier  id,
const Bytes blob 
)
overridevirtual

Add entity with binary data

Parameters
id- reference key
blob- data associated with key

Implements iroha::ametsuchi::KeyValueStorage.

Here is the call graph for this function:

boost::optional< Identifier > FlatFile::check_consistency ( const std::string dump_dir)
static

Checking consistency of storage for provided folder If some block in the middle is missing all blocks following it are deleted

Parameters
dump_dir- folder of storage
Returns
- last available identifier

Here is the call graph for this function:

Here is the caller graph for this function:

boost::optional< std::unique_ptr< FlatFile > > FlatFile::create ( const std::string path)
static

Create storage in paths

Parameters
path- target path for creating
Returns
created storage

Here is the call graph for this function:

Here is the caller graph for this function:

std::string FlatFile::directory ( ) const
overridevirtual
Returns
folder of storage

Implements iroha::ametsuchi::KeyValueStorage.

void FlatFile::dropAll ( )
overridevirtual

Implements iroha::ametsuchi::KeyValueStorage.

Here is the call graph for this function:

boost::optional< FlatFile::Bytes > FlatFile::get ( Identifier  id) const
overridevirtual

Get data associated with

Parameters
id- reference key
Returns
- blob, if exists

Implements iroha::ametsuchi::KeyValueStorage.

Here is the call graph for this function:

std::string FlatFile::id_to_name ( Identifier  id)
static

Convert id to a string representation. The string representation is always DIGIT_CAPACITY-character width regardless of the value of id. If the length of the string representation of id is less than DIGIT_CAPACITY, then the returned value is filled with leading zeros.

For example, if str_rep(id) is "123", then the returned value is "0000000000000123".

Parameters
id- for conversion
Returns
string repr of identifier

Here is the caller graph for this function:

Identifier FlatFile::last_id ( ) const
overridevirtual
Returns
chronologically last not null key

Implements iroha::ametsuchi::KeyValueStorage.

FlatFile& iroha::ametsuchi::FlatFile::operator= ( const FlatFile rhs)
delete
FlatFile& iroha::ametsuchi::FlatFile::operator= ( FlatFile &&  rhs)
delete

Member Data Documentation

const uint32_t iroha::ametsuchi::FlatFile::DIGIT_CAPACITY = 16
static

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