Class facade

#include <keychain/cache/facade.hpp>

Namespace: keychain

Inheritance: facade

Description

facade encapsulates the methods in common between persona and Contacts for use in methods that can take either object. This class provides basic information about the related keychains such as the maturity (blockchain confirmation) level of the two keychains and the base URI.

The distinction between a persona and a contact is that a gateway creates a persona locally whereas a contact is created by another device.

Due to the significant overlap in public API, persona and contact do not add any extra public methods for the user. However, under the hood they are different, and any attempt to use one object type where another is explicitly requested (e.g. set_active_persona with a contact) will result in undefined behavior.

facade objects are not constructed by the user directly. They are created through the gateway by adding, creating or retrieving persona or contact objects (which are subtypes of facade).

In fact, facade is a snapshot view of the underlying object at the time it is created or requested, because facade has no reference to the gateway or blockchain at all. This means developers should always refresh their view of the object using the appropriate method to obtain a new object before acting on it.

Since: v2.0

Public Member Functions

Return type Method and Description

int

get_id()

Gets the facade ID

std::string

get_name()

Get the facade name

std::string

get_sub_name()

Get the facade subname

uri

get_uri()()

Gets the blockchain URI.

persona_status

get_status()

Get the facade blockchain confirmation status.

bool

is_null()

Whether the facade is NULL (NULL pattern).

Public Member Functions Detail

get_id

int get_id()

Returns the Facade internal ID. IDs are unique within each gateway instance.

Returns:

The facade internal ID

get_name

std::string get_name()

Get the facade name, which is a local attribute initially associated with the facade at its creation time

Returns:

The facade name

get_sub_name

std::string get_sub_name()

Get the facade subname, which is a local attribute initially associated with the facade at its creation time

Returns:

The facade sub-name

get_uri()

uri get_uri()

Returns the facade uri, used to locate the facade keychains on the blockchain

Returns:

The facade uri

get_status

persona_status get_status()

Returns the facade status on the blockchain

Returns:

The facade status on the blockchain

is_null

bool is_null()

Returns true if the facade is a NULL sentinel object. This pattern allows the facade to always be non-null but still indicate that it shouldn’t be used

Returns:

true if the facade is a NULL sentinel