MySQL 9.1.0
Source Code Documentation
keyring_common::operations::Keyring_operations< Backend, Data_extension > Class Template Reference

Keyring operations A class to perform operations on keyring. More...

#include <operations.h>

Public Member Functions

 Keyring_operations (bool cache_data, Backend *backend)
 Constructor. More...
 
 ~Keyring_operations ()=default
 
bool insert (const meta::Metadata &metadata, Data_extension secret_data)
 Insert API to populate cache. More...
 
bool get (const meta::Metadata &metadata, data::Data &data)
 Search API. More...
 
bool get_data_extension (const meta::Metadata &metadata, Data_extension &data)
 Get Backend-specific data extension. More...
 
bool store (const meta::Metadata &metadata, const data::Data &data)
 Store API. More...
 
bool erase (const meta::Metadata &metadata)
 Remove API. More...
 
bool generate (const meta::Metadata &metadata, const data::Type type, size_t length)
 Generate API. More...
 
bool init_read_iterator (std::unique_ptr< iterator::Iterator< Data_extension > > &it, const meta::Metadata &metadata)
 Iterator creation for read. More...
 
bool init_forward_iterator (std::unique_ptr< iterator::Iterator< Data_extension > > &it, bool cached)
 Iterator creation. More...
 
void deinit_forward_iterator (std::unique_ptr< iterator::Iterator< Data_extension > > &it)
 Iterator destruction. More...
 
bool is_valid (std::unique_ptr< iterator::Iterator< Data_extension > > &it)
 Check iterator validity. More...
 
bool next (std::unique_ptr< iterator::Iterator< Data_extension > > &it)
 Move iterator forward. More...
 
bool get_iterator_data (std::unique_ptr< iterator::Iterator< Data_extension > > &it, meta::Metadata &metadata, Data_extension &data)
 Get data from iterator. More...
 
bool get_iterator_metadata (std::unique_ptr< iterator::Iterator< Data_extension > > &it, meta::Metadata &metadata, Data_extension &data)
 Get metadata from iterator. More...
 
size_t maximum_data_length () const
 Maximum data length supported. More...
 
size_t keyring_size ()
 Keyring size. More...
 
bool valid ()
 Validity. More...
 

Private Member Functions

void load_cache ()
 

Private Attributes

cache::Datacache< Data_extension > cache_
 Metadata cache. More...
 
bool cache_data_
 Flag to cache data. More...
 
std::unique_ptr< Backend > backend_
 Keyring backend. More...
 
bool valid_
 Validity. More...
 

Detailed Description

template<typename Backend, typename Data_extension = data::Data>
class keyring_common::operations::Keyring_operations< Backend, Data_extension >

Keyring operations A class to perform operations on keyring.

If cache is enabled, operations uses it. Otherwise, backend is used.

Assumptions:

  1. Backend implements interface to keyring backend.
  2. Backend is required to support same Data_extension as Keyring_operations

Please see "How to write a new keyring component" for details about Backend class.

Constructor & Destructor Documentation

◆ Keyring_operations()

template<typename Backend , typename Data_extension = data::Data>
keyring_common::operations::Keyring_operations< Backend, Data_extension >::Keyring_operations ( bool  cache_data,
Backend *  backend 
)
inlineexplicit

Constructor.

Parameters
[in]cache_dataWhether to cache data or not
[in]backendPointer to keyring backend

Populates the cache from backend

◆ ~Keyring_operations()

template<typename Backend , typename Data_extension = data::Data>
keyring_common::operations::Keyring_operations< Backend, Data_extension >::~Keyring_operations ( )
default

Member Function Documentation

◆ deinit_forward_iterator()

template<typename Backend , typename Data_extension = data::Data>
void keyring_common::operations::Keyring_operations< Backend, Data_extension >::deinit_forward_iterator ( std::unique_ptr< iterator::Iterator< Data_extension > > &  it)
inline

Iterator destruction.

Parameters
[in,out]itForward iterator to metadata

◆ erase()

template<typename Backend , typename Data_extension = data::Data>
bool keyring_common::operations::Keyring_operations< Backend, Data_extension >::erase ( const meta::Metadata metadata)
inline

Remove API.

Parameters
[in]metadataKey to the data
Returns
status of remove operation
Return values
falseSuccess - data removed OR does not exist
trueFailure

◆ generate()

template<typename Backend , typename Data_extension = data::Data>
bool keyring_common::operations::Keyring_operations< Backend, Data_extension >::generate ( const meta::Metadata metadata,
const data::Type  type,
size_t  length 
)
inline

Generate API.

Parameters
[in]metadataKey for the data
[in]typeType of data
[in]lengthLength of data to be generated
Returns
status of data generation
Return values
falseSuccess - data generated and stored in backend
trueFailure

◆ get()

template<typename Backend , typename Data_extension = data::Data>
bool keyring_common::operations::Keyring_operations< Backend, Data_extension >::get ( const meta::Metadata metadata,
data::Data data 
)
inline

Search API.

Parameters
[in]metadataKey to the data
[out]dataFetched data
Returns
status of search operation
Return values
falseSuccess - data contains required information
trueFailure - data is not valid

◆ get_data_extension()

template<typename Backend , typename Data_extension = data::Data>
bool keyring_common::operations::Keyring_operations< Backend, Data_extension >::get_data_extension ( const meta::Metadata metadata,
Data_extension &  data 
)
inline

Get Backend-specific data extension.

Parameters
[in]metadataKey to the data
[out]dataFetched data extension
Returns
status of search operation
Return values
falseSuccess - data contains required information
trueFailure - data is not valid

NOTE: get_data_extension NEVER returns data. It only returns Data extension information.

◆ get_iterator_data()

template<typename Backend , typename Data_extension = data::Data>
bool keyring_common::operations::Keyring_operations< Backend, Data_extension >::get_iterator_data ( std::unique_ptr< iterator::Iterator< Data_extension > > &  it,
meta::Metadata metadata,
Data_extension &  data 
)
inline

Get data from iterator.

Parameters
[in]itForward iterator to metadata
[out]metadataMetadata for given key
[out]dataData for given key (Including extension)
Returns
Status
Return values
falseSuccess
trueFailure

◆ get_iterator_metadata()

template<typename Backend , typename Data_extension = data::Data>
bool keyring_common::operations::Keyring_operations< Backend, Data_extension >::get_iterator_metadata ( std::unique_ptr< iterator::Iterator< Data_extension > > &  it,
meta::Metadata metadata,
Data_extension &  data 
)
inline

Get metadata from iterator.

Parameters
[in]itForward iterator to metadata
[out]metadataMetadata for given key
[out]dataExtension for given key
Returns
Status
Return values
falseSuccess
trueFailure

◆ init_forward_iterator()

template<typename Backend , typename Data_extension = data::Data>
bool keyring_common::operations::Keyring_operations< Backend, Data_extension >::init_forward_iterator ( std::unique_ptr< iterator::Iterator< Data_extension > > &  it,
bool  cached 
)
inline

Iterator creation.

Parameters
[out]itForward iterator to metadata
[in]cachedIterator type
Returns
Status
Return values
falseSuccess
trueFailure

◆ init_read_iterator()

template<typename Backend , typename Data_extension = data::Data>
bool keyring_common::operations::Keyring_operations< Backend, Data_extension >::init_read_iterator ( std::unique_ptr< iterator::Iterator< Data_extension > > &  it,
const meta::Metadata metadata 
)
inline

Iterator creation for read.

If data is cached, iterator on cached data is returned. Otherwise iterator created by backend is returned.

Parameters
[out]itForward iterator to metadata
[in]metadataMetadata for the record to be searched
Returns
Status
Return values
falseSuccess
trueFailure

◆ insert()

template<typename Backend , typename Data_extension = data::Data>
bool keyring_common::operations::Keyring_operations< Backend, Data_extension >::insert ( const meta::Metadata metadata,
Data_extension  secret_data 
)
inline

Insert API to populate cache.

Parameters
[in]metadataKey to the data
[in]secret_dataActual data
Returns
status of insertion
Return values
falseSuccess
trueFailure

◆ is_valid()

template<typename Backend , typename Data_extension = data::Data>
bool keyring_common::operations::Keyring_operations< Backend, Data_extension >::is_valid ( std::unique_ptr< iterator::Iterator< Data_extension > > &  it)
inline

Check iterator validity.

Parameters
[in]itForward iterator to metadata
Returns
Status
Return values
trueValid
falseInvalid

◆ keyring_size()

template<typename Backend , typename Data_extension = data::Data>
size_t keyring_common::operations::Keyring_operations< Backend, Data_extension >::keyring_size ( )
inline

Keyring size.

◆ load_cache()

template<typename Backend , typename Data_extension = data::Data>
void keyring_common::operations::Keyring_operations< Backend, Data_extension >::load_cache ( )
inlineprivate

◆ maximum_data_length()

template<typename Backend , typename Data_extension = data::Data>
size_t keyring_common::operations::Keyring_operations< Backend, Data_extension >::maximum_data_length ( ) const
inline

Maximum data length supported.

Returns
Maximum length supported

◆ next()

template<typename Backend , typename Data_extension = data::Data>
bool keyring_common::operations::Keyring_operations< Backend, Data_extension >::next ( std::unique_ptr< iterator::Iterator< Data_extension > > &  it)
inline

Move iterator forward.

Parameters
[in]itForward iterator to metadata
Returns
Status
Return values
falseSuccess
trueFailure

◆ store()

template<typename Backend , typename Data_extension = data::Data>
bool keyring_common::operations::Keyring_operations< Backend, Data_extension >::store ( const meta::Metadata metadata,
const data::Data data 
)
inline

Store API.

Parameters
[in]metadataKey to the data
[in]dataData to be stored
Returns
status of store operation
Return values
falseSuccess - data stored
trueFailure

◆ valid()

template<typename Backend , typename Data_extension = data::Data>
bool keyring_common::operations::Keyring_operations< Backend, Data_extension >::valid ( )
inline

Validity.

Member Data Documentation

◆ backend_

template<typename Backend , typename Data_extension = data::Data>
std::unique_ptr<Backend> keyring_common::operations::Keyring_operations< Backend, Data_extension >::backend_
private

Keyring backend.

◆ cache_

template<typename Backend , typename Data_extension = data::Data>
cache::Datacache<Data_extension> keyring_common::operations::Keyring_operations< Backend, Data_extension >::cache_
private

Metadata cache.

◆ cache_data_

template<typename Backend , typename Data_extension = data::Data>
bool keyring_common::operations::Keyring_operations< Backend, Data_extension >::cache_data_
private

Flag to cache data.

◆ valid_

template<typename Backend , typename Data_extension = data::Data>
bool keyring_common::operations::Keyring_operations< Backend, Data_extension >::valid_
private

Validity.


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