in_thread_accounts_load.rs

Overview

This file defines the InThreadAccountsLoad struct and its associated functionality for analyzing and managing the load of accounts within a single thread context during transaction processing. It focuses on tracking distribution patterns of account routing bits within transaction messages contained in a block and provides mechanisms for determining optimal bit-based splits to balance workload. The file is primarily concerned with data aggregation about account routing bit usage and suggests splits that can be used in load balancing strategies.

Structs and Types

InThreadAccountsLoad

A structure holding account load metrics related to transaction processing within a thread.

Fields


Constants


Implementations for InThreadAccountsLoad

new_from<TOptimisticState>(block: &AckiNackiBlock, block_state: Arc<TOptimisticState>) -> Self

Creates a new InThreadAccountsLoad instance initialized by appending load data derived from the specified block and its optimistic state.


best_split(&self, current_bitmask: &Bitmask<AccountRouting>) -> Option<Bitmask<AccountRouting>>

Determines the best bit to split on, given the current bitmask, to balance the load between zero and one bits in the account routing.


append_from<TOptimisticState>(&mut self, block: &AckiNackiBlock, _block_state: Arc<TOptimisticState>)

Accumulates load data from the given block into the current InThreadAccountsLoad instance.


add_in_place(&mut self, other: &Self)

Adds the account load counts from another InThreadAccountsLoad into self.


sub_in_place(&mut self, other: &Self)

Subtracts the account load counts of another InThreadAccountsLoad from self.


Default implementation

Provides a default constructor setting total_transactions_count to zero and zeroing out all bit counts.


Interactions with Other Modules


Key Algorithms and Implementation Notes


Visual Diagram of InThreadAccountsLoad Structure and Methods

classDiagram
class InThreadAccountsLoad {
- total_transactions_count: i64
- zero_bits_count: ["[u32;256"];2]
+ new_from()
+ best_split()
+ append_from()
+ add_in_place()
+ sub_in_place()
}

Usage Context

The InThreadAccountsLoad struct and its methods are intended to be used in the context of multi-threaded load balancing for transaction processing. By analyzing account routing bits across transactions in a block, the system can decide how to split workload across threads efficiently, improving parallelism and throughput.

This file's functionality integrates closely with load balancing services and multithreading infrastructure, as indicated by its reliance on types like AckiNackiBlock, OptimisticState, and routing bitmasks. It acts as a utility to gather statistics and suggest workload partitioning strategies based on transaction source characteristics. For more details on load balancing and transaction routing concepts, see Load Balancing Service and Account Routing.