ark::local_storage

Classes

  • ark::local_storage::LocalStorageIoStage
    This stage allows you to send messages to retrieve local storage keys in a particular name, or to write keys in that same namespace. This is primarily intended for use on a robot, where you need to write to persistent partitions in a safe manner.

  • ark::local_storage::LocalStorageSubscriber
    Subscribers to the local storage stage running at the given namespace, and will allow you to receive updates when particular keys are updated. This is useful for dynamically updating configuration that is aimed to be written to disk.

    Also handles doing an initial read of said configuration value if desired, to initialize on startup.

  • ark::local_storage::LocalStorageConfig
    Configuration related to local storage. Local storage is a place for you to store key/value pairs on the robot in a sanitized fashion.

  • ark::local_storage::LocalStorageError
    An error message that can occur when reading from local storage.

  • ark::local_storage::LocalStorageSubscriberUpdate
    A callback that is invoked when local storage is updated.

Functions

Declared in “ark/local_storage/local_config_package.hh”:

  • void register_config_from_local_storage(const LocalStorageConfig & storage_config, config::ConfigPackage & package, const std::string & key_name, const Type & default_value)
    Reads the given key from local storage (based on the configuration provided). If successful, merges it into the config package. Otherwise, merges the default value into the config package.

Declared in “ark/local_storage/local_storage.hh”:

  • void write_local_storage(const LocalStorageConfig & config, const std::chrono::system_clock::time_point & modification_time, const std::string & key, const std::string & value, const std::optional< std::string > & rsa_signature)
    Writes the given key/value pair out to local storage. Any existing key with this name will be overwritten.

  • tl::expected< std::string, LocalStorageError > read_local_storage(const LocalStorageConfig & config, const std::string & key)
    Reads the given key from local storage (if it exists). Returns an expected value that either has the contents of the key, or an error message indicating what went wrong.

  • std::vector< LocalStorageFileMetadata > enumerate_local_storage_keys(const LocalStorageConfig & config)
    Enumerates all existing keys using the given storage configuration. Does not throw if there is an error reading a particular key, but this will throw if there is some general I/O error while accessing config.