C++ Server-Side SDK
LaunchDarkly SDK
istore.hpp
1 #pragma once
2 
3 #include <launchdarkly/data_model/descriptors.hpp>
4 
5 #include <memory>
6 #include <string>
7 #include <unordered_map>
8 
9 namespace launchdarkly::server_side::data_interfaces {
10 
15 class IStore {
16  public:
22  [[nodiscard]] virtual std::shared_ptr<data_model::FlagDescriptor> GetFlag(
23  std::string const& key) const = 0;
24 
30  [[nodiscard]] virtual std::shared_ptr<data_model::SegmentDescriptor>
31  GetSegment(std::string const& key) const = 0;
32 
37  [[nodiscard]] virtual std::
38  unordered_map<std::string, std::shared_ptr<data_model::FlagDescriptor>>
39  AllFlags() const = 0;
40 
45  [[nodiscard]] virtual std::unordered_map<
46  std::string,
47  std::shared_ptr<data_model::SegmentDescriptor>>
48  AllSegments() const = 0;
49 
53  [[nodiscard]] virtual bool Initialized() const = 0;
54 
55  virtual ~IStore() = default;
56  IStore(IStore const& item) = delete;
57  IStore(IStore&& item) = delete;
58  IStore& operator=(IStore const&) = delete;
59  IStore& operator=(IStore&&) = delete;
60 
61  protected:
62  IStore() = default;
63 };
64 } // namespace launchdarkly::server_side::data_interfaces
IStore provides shared ownership of flag and segment domain objects.
Definition: istore.hpp:15
virtual std::shared_ptr< data_model::SegmentDescriptor > GetSegment(std::string const &key) const =0
Get the segment named by key. Returns nullptr if no such flag exists.
virtual std::shared_ptr< data_model::FlagDescriptor > GetFlag(std::string const &key) const =0
Get the flag named by key. Returns nullptr if no such flag exists.
virtual std::unordered_map< std::string, std::shared_ptr< data_model::FlagDescriptor > > AllFlags() const =0
Get a map of all flags.
virtual std::unordered_map< std::string, std::shared_ptr< data_model::SegmentDescriptor > > AllSegments() const =0
Get a map of all segments.