CDC Badge OS
Firmware for the CDC Badge v1.0 hardware security key
Loading...
Searching...
No Matches
cdc::plugin_manager::PluginStorage Class Reference

#include <PluginStorage.h>

Static Public Member Functions

static bool mount ()
 Mount the plugins partition. Auto-formats if empty.
static void unmount ()
 Unmount the plugins partition (rarely used; mostly tests).
static const char * basePath ()
 Returns the VFS path prefix, e.g. "/plugins".
static std::vector< std::string > listPluginIds ()
 Discover all installed plugin ids. A plugin is recognised by the presence of both <id>.wasm and <id>.meta files.
static std::string binaryPath (const std::string &id)
 Returns the path that should be loaded for <id>: <id>.aot if it exists on disk, otherwise <id>.wasm.
static std::string wasmPath (const std::string &id)
 Returns the full VFS path of <id>.wasm.
static std::string aotPath (const std::string &id)
 Returns the full VFS path of <id>.aot.
static std::string metaPath (const std::string &id)
 Returns the full VFS path of <id>.meta.
static std::string langPath (const std::string &id)
 Returns the full VFS path of <id>.lang (translation overlay).
static std::string disabledPath (const std::string &id)
 Returns the full VFS path of <id>.disabled.
static bool isDisabled (const std::string &id)
 True when the plugin has a persistent disabled marker.
static bool setDisabled (const std::string &id, bool disabled)
 Create or remove the persistent disabled marker for a plugin.
static bool stats (uint64_t &free_bytes, uint64_t &total_bytes)
 Returns the free and total bytes on the plugins partition.

Detailed Description

Definition at line 19 of file PluginStorage.h.

Member Function Documentation

◆ aotPath()

std::string cdc::plugin_manager::PluginStorage::aotPath ( const std::string & id)
static

Returns the full VFS path of <id>.aot.

Definition at line 120 of file PluginStorage.cpp.

References cdc::plugin_manager::MOUNT_POINT.

Referenced by binaryPath().

◆ basePath()

const char * cdc::plugin_manager::PluginStorage::basePath ( )
static

Returns the VFS path prefix, e.g. "/plugins".

Definition at line 58 of file PluginStorage.cpp.

References cdc::plugin_manager::MOUNT_POINT.

◆ binaryPath()

std::string cdc::plugin_manager::PluginStorage::binaryPath ( const std::string & id)
static

Returns the path that should be loaded for <id>: <id>.aot if it exists on disk, otherwise <id>.wasm.

Definition at line 103 of file PluginStorage.cpp.

References aotPath(), and wasmPath().

Referenced by cdc::plugin_manager::Plugin::load().

◆ disabledPath()

std::string cdc::plugin_manager::PluginStorage::disabledPath ( const std::string & id)
static

Returns the full VFS path of <id>.disabled.

Definition at line 135 of file PluginStorage.cpp.

References cdc::plugin_manager::MOUNT_POINT.

Referenced by isDisabled(), and setDisabled().

◆ isDisabled()

bool cdc::plugin_manager::PluginStorage::isDisabled ( const std::string & id)
static

True when the plugin has a persistent disabled marker.

Definition at line 140 of file PluginStorage.cpp.

References disabledPath().

Referenced by cdc::plugin_manager::PluginManager::isPluginDisabled().

◆ langPath()

std::string cdc::plugin_manager::PluginStorage::langPath ( const std::string & id)
static

Returns the full VFS path of <id>.lang (translation overlay).

Definition at line 130 of file PluginStorage.cpp.

References cdc::plugin_manager::MOUNT_POINT.

Referenced by cdc::plugin_manager::Plugin::loadLangOverlay().

◆ listPluginIds()

std::vector< std::string > cdc::plugin_manager::PluginStorage::listPluginIds ( )
static

Discover all installed plugin ids. A plugin is recognised by the presence of both <id>.wasm and <id>.meta files.

Definition at line 68 of file PluginStorage.cpp.

References cdc::plugin_manager::ends_with(), LOG_W, metaPath(), cdc::plugin_manager::MOUNT_POINT, name, cdc::plugin_manager::s_mounted, and cdc::plugin_manager::TAG.

Referenced by cdc::plugin_manager::PluginManager::init(), and cdc::plugin_manager::PluginManager::listInstalledIds().

◆ metaPath()

std::string cdc::plugin_manager::PluginStorage::metaPath ( const std::string & id)
static

Returns the full VFS path of <id>.meta.

Definition at line 125 of file PluginStorage.cpp.

References cdc::plugin_manager::MOUNT_POINT.

Referenced by cdc::plugin_manager::PluginManager::getManifest(), and listPluginIds().

◆ mount()

bool cdc::plugin_manager::PluginStorage::mount ( )
static

Mount the plugins partition. Auto-formats if empty.

Returns
true on success.

Definition at line 26 of file PluginStorage.cpp.

References LOG_E, LOG_I, cdc::plugin_manager::MOUNT_POINT, cdc::plugin_manager::PARTITION_LABEL, cdc::plugin_manager::s_mounted, cdc::plugin_manager::s_wl_handle, and cdc::plugin_manager::TAG.

Referenced by cdc::plugin_manager::PluginManager::init().

◆ setDisabled()

bool cdc::plugin_manager::PluginStorage::setDisabled ( const std::string & id,
bool disabled )
static

Create or remove the persistent disabled marker for a plugin.

Definition at line 147 of file PluginStorage.cpp.

References disabledPath(), and cdc::core::openFile().

Referenced by cdc::plugin_manager::PluginManager::setPluginDisabled().

◆ stats()

bool cdc::plugin_manager::PluginStorage::stats ( uint64_t & free_bytes,
uint64_t & total_bytes )
static

Returns the free and total bytes on the plugins partition.

Definition at line 161 of file PluginStorage.cpp.

References cdc::plugin_manager::MOUNT_POINT, and cdc::plugin_manager::s_mounted.

◆ unmount()

void cdc::plugin_manager::PluginStorage::unmount ( )
static

Unmount the plugins partition (rarely used; mostly tests).

Definition at line 50 of file PluginStorage.cpp.

References cdc::plugin_manager::MOUNT_POINT, cdc::plugin_manager::s_mounted, and cdc::plugin_manager::s_wl_handle.

Referenced by cdc::plugin_manager::PluginManager::deinit().

◆ wasmPath()

std::string cdc::plugin_manager::PluginStorage::wasmPath ( const std::string & id)
static

Returns the full VFS path of <id>.wasm.

Definition at line 115 of file PluginStorage.cpp.

References cdc::plugin_manager::MOUNT_POINT.

Referenced by binaryPath(), and cdc::plugin_manager::PluginInfoView::loadForPluginId().


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