#[cfg(feature = "proto")]
pub mod common;

use std::{io::Result, time};

use crate::ids::node::Id as NodeId;

/// ref. https://pkg.go.dev/github.com/ava-labs/avalanchego/snow/engine/common#AppHandler
pub trait AppHandler {
    fn app_request(
        node_id: &NodeId,
        request_id: u32,
        deadline: time::Instant,
        request: &[u8],
    ) -> Result<()>;
    fn app_request_failed(node_id: &NodeId, request_id: u32) -> Result<()>;
    fn app_response(node_id: &NodeId, request_id: u32, response: &[u8]) -> Result<()>;
    fn app_gossip(node_id: &NodeId, msg: &[u8]) -> Result<()>;
}
