ORE Studio 0.0.4
Loading...
Searching...
No Matches
Public Member Functions | List of all members
HostDisplayNameCache Class Reference

Shared cache mapping host UUID strings to whimsical display names. More...

#include <HostDisplayNameCache.hpp>

Inherits QObject.

Collaboration diagram for HostDisplayNameCache:
Collaboration graph

Public Member Functions

 HostDisplayNameCache (QObject *parent=nullptr)
 
QString display_name_for (const QString &uuid) const
 Returns the display name for the given UUID string.
 
void populate_from (const std::vector< compute::domain::host > &hosts)
 Populates (or updates) the cache from a list of hosts.
 
void clear ()
 Removes all entries from the cache.
 

Detailed Description

Shared cache mapping host UUID strings to whimsical display names.

Avoids repeated list-hosts requests by centralising the UUID → name mapping. All client models that need to render host names hold a pointer to the single instance owned by the controller.

If a UUID is not present in the cache, display_name_for() returns the first 8 characters of the UUID as a short-ID fallback.

Member Function Documentation

◆ display_name_for()

QString display_name_for ( const QString &  uuid) const

Returns the display name for the given UUID string.

Falls back to the first 8 characters of the UUID when the cache has no entry (e.g., the host was registered after the last refresh).

◆ populate_from()

void populate_from ( const std::vector< compute::domain::host > &  hosts)

Populates (or updates) the cache from a list of hosts.

Existing entries are overwritten if the host appears in hosts. Entries for hosts not present in hosts are kept (no eviction).