settings.rs 745 B

12345678910111213141516171819202122232425262728293031
  1. use std::path::PathBuf;
  2. #[derive(Clone, Debug)]
  3. pub struct RaftSettings {
  4. // the leader duration for sending heartbeat; in milliseconds
  5. pub heartbeat_timeout: u64,
  6. // the duration for electing new leader; in seconds
  7. pub timeout: u64,
  8. // the duration for sending id to other nodes; in seconds
  9. pub id_timeout: u64,
  10. // this duration used to clean up hashmaps; in seconds
  11. pub prun_duration: i64,
  12. // Datastore path
  13. pub datastore_path: PathBuf,
  14. }
  15. impl Default for RaftSettings {
  16. fn default() -> Self {
  17. Self {
  18. heartbeat_timeout: 500,
  19. timeout: 6,
  20. id_timeout: 12,
  21. prun_duration: 30,
  22. datastore_path: PathBuf::from(""),
  23. }
  24. }
  25. }