Struct race_client::Client
source · pub struct Client {
pub encryptor: Arc<dyn EncryptorT>,
pub transport: Arc<dyn TransportT>,
pub connection: Arc<dyn ConnectionT>,
pub game_addr: String,
pub addr: String,
pub mode: ClientMode,
pub op_hist: BTreeSet<OpIdent>,
pub secret_state: SecretState,
}
Expand description
The client core for player, transactor and validator nodes.
It reads the updated context, generates events and sends them via connection.
Client Mode
Three modes are supported:
Mode | Randomize | Decisions | Decryption |
---|---|---|---|
Client | x | o | o |
Server | o | x | o |
Validator | o | x | o |
Fields§
§encryptor: Arc<dyn EncryptorT>
§transport: Arc<dyn TransportT>
§connection: Arc<dyn ConnectionT>
§game_addr: String
§addr: String
§mode: ClientMode
§op_hist: BTreeSet<OpIdent>
§secret_state: SecretState
Implementations§
source§impl Client
impl Client
pub fn new( addr: String, game_addr: String, mode: ClientMode, transport: Arc<dyn TransportT>, encryptor: Arc<dyn EncryptorT>, connection: Arc<dyn ConnectionT> ) -> Self
pub async fn attach_game(&self) -> Result<()>
pub async fn submit_event(&self, event: Event) -> Result<()>
pub async fn submit_custom_event<S: CustomEvent>( &self, custom_event: S ) -> Result<()>
pub fn load_random_states(&mut self, game_context: &GameContext) -> Result<()>
pub fn answer_event( &mut self, decision_id: DecisionId, value: String ) -> Result<Event>
pub async fn answer( &mut self, decision_id: DecisionId, value: String ) -> Result<()>
pub fn handle_decision( &mut self, game_context: &GameContext ) -> Result<Vec<Event>>
pub fn handle_random_waiting( &mut self, random_state: &RandomState ) -> Result<Option<Event>>
pub fn handle_random_masking( &mut self, random_state: &RandomState ) -> Result<Option<Event>>
pub fn handle_random_locking( &mut self, random_state: &RandomState ) -> Result<Option<Event>>
pub fn handle_randomization( &mut self, game_context: &GameContext ) -> Result<Vec<Event>>
pub fn handle_updated_context( &mut self, ctx: &GameContext ) -> Result<Vec<Event>>
pub fn flush_secret_states(&mut self)
Auto Trait Implementations§
impl !RefUnwindSafe for Client
impl Send for Client
impl Sync for Client
impl Unpin for Client
impl !UnwindSafe for Client
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more