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 Types

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

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
 
const BlockIdCollectionTypeblockIdentifiers () const
 
 FlatFile (const FlatFile &rhs)=delete
 
 FlatFile (FlatFile &&rhs)=delete
 
FlatFileoperator= (const FlatFile &rhs)=delete
 
FlatFileoperator= (FlatFile &&rhs)=delete
 
 FlatFile (std::string path, BlockIdCollectionType existing_files, FlatFile::private_tag, logger::LoggerPtr log)
 
 ~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< Identifiername_to_id (const std::string &name)
 
static boost::optional< std::unique_ptr< FlatFile > > create (const std::string &path, logger::LoggerPtr log)
 

Static Public Attributes

static const uint32_t DIGIT_CAPACITY = 16
 

Detailed Description

Solid storage based on raw files

Member Typedef Documentation

Constructor & Destructor Documentation

iroha::ametsuchi::FlatFile::FlatFile ( const FlatFile rhs)
delete
iroha::ametsuchi::FlatFile::FlatFile ( FlatFile &&  rhs)
delete
FlatFile::FlatFile ( std::string  path,
BlockIdCollectionType  existing_files,
FlatFile::private_tag  ,
logger::LoggerPtr  log 
)

Create storage in path

Parameters
path- folder of storage
existing_files- collection of existing files names
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:

const BlockIdCollectionType & FlatFile::blockIdentifiers ( ) const
Returns
collection of available block ids
boost::optional< std::unique_ptr< FlatFile > > FlatFile::create ( const std::string &  path,
logger::LoggerPtr  log 
)
static

Create storage in paths

Parameters
path- target path for creating
log- logger
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.

boost::optional< Identifier > FlatFile::name_to_id ( const std::string &  name)
static

Converts aligned string (see above) to number.

Parameters
name- name to convert
Returns
id or boost::none

Here is the caller graph for this function:

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: