duke8253 commented on code in PR #9323:
URL: https://github.com/apache/trafficserver/pull/9323#discussion_r1124676574
##########
plugins/experimental/stek_share/stek_share.h:
##########
@@ -21,103 +21,139 @@ limitations under the License.
#include <deque>
#include <mutex>
+#include <shared_mutex>
#include <time.h>
#include <libnuraft/nuraft.hxx>
#include "stek_utils.h"
-class STEKShareServer
+class PluginConfig
{
public:
- STEKShareServer() : server_id_(1), addr_("localhost"), port_(25000),
sm_(nullptr), smgr_(nullptr), raft_instance_(nullptr)
+ PluginConfig()
{
- last_updated_ = 0;
- current_log_idx_ = 0;
-
// Default ASIO thread pool size: 4.
- asio_thread_pool_size_ = 4;
+ asio_thread_pool_size = 4;
// Default heart beat interval: 100 ms.
- heart_beat_interval_ = 100;
+ heart_beat_interval = 100;
// Default election timeout: 200~400 ms.
- election_timeout_lower_bound_ = 200;
- election_timeout_upper_bound_ = 400;
+ election_timeout_lower_bound = 200;
+ election_timeout_upper_bound = 400;
// Up to 5 logs will be preserved ahead the last snapshot.
- reserved_log_items_ = 5;
+ reserved_log_items = 5;
// Snapshot will be created for every 5 log appends.
- snapshot_distance_ = 5;
+ snapshot_distance = 5;
// Client timeout: 3000 ms.
- client_req_timeout_ = 3000;
-
- std::memset(ticket_keys_, 0, SSL_TICKET_KEY_SIZE * 2);
- }
-
- void
- reset()
- {
- sm_.reset();
- smgr_.reset();
- raft_instance_.reset();
+ client_req_timeout = 3000;
}
// Server ID.
- int server_id_;
+ int server_id;
// Server address.
- std::string addr_;
+ std::string address;
// Server port.
- int port_;
+ int port;
- // Endpoint: "<addr>:<port>".
- std::string endpoint_;
+ // Endpoint: "<address>:<port>".
+ std::string endpoint;
- // State machine.
- nuraft::ptr<nuraft::state_machine> sm_;
+ size_t asio_thread_pool_size;
- // State manager.
- nuraft::ptr<nuraft::state_mgr> smgr_;
+ int heart_beat_interval;
- // Raft launcher.
- nuraft::raft_launcher launcher_;
+ int election_timeout_lower_bound;
+ int election_timeout_upper_bound;
- // Raft server instance.
- nuraft::ptr<nuraft::raft_server> raft_instance_;
+ int reserved_log_items;
- // List of servers to auto add.
- std::map<int, std::string> server_list_;
+ int snapshot_distance;
+
+ int client_req_timeout;
// STEK update interval.
- int key_update_interval_;
+ int key_update_interval;
- // When was STEK last updated.
- time_t last_updated_;
+ // List of servers to auto add.
+ std::map<int, std::string> server_list;
- uint64_t current_log_idx_;
+ // TLS related stuff.
+ std::string root_cert_file;
+ std::string server_cert_file;
+ std::string server_key_file;
+ std::string cert_verify_str;
+};
- size_t asio_thread_pool_size_;
+class STEKShareServer
+{
+public:
+ STEKShareServer() : sm_instance(nullptr), smgr_instance(nullptr),
raft_instance(nullptr)
+ {
+ last_updated = 0;
+ current_log_idx = 0;
+ config_reloading = false;
- int heart_beat_interval_;
+ std::memset(ticket_keys, 0, SSL_TICKET_KEY_SIZE * 2);
+ }
- int election_timeout_lower_bound_;
- int election_timeout_upper_bound_;
+ void
+ reset()
+ {
+ {
+ std::unique_lock lock(sm_mutex);
+ sm_instance.reset();
Review Comment:
Forgot to remove after testing, was trying to make sure things behave.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]