Skip to content

Commit

Permalink
move new functions back to top
Browse files Browse the repository at this point in the history
  • Loading branch information
apfitzge committed Feb 19, 2025
1 parent 608fbbb commit deb6390
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 27 deletions.
30 changes: 15 additions & 15 deletions core/src/banking_stage/transaction_scheduler/greedy_scheduler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,21 @@ pub struct GreedyScheduler<Tx: TransactionWithMeta> {
config: GreedySchedulerConfig,
}

impl<Tx: TransactionWithMeta> GreedyScheduler<Tx> {
pub(crate) fn new(
consume_work_senders: Vec<Sender<ConsumeWork<Tx>>>,
finished_consume_work_receiver: Receiver<FinishedConsumeWork<Tx>>,
config: GreedySchedulerConfig,
) -> Self {
Self {
common: SchedulingCommon::new(consume_work_senders, finished_consume_work_receiver),
working_account_set: ReadWriteAccountSet::default(),
unschedulables: Vec::with_capacity(config.max_scanned_transactions_per_scheduling_pass),
config,
}
}
}

impl<Tx: TransactionWithMeta> Scheduler<Tx> for GreedyScheduler<Tx> {
fn schedule<S: StateContainer<Tx>>(
&mut self,
Expand Down Expand Up @@ -195,21 +210,6 @@ impl<Tx: TransactionWithMeta> Scheduler<Tx> for GreedyScheduler<Tx> {
}
}

impl<Tx: TransactionWithMeta> GreedyScheduler<Tx> {
pub(crate) fn new(
consume_work_senders: Vec<Sender<ConsumeWork<Tx>>>,
finished_consume_work_receiver: Receiver<FinishedConsumeWork<Tx>>,
config: GreedySchedulerConfig,
) -> Self {
Self {
common: SchedulingCommon::new(consume_work_senders, finished_consume_work_receiver),
working_account_set: ReadWriteAccountSet::default(),
unschedulables: Vec::with_capacity(config.max_scanned_transactions_per_scheduling_pass),
config,
}
}
}

fn try_schedule_transaction<Tx: TransactionWithMeta>(
transaction_state: &mut TransactionState<Tx>,
pre_lock_filter: impl Fn(&Tx) -> bool,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,20 @@ pub(crate) struct PrioGraphScheduler<Tx> {
config: PrioGraphSchedulerConfig,
}

impl<Tx: TransactionWithMeta> PrioGraphScheduler<Tx> {
pub(crate) fn new(
consume_work_senders: Vec<Sender<ConsumeWork<Tx>>>,
finished_consume_work_receiver: Receiver<FinishedConsumeWork<Tx>>,
config: PrioGraphSchedulerConfig,
) -> Self {
Self {
common: SchedulingCommon::new(consume_work_senders, finished_consume_work_receiver),
prio_graph: PrioGraph::new(passthrough_priority),
config,
}
}
}

impl<Tx: TransactionWithMeta> Scheduler<Tx> for PrioGraphScheduler<Tx> {
/// Schedule transactions from the given `StateContainer` to be
/// consumed by the worker threads. Returns summary of scheduling, or an
Expand Down Expand Up @@ -323,18 +337,6 @@ impl<Tx: TransactionWithMeta> Scheduler<Tx> for PrioGraphScheduler<Tx> {
}

impl<Tx: TransactionWithMeta> PrioGraphScheduler<Tx> {
pub(crate) fn new(
consume_work_senders: Vec<Sender<ConsumeWork<Tx>>>,
finished_consume_work_receiver: Receiver<FinishedConsumeWork<Tx>>,
config: PrioGraphSchedulerConfig,
) -> Self {
Self {
common: SchedulingCommon::new(consume_work_senders, finished_consume_work_receiver),
prio_graph: PrioGraph::new(passthrough_priority),
config,
}
}

/// Gets accessed accounts (resources) for use in `PrioGraph`.
fn get_transaction_account_access(
transaction: &SanitizedTransactionTTL<impl SVMMessage>,
Expand Down

0 comments on commit deb6390

Please sign in to comment.