Skip to content

Commit

Permalink
moving a bunch of files from common to server sdk
Browse files Browse the repository at this point in the history
  • Loading branch information
cwaldren-ld committed Nov 16, 2023
1 parent 04f615f commit bc636e4
Show file tree
Hide file tree
Showing 49 changed files with 437 additions and 673 deletions.
26 changes: 0 additions & 26 deletions libs/common/include/launchdarkly/config/server_builders.hpp

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -81,38 +81,38 @@ class PollingBuilder {
/**
* \brief Represents a Redis data source capable of pulling data on-demand.
*/
class RedisPullBuilder {
class RedisBuilder {
public:
/**
* \brief Inividual connection options, including host, port, password, and
* db.
*/
using ConnOpts = built::RedisPullConfig::ConnectionOpts;
using ConnOpts = built::RedisConfig::Standard;
/**
* \brief Connection string.
*/
using ConnURI = built::RedisPullConfig::URI;
using ConnURI = built::RedisConfig::URI;

RedisPullBuilder();
RedisBuilder();

/**
* \brief Connect to Redis using explicit connection options.
* \param opts The options.
* \return Reference to this.
*/
RedisPullBuilder& Connection(ConnOpts opts);
RedisBuilder& Connection(ConnOpts opts);

/**
* \brief Connect to Redis using a URI.
* \param uri The URI.
* \return Reference to this.
*/
RedisPullBuilder& Connection(ConnURI uri);
RedisBuilder& Connection(ConnURI uri);

[[nodiscard]] tl::expected<built::RedisPullConfig, Error> Build() const;
[[nodiscard]] tl::expected<built::RedisConfig, Error> Build() const;

private:
built::RedisPullConfig config_;
built::RedisConfig config_;
};

template <>
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -81,79 +81,4 @@ class PersistenceBuilder<ClientSDK> {
std::size_t max_contexts_;
};

template <>
class PersistenceBuilder<ServerSDK> {
public:
PersistenceBuilder()
: persistence_(Defaults<ServerSDK>::PersistenceConfig()) {}

// /**
// * Set the core persistence implementation.
// *
// * @param core The core persistence implementation.
// * @return A reference to this builder.
// */
// PersistenceBuilder& Core(
// std::shared_ptr<persistence::IPersistentStoreCore> core);
//
// /**
// * How long something in the cache is considered fresh.
// *
// * Each item that is cached will have its age tracked. If the age of
// * the item exceeds the cache refresh time, then an attempt will be
// made
// * to refresh the item next time it is requested.
// *
// * When ActiveEviction is set to false then the item will remain
// cached
// * and that cached value will be used if attempts to refresh the value
// fail.
// *
// * If ActiveEviction is set to true, then expired items will be
// periodically
// * removed from the cache.
// *
// * @param cache_refresh_time The time, in seconds, cached data remains
// * fresh.
// * @return A reference to this builder.
// */
// PersistenceBuilder& CacheRefreshTime(
// std::chrono::seconds cache_refresh_time) {
// persistence_.cache_refresh_time = cache_refresh_time;
// return *this;
// }
//
// /**
// * Enable/disable active eviction.
// *
// * Defaults to disabled.
// * @param active_eviction True to enable.
// * @return A reference to this builder.
// */
// PersistenceBuilder& ActiveEviction(bool active_eviction) {
// persistence_.active_eviction = active_eviction;
// return *this;
// }
//
// /**
// * If active eviction is enabled, then this specifies the time between
// * active evictions.
// * @param eviction_interval The interval, in seconds, between cache
// flushes.
// * @return A reference to this builder.
// */
// PersistenceBuilder& EvictionInterval(
// std::chrono::seconds eviction_interval) {
// persistence_.eviction_interval = eviction_interval;
// return *this;
// }

[[nodiscard]] built::Persistence<ServerSDK> Build() const {
return persistence_;
}

private:
built::Persistence<ServerSDK> persistence_;
};

} // namespace launchdarkly::config::shared::builders
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@ struct PollingConfig<ServerSDK> {
std::chrono::seconds min_polling_interval;
};

struct RedisPullConfig {
struct RedisConfig {
using URI = std::string;

struct ConnectionOpts {
struct Standard {
/**
* \brief Redis host. Required; cannot be empty string.
*/
Expand All @@ -70,7 +70,7 @@ struct RedisPullConfig {
std::optional<std::uint64_t> db;
};

std::variant<URI, ConnectionOpts> connection_;
std::variant<URI, Standard> connection_;
};

template <typename SDK>
Expand All @@ -88,7 +88,7 @@ template <>
struct DataSourceConfig<ServerSDK> {
std::variant<StreamingConfig<ServerSDK>,
PollingConfig<ServerSDK>,
RedisPullConfig>
RedisConfig>
method;
};

Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit bc636e4

Please sign in to comment.