pub mod client;
pub mod server;

use std::io::Result;

use crate::ids;

/// AppSender sends application (Vm) level messages.
/// ref. https://pkg.go.dev/github.com/ava-labs/avalanchego/snow/engine/common#AppSender
#[tonic::async_trait]
pub trait AppSender {
    async fn send_app_request(
        &self,
        node_ids: ids::node::Set,
        request_id: u32,
        request: Vec<u8>,
    ) -> Result<()>;
    async fn send_app_response(
        &self,
        node_if: ids::node::Id,
        request_id: u32,
        response: Vec<u8>,
    ) -> Result<()>;
    async fn send_app_gossip(&self, msg: Vec<u8>) -> Result<()>;
    async fn send_app_gossip_specific(&self, node_ids: ids::node::Set, msg: Vec<u8>) -> Result<()>;
}
