Skip to main content

Thread

Struct Thread 

Source
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§authority: Pubkey§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

Source

pub fn pubkey(authority: Pubkey, id: impl AsRef<[u8]>) -> Pubkey

Derive the pubkey of a thread account.

Source

pub fn has_nonce_account(&self) -> bool

Check if this thread has a nonce account.

Source

pub fn advance_to_next_fiber(&mut self)

Advance fiber_cursor to the next fiber in the sequence.

Source

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.

Source

pub fn fiber(&self, thread_pubkey: &Pubkey) -> Pubkey

Get the fiber PDA for the current fiber_cursor

Source

pub fn fiber_at_index(&self, thread_pubkey: &Pubkey, fiber_index: u8) -> Pubkey

Get the fiber PDA for a specific fiber_index

Source

pub fn next_fiber(&self, thread_pubkey: &Pubkey) -> Pubkey

Get the next fiber PDA (for the next fiber_cursor in the sequence)

Source

pub fn is_ready(&self, current_slot: u64, current_timestamp: i64) -> bool

Check if thread is ready to execute based on schedule

Source

pub fn validate_for_execution(&self) -> Result<()>

Validate that the thread is ready for execution

Trait Implementations§

Source§

impl AccountDeserialize for Thread

Source§

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>

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

Source§

fn try_serialize<W: Write>(&self, writer: &mut W) -> Result<()>

Serializes the account data into writer.
Source§

impl BorshDeserialize for Thread

Source§

fn deserialize_reader<__R: Read>(reader: &mut __R) -> Result<Self, Error>

Source§

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>

Deserialize this instance from a slice of bytes.
Source§

fn try_from_reader<R>(reader: &mut R) -> Result<Self, Error>
where R: Read,

Source§

impl BorshSerialize for Thread

Source§

fn serialize<__W: Write>(&self, writer: &mut __W) -> Result<(), Error>

Source§

impl Clone for Thread

Source§

fn clone(&self) -> Thread

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Thread

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Discriminator for Thread

Source§

const DISCRIMINATOR: &'static [u8]

Discriminator slice. Read more
Source§

impl NonceProcessor for Thread

Source§

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 Owner for Thread

Source§

impl PaymentDistributor for Thread

Source§

fn distribute_payments<'info>( &self, thread_account: &AccountInfo<'info>, executor: &AccountInfo<'info>, admin: &AccountInfo<'info>, payments: &PaymentDetails, ) -> Result<()>

Source§

impl Space for Thread

Source§

impl ThreadSeeds for Thread

Source§

fn get_seed_bytes(&self) -> Vec<Vec<u8>>

Source§

fn sign<F, R>(&self, f: F) -> R
where F: FnOnce(&[&[u8]]) -> R,

Use seeds with a callback to avoid lifetime issues
Source§

impl TriggerProcessor for Thread

Source§

fn validate_trigger( &self, clock: &Clock, remaining_accounts: &[AccountInfo<'_>], thread_pubkey: &Pubkey, ) -> Result<i64>

Source§

fn update_schedule( &mut self, clock: &Clock, remaining_accounts: &[AccountInfo<'_>], thread_pubkey: &Pubkey, ) -> Result<()>

Source§

fn get_last_started_at(&self) -> i64

Source§

impl TryFrom<Vec<u8>> for Thread

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(data: Vec<u8>) -> Result<Self, Self::Error>

Performs the conversion.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.