MySQL 8.0.40
Source Code Documentation
Gcs_view Class Reference

This represents the membership view that a member has from a group. More...

#include <gcs_view.h>

Public Types

enum  Gcs_view_error_code { OK = 1 , MEMBER_EXPELLED }
 Define error codes associated to the view. More...
 

Public Member Functions

 Gcs_view (const std::vector< Gcs_member_identifier > &members, const Gcs_view_identifier &view_id, const std::vector< Gcs_member_identifier > &leaving, const std::vector< Gcs_member_identifier > &joined, const Gcs_group_identifier &group_id)
 Gcs_view constructor. More...
 
 Gcs_view (const std::vector< Gcs_member_identifier > &members, const Gcs_view_identifier &view_id, const std::vector< Gcs_member_identifier > &leaving, const std::vector< Gcs_member_identifier > &joined, const Gcs_group_identifier &group_id, Gcs_view::Gcs_view_error_code error_code)
 
 Gcs_view (Gcs_view const &view)
 Gcs_view constructor which does a deep copy of the object passed as parameter. More...
 
virtual ~Gcs_view ()
 
const Gcs_view_identifierget_view_id () const
 
const Gcs_group_identifierget_group_id () const
 
const std::vector< Gcs_member_identifier > & get_members () const
 
const std::vector< Gcs_member_identifier > & get_leaving_members () const
 
const std::vector< Gcs_member_identifier > & get_joined_members () const
 
Gcs_view::Gcs_view_error_code get_error_code () const
 
const Gcs_member_identifierget_member (const std::string &member_id) const
 
bool has_member (const std::string &member_id) const
 

Private Member Functions

void clone (const std::vector< Gcs_member_identifier > &members, const Gcs_view_identifier &view_id, const std::vector< Gcs_member_identifier > &leaving, const std::vector< Gcs_member_identifier > &joined, const Gcs_group_identifier &group_id, Gcs_view::Gcs_view_error_code error_code)
 
Gcs_viewoperator= (Gcs_view const &)
 

Private Attributes

std::vector< Gcs_member_identifier > * m_members
 
Gcs_view_identifierm_view_id
 
std::vector< Gcs_member_identifier > * m_leaving
 
std::vector< Gcs_member_identifier > * m_joined
 
Gcs_group_identifierm_group_id
 
Gcs_view::Gcs_view_error_code m_error_code
 

Detailed Description

This represents the membership view that a member has from a group.

This objects contains:

  • A list of members that belong to this view.
  • A Gcs_view_identifier identifier object, that uniquely identifies this view in time.
  • The members that were in the last view and that left. This shall include the local member when it leaves the group.
  • The members that joined, meaning that they were not present in the previous view. This includes the local member when it joins a group, meaning that a member can be in the list of members and joined.
  • A Gcs_group_identifier to which this view pertains.

There are two ways to obtain this:

  • In the Gcs_control_interface, one should call, at any moment, the method Gcs_control_interface::get_current_view.
  • Cache the value received via Gcs_control_event_listener::on_view_changed.

Member Enumeration Documentation

◆ Gcs_view_error_code

Define error codes associated to the view.

Enumerator
OK 
MEMBER_EXPELLED 

Constructor & Destructor Documentation

◆ Gcs_view() [1/3]

Gcs_view::Gcs_view ( const std::vector< Gcs_member_identifier > &  members,
const Gcs_view_identifier view_id,
const std::vector< Gcs_member_identifier > &  leaving,
const std::vector< Gcs_member_identifier > &  joined,
const Gcs_group_identifier group_id 
)
explicit

Gcs_view constructor.

Parameters
[in]membersgroup members
[in]view_idthe view identifier
[in]leavingthe members that left from the previous view
[in]joinedthe new members
[in]group_idthe group identifier

◆ Gcs_view() [2/3]

Gcs_view::Gcs_view ( const std::vector< Gcs_member_identifier > &  members,
const Gcs_view_identifier view_id,
const std::vector< Gcs_member_identifier > &  leaving,
const std::vector< Gcs_member_identifier > &  joined,
const Gcs_group_identifier group_id,
Gcs_view::Gcs_view_error_code  error_code 
)
explicit
Parameters
[in]membersgroup members
[in]view_idthe view identifier
[in]leavingthe members that left from the previous view
[in]joinedthe new members
[in]group_idthe group identifier
[in]error_codeerror code associated to the view.

◆ Gcs_view() [3/3]

Gcs_view::Gcs_view ( Gcs_view const &  view)
explicit

Gcs_view constructor which does a deep copy of the object passed as parameter.

Parameters
[in]viewreference to a Gcs_view object

◆ ~Gcs_view()

Gcs_view::~Gcs_view ( )
virtual

Member Function Documentation

◆ clone()

void Gcs_view::clone ( const std::vector< Gcs_member_identifier > &  members,
const Gcs_view_identifier view_id,
const std::vector< Gcs_member_identifier > &  leaving,
const std::vector< Gcs_member_identifier > &  joined,
const Gcs_group_identifier group_id,
Gcs_view::Gcs_view_error_code  error_code 
)
private

◆ get_error_code()

Gcs_view::Gcs_view_error_code Gcs_view::get_error_code ( ) const
Returns
error code associated to the current view.

◆ get_group_id()

const Gcs_group_identifier & Gcs_view::get_group_id ( ) const
Returns
the group where this view pertains

◆ get_joined_members()

const std::vector< Gcs_member_identifier > & Gcs_view::get_joined_members ( ) const
Returns
the new members in view from view n-1 to the current view n

◆ get_leaving_members()

const std::vector< Gcs_member_identifier > & Gcs_view::get_leaving_members ( ) const
Returns
the members that left from the view n-1 to the current view n

◆ get_member()

const Gcs_member_identifier * Gcs_view::get_member ( const std::string &  member_id) const

◆ get_members()

const std::vector< Gcs_member_identifier > & Gcs_view::get_members ( ) const
Returns
the totality of members that currently belong to this group in a certain moment in time, denoted by view_id

◆ get_view_id()

const Gcs_view_identifier & Gcs_view::get_view_id ( ) const
Returns
the current view identifier. This identifier marks a snapshot in time and should increase monotonically

◆ has_member()

bool Gcs_view::has_member ( const std::string &  member_id) const

◆ operator=()

Gcs_view & Gcs_view::operator= ( Gcs_view const &  )
private

Member Data Documentation

◆ m_error_code

Gcs_view::Gcs_view_error_code Gcs_view::m_error_code
private

◆ m_group_id

Gcs_group_identifier* Gcs_view::m_group_id
private

◆ m_joined

std::vector<Gcs_member_identifier>* Gcs_view::m_joined
private

◆ m_leaving

std::vector<Gcs_member_identifier>* Gcs_view::m_leaving
private

◆ m_members

std::vector<Gcs_member_identifier>* Gcs_view::m_members
private

◆ m_view_id

Gcs_view_identifier* Gcs_view::m_view_id
private

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