MySQL 9.1.0
Source Code Documentation
keyring_file::backend::Keyring_file_backend Class Referencefinal

#include <backend.h>

Public Member Functions

 Keyring_file_backend (const std::string &keyring_file_name, bool read_only)
 
 ~Keyring_file_backend ()=default
 
bool get (const keyring_common::meta::Metadata &metadata, keyring_common::data::Data &data) const
 Fetch data. More...
 
bool store (const keyring_common::meta::Metadata &metadata, keyring_common::data::Data &data)
 Store data. More...
 
bool erase (const keyring_common::meta::Metadata &metadata, keyring_common::data::Data &data)
 Erase data located at given key. More...
 
bool generate (const keyring_common::meta::Metadata &metadata, keyring_common::data::Data &data, size_t length)
 Generate random data and store it. More...
 
bool load_cache (keyring_common::operations::Keyring_operations< Keyring_file_backend > &operations)
 Populate cache. More...
 
size_t maximum_data_length () const
 Maximum data length supported. More...
 
size_t size () const
 Get number of elements stored in backend. More...
 
bool valid () const
 Validity. More...
 

Private Member Functions

bool write_to_file ()
 Write existing data to file. More...
 
void create_file_if_missing (const std::string &file_name)
 Create data file if missing. More...
 

Private Attributes

std::string keyring_file_name_
 Keyring file. More...
 
bool read_only_
 Read only flag. More...
 
keyring_common::json_data::Json_writer json_writer_
 In memory cache for keyring data. More...
 
bool valid_
 Validity. More...
 

Constructor & Destructor Documentation

◆ Keyring_file_backend()

keyring_file::backend::Keyring_file_backend::Keyring_file_backend ( const std::string &  keyring_file_name,
bool  read_only 
)
explicit

◆ ~Keyring_file_backend()

keyring_file::backend::Keyring_file_backend::~Keyring_file_backend ( )
default

Member Function Documentation

◆ create_file_if_missing()

void keyring_file::backend::Keyring_file_backend::create_file_if_missing ( const std::string &  file_name)
private

Create data file if missing.

◆ erase()

bool keyring_file::backend::Keyring_file_backend::erase ( const keyring_common::meta::Metadata metadata,
keyring_common::data::Data data 
)

Erase data located at given key.

Parameters
[in]metadataKey
[in]dataValue - not used.
Returns
Status of erase operation
Return values
falseData deleted
trueCould not find or delete data

◆ generate()

bool keyring_file::backend::Keyring_file_backend::generate ( const keyring_common::meta::Metadata metadata,
keyring_common::data::Data data,
size_t  length 
)

Generate random data and store it.

Parameters
[in]metadataKey
[out]dataGenerated value
[in]lengthLength of data to be generated
Returns
Status of generate + store operation
Return values
falseData generated and stored successfully
trueError

◆ get()

bool keyring_file::backend::Keyring_file_backend::get ( const keyring_common::meta::Metadata metadata,
keyring_common::data::Data data 
) const

Fetch data.

Parameters
[in]metadataKey
[out]dataValue
Returns
Status of find operation
Return values
falseEntry found. Check data.
trueEntry missing.

◆ load_cache()

bool keyring_file::backend::Keyring_file_backend::load_cache ( keyring_common::operations::Keyring_operations< Keyring_file_backend > &  operations)

Populate cache.

Parameters
[in]operationsHandle to operations class
Returns
status of cache insertion
Return values
falseSuccess
trueFailure

◆ maximum_data_length()

size_t keyring_file::backend::Keyring_file_backend::maximum_data_length ( ) const
inline

Maximum data length supported.

◆ size()

size_t keyring_file::backend::Keyring_file_backend::size ( ) const
inline

Get number of elements stored in backend.

◆ store()

bool keyring_file::backend::Keyring_file_backend::store ( const keyring_common::meta::Metadata metadata,
keyring_common::data::Data data 
)

Store data.

Parameters
[in]metadataKey
[in,out]dataValue
Returns
Status of store operation
Return values
falseEntry stored successfully
trueFailure

◆ valid()

bool keyring_file::backend::Keyring_file_backend::valid ( ) const
inline

Validity.

◆ write_to_file()

bool keyring_file::backend::Keyring_file_backend::write_to_file ( )
private

Write existing data to file.

This function overwrites existing data stored in the file.

Returns
Status of write operation.
Return values
falseSuccessfully written data to file
trueError writing data to file

Member Data Documentation

◆ json_writer_

keyring_common::json_data::Json_writer keyring_file::backend::Keyring_file_backend::json_writer_
private

In memory cache for keyring data.

◆ keyring_file_name_

std::string keyring_file::backend::Keyring_file_backend::keyring_file_name_
private

Keyring file.

◆ read_only_

bool keyring_file::backend::Keyring_file_backend::read_only_
private

Read only flag.

◆ valid_

bool keyring_file::backend::Keyring_file_backend::valid_
private

Validity.


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