61 lines
1.7 KiB
Rust
61 lines
1.7 KiB
Rust
use crate::records::memory::response_channels::Command;
|
|
use crate::sled::Db;
|
|
use crate::Arc;
|
|
use crate::Mutex;
|
|
use crate::TcpStream;
|
|
|
|
// parameters used while searching backward for a shared
|
|
// ancestor and deciding whether to replace the local tip
|
|
pub struct OrphanCheckup {
|
|
pub start_check: u32,
|
|
pub stop_check: u32,
|
|
pub original_start_check: u32,
|
|
pub local_height: u32,
|
|
pub remote_height: u32,
|
|
pub recheck_from_height: Option<u32>,
|
|
pub stream: Arc<Mutex<TcpStream>>,
|
|
pub db: Db,
|
|
pub map: Arc<Mutex<Command>>,
|
|
pub node_syncing: bool,
|
|
pub connections_key: String,
|
|
}
|
|
|
|
// top-level orphan check context used by sync and broadcast
|
|
// flows before the deeper rollback logic is chosen
|
|
pub struct OrphanCheckup2 {
|
|
pub stream: Arc<Mutex<TcpStream>>,
|
|
pub db: Db,
|
|
pub local_height: u32,
|
|
pub remote_height: u32,
|
|
pub recheck_from_height: Option<u32>,
|
|
pub map: Arc<Mutex<Command>>,
|
|
pub node_syncing: bool,
|
|
pub connections_key: String,
|
|
}
|
|
|
|
// shared rollback context used by undo/save paths once a
|
|
// reorganization decision has already been made
|
|
pub struct UndoTransactions {
|
|
pub start_height: u32,
|
|
pub replay_to_height: u32,
|
|
pub db: Db,
|
|
pub stream: Arc<Mutex<TcpStream>>,
|
|
pub map: Arc<Mutex<Command>>,
|
|
pub node_syncing: bool,
|
|
pub connections_key: String,
|
|
}
|
|
|
|
#[derive(Clone)]
|
|
// lightweight cloneable context passed into the rule checks
|
|
// before it is expanded into rollback-specific parameters
|
|
pub struct CheckUp {
|
|
pub local_height: u32,
|
|
pub remote_height: u32,
|
|
pub recheck_from_height: Option<u32>,
|
|
pub db: Db,
|
|
pub stream: Arc<Mutex<TcpStream>>,
|
|
pub map: Arc<Mutex<Command>>,
|
|
pub node_syncing: bool,
|
|
pub connections_key: String,
|
|
}
|