Skip to main content

Crate agave_scheduler_bindings

Crate agave_scheduler_bindings 

Source
Expand description

Messages passed between agave and an external pack process. Messages are passed via shaq::spsc::Consumer/Producer.

Memory freeing is responsibility of the external pack process, and is done via rts-alloc crate. It is also possible the external pack process allocates memory to pass to agave, BUT it will still be the responsibility of the external pack process to free that memory.

Setting up the shared memory allocator and queues is done outside of agave - it can be done by the external pack process or another process. agave will just join shared memory regions, but not create them. Similarly, agave will not delete files used for shared memory regions. See shaq and rts-alloc crates for details.

The basic architecture is as follows: ┌───────────────┐ ┌─────────────────┐ │ tpu_to_pack │ │ progress_tracker│ └───────┬───────┘ └───────┬─────────┘ │ │ │ │ │ │ ┌──▼───────────────────────▼───┐ │ external scheduler │ └─▲─────── ▲────────────────▲──┘ │ │ │ │ │ │ ┌───▼───┐ ┌──▼─────┐ … ┌───▼───┐ │worker1│ │worker2 │ │workerN│ └───────┘ └────────┘ └───────┘

  • TpuToPackMessage are sent from tpu_to_pack queue to the external scheduler process. This passes in tpu transactions to be scheduled, and optionally vote transactions.
  • ProgressMessage are sent from progress_tracker queue to the external scheduler process. This passes information about leader status and slot progress to the external scheduler process.
  • PackToWorkerMessage are sent from the external scheduler process to worker threads within agave. This passes a batch of transactions to be processed by the worker threads. This processing can also involve resolving the transactions’ addresses, or similar operations beyond execution.
  • WorkerToPackMessage are sent from worker threads within agave back to the external scheduler process. This passes back the results of processing the transactions.

Ownership and pointer lifetime rule:

  • Sending a message that contains offsets or pointers to memory transfers ownership of that memory to the receiver for the lifetime defined by the protocol.
  • The sender must treat that memory as not owned until ownership is explicitly returned by a later message, if any. In particular, the sender must not free or modify that memory while it is not owned.
  • If the protocol does not return the memory to the sender, the receiver is responsible for freeing it.

Modules§

pack_message_flags
Flags for crate::PackToWorkerMessage::flags. Use CHECK or EXECUTE to specify how a batch should be processed. See check_flags and execution_flags for details.
processed_codes
tpu_message_flags
worker_message_types

Structs§

PackToWorkerMessage
Message: [Pack -> Worker] External pack processe passes transactions to worker threads within agave.
ProgressMessage
Message: [Agave -> Pack] Agave passes leader status to the external pack process.
SharablePubkeys
Reference to an array of Pubkeys that can be shared safely across processes.
SharableTransactionBatchRegion
Reference to an array of SharableTransactionRegion that can be shared safely across processes. General flow:
SharableTransactionRegion
Reference to a transaction that can shared safely across processes.
TpuToPackMessage
Message: [TPU -> Pack] TPU passes transactions to the external pack process. This is also a transfer of ownership of the transaction: the external pack process is responsible for freeing the memory.
TransactionResponseRegion
Reference to an array of response messages. General flow:
WorkerToPackMessage
Message: [Worker -> Pack] Message from worker threads in response to a PackToWorkerMessage.

Constants§

LEADER_READY
The node is in a leader slot and has a working bank ready.
LEADER_STARTING
The node is in a leader slot but the working bank is not yet ready.
MAX_TRANSACTIONS_PER_MESSAGE
Maximum number of transactions allowed in a PackToWorkerMessage. If the number of transactions exceeds this value, agave will not process the message.
NOT_LEADER
The node is not currently in a leader slot.