replicable_command.rs 632 B

1234567891011121314151617
  1. /// A command must satisfy the requirement of this trait, so that it could be
  2. /// replicated in Raft.
  3. // Commands must be
  4. // 0. 'static: they have to live long enough for thread pools.
  5. // 1. clone: they are put in vectors and request messages.
  6. // 2. serializable: they are sent over RPCs and persisted.
  7. // 3. deserializable: they are restored from storage.
  8. // 4. send: they are referenced in futures.
  9. pub trait ReplicableCommand:
  10. 'static + Clone + serde::Serialize + serde::de::DeserializeOwned + Send
  11. {
  12. }
  13. impl<C> ReplicableCommand for C where
  14. C: 'static + Clone + serde::Serialize + serde::de::DeserializeOwned + Send
  15. {
  16. }