pub struct Thread {Show 18 fields
pub version: u8,
pub bump: u8,
pub authority: Pubkey,
pub id: Vec<u8>,
pub name: String,
pub created_at: i64,
pub trigger: Trigger,
pub schedule: Schedule,
pub fiber_ids: Vec<u8>,
pub fiber_cursor: u8,
pub fiber_next_id: u8,
pub fiber_signal: Signal,
pub paused: bool,
pub exec_count: u64,
pub last_executor: Pubkey,
pub nonce_account: Pubkey,
pub last_nonce: String,
pub close_fiber: Vec<u8>,
}Expand description
Tracks the current state of a transaction thread on Solana.
Fields§
§version: u8§bump: u8§id: Vec<u8>§name: String§created_at: i64§trigger: Trigger§schedule: Schedule§fiber_ids: Vec<u8>§fiber_cursor: u8§fiber_next_id: u8§fiber_signal: Signal§paused: bool§exec_count: u64§last_executor: Pubkey§nonce_account: Pubkey§last_nonce: String§close_fiber: Vec<u8>Implementations§
Source§impl Thread
impl Thread
Sourcepub fn pubkey(authority: Pubkey, id: impl AsRef<[u8]>) -> Pubkey
pub fn pubkey(authority: Pubkey, id: impl AsRef<[u8]>) -> Pubkey
Derive the pubkey of a thread account.
Sourcepub fn has_nonce_account(&self) -> bool
pub fn has_nonce_account(&self) -> bool
Check if this thread has a nonce account.
Sourcepub fn advance_to_next_fiber(&mut self)
pub fn advance_to_next_fiber(&mut self)
Advance fiber_cursor to the next fiber in the sequence.
Sourcepub fn next_fiber_index(&self) -> u8
pub fn next_fiber_index(&self) -> u8
Get the next fiber index in sequence (without mutating). Used to validate Chain signals target the correct consecutive fiber.
Sourcepub fn fiber(&self, thread_pubkey: &Pubkey) -> Pubkey
pub fn fiber(&self, thread_pubkey: &Pubkey) -> Pubkey
Get the fiber PDA for the current fiber_cursor
Sourcepub fn fiber_at_index(&self, thread_pubkey: &Pubkey, fiber_index: u8) -> Pubkey
pub fn fiber_at_index(&self, thread_pubkey: &Pubkey, fiber_index: u8) -> Pubkey
Get the fiber PDA for a specific fiber_index
Sourcepub fn next_fiber(&self, thread_pubkey: &Pubkey) -> Pubkey
pub fn next_fiber(&self, thread_pubkey: &Pubkey) -> Pubkey
Get the next fiber PDA (for the next fiber_cursor in the sequence)
Sourcepub fn is_ready(&self, current_slot: u64, current_timestamp: i64) -> bool
pub fn is_ready(&self, current_slot: u64, current_timestamp: i64) -> bool
Check if thread is ready to execute based on schedule
Sourcepub fn validate_for_execution(&self) -> Result<()>
pub fn validate_for_execution(&self) -> Result<()>
Validate that the thread is ready for execution
Trait Implementations§
Source§impl AccountDeserialize for Thread
impl AccountDeserialize for Thread
Source§fn try_deserialize(buf: &mut &[u8]) -> Result<Self>
fn try_deserialize(buf: &mut &[u8]) -> Result<Self>
Deserializes previously initialized account data. Should fail for all
uninitialized accounts, where the bytes are zeroed. Implementations
should be unique to a particular account type so that one can never
successfully deserialize the data of one account type into another.
For example, if the SPL token program were to implement this trait,
it should be impossible to deserialize a
Mint account into a token
Account.Source§fn try_deserialize_unchecked(buf: &mut &[u8]) -> Result<Self>
fn try_deserialize_unchecked(buf: &mut &[u8]) -> Result<Self>
Deserializes account data without checking the account discriminator.
This should only be used on account initialization, when the bytes of
the account are zeroed.
Source§impl AccountSerialize for Thread
impl AccountSerialize for Thread
Source§impl BorshDeserialize for Thread
impl BorshDeserialize for Thread
fn deserialize_reader<__R: Read>(reader: &mut __R) -> Result<Self, Error>
Source§fn deserialize(buf: &mut &[u8]) -> Result<Self, Error>
fn deserialize(buf: &mut &[u8]) -> Result<Self, Error>
Deserializes this instance from a given slice of bytes.
Updates the buffer to point at the remaining bytes.
Source§fn try_from_slice(v: &[u8]) -> Result<Self, Error>
fn try_from_slice(v: &[u8]) -> Result<Self, Error>
Deserialize this instance from a slice of bytes.
fn try_from_reader<R>(reader: &mut R) -> Result<Self, Error>where
R: Read,
Source§impl BorshSerialize for Thread
impl BorshSerialize for Thread
Source§impl Discriminator for Thread
impl Discriminator for Thread
Source§const DISCRIMINATOR: &'static [u8]
const DISCRIMINATOR: &'static [u8]
Discriminator slice. Read more
Source§impl NonceProcessor for Thread
impl NonceProcessor for Thread
fn advance_nonce_if_required<'info>( &self, thread_account_info: &AccountInfo<'info>, nonce_account: &Option<UncheckedAccount<'info>>, recent_blockhashes: &Option<UncheckedAccount<'info>>, ) -> Result<()>
Source§impl PaymentDistributor for Thread
impl PaymentDistributor for Thread
fn distribute_payments<'info>( &self, thread_account: &AccountInfo<'info>, executor: &AccountInfo<'info>, admin: &AccountInfo<'info>, payments: &PaymentDetails, ) -> Result<()>
Source§impl ThreadSeeds for Thread
impl ThreadSeeds for Thread
Source§impl TriggerProcessor for Thread
impl TriggerProcessor for Thread
fn validate_trigger( &self, clock: &Clock, remaining_accounts: &[AccountInfo<'_>], thread_pubkey: &Pubkey, ) -> Result<i64>
fn update_schedule( &mut self, clock: &Clock, remaining_accounts: &[AccountInfo<'_>], thread_pubkey: &Pubkey, ) -> Result<()>
fn get_last_started_at(&self) -> i64
Auto Trait Implementations§
impl Freeze for Thread
impl RefUnwindSafe for Thread
impl Send for Thread
impl Sync for Thread
impl Unpin for Thread
impl UnsafeUnpin for Thread
impl UnwindSafe for Thread
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more