ConfigStore

Classin config_storecompute-sdk-cpp 0.7.0View source

Include fastly/config_store.h to use this class.

A Compute Config Store.

Methods

contains

View source
fastly::expected<bool> fastly::config_store::ConfigStore::contains(std::string_view key)

Return true if the config_store contains an entry with the given key.

Examples

Parameters

key: std::string_view

Returns

fastly::expected<bool>
_run
auto store{fastly::ConfigStore::open("test config store")};
assert(store.contains("key").value());
fastly::expected<std::optional<std::string>> fastly::config_store::ConfigStore::get(std::string_view key)

Lookup a value in this config store.

If successful, this function returns std::optional<std::string>> if an entry was found, or std::nullopt if no entry with the given key was found.

Examples

Parameters

key: std::string_view

Returns

fastly::expected<std::optional<std::string>>
1
2
3
4
5
6
7
8
9
10
11
12
_run
auto store{fastly::ConfigStore::open("test config store")};
assert(store.get("bread").value() ==
"a usually baked and leavened food");
assert(
store.get("freedom").value() ==
"the absence of necessity, coercion, or constraint",
);
// Otherwise, `get` will return nullopt.
assert(store.get("zzzzz") == std::nullopt);

open

staticView source
static fastly::expected<ConfigStore> fastly::config_store::ConfigStore::open(std::string_view name)

Open a config store, given its name.

Examples

Parameters

name: std::string_view

Returns

fastly::expected<ConfigStore>
_run
auto merriam{fastly::ConfigStore::open("merriam webster")};
auto oed{fastly::ConfigStore::open("oxford english config store")};