pub struct Subscription {
pub subscriber: Pubkey,
pub predicate: Predicate,
pub instructions: Vec<Instruction>,
pub kind: SubscriptionKind,
pub active_commits: RangeInclusive<Commmit>,
}Expand description
Subscription data stored by a user for a given topic. This is used to generate scheduled
transactions to be run if the topic is triggered.
The instructions are a set of SVM instructions that are meant to be run when the subscription is
triggered. The instruction array is converted to a SanitizedTransaction and executed in the VM.
Fields§
§subscriber: PubkeySubscriber key
predicate: PredicateThe predicate set by the subscriber to match the event
instructions: Vec<Instruction>Instructions to be executed
kind: SubscriptionKindSubscription kind
active_commits: RangeInclusive<Commmit>Active commits for the subscription
Implementations§
Source§impl Subscription
impl Subscription
Sourcepub fn new(
subscriber: Pubkey,
predicate: Predicate,
instructions: Vec<Instruction>,
kind: SubscriptionKind,
active_commits: RangeInclusive<u64>,
) -> Self
pub fn new( subscriber: Pubkey, predicate: Predicate, instructions: Vec<Instruction>, kind: SubscriptionKind, active_commits: RangeInclusive<u64>, ) -> Self
Instantiate a new Subscription
§Arguments
subscriber- The public key of the subscriberpredicate- The predicate to match the eventinstructions- A vector of instructions to be executedkind- The type of subscription (persistent or one-shot)active_commits- The range of active commits for the subscription
§Returns
Subscription- A new instance ofSubscription
Sourcepub fn sanitize_instructions(&self) -> Result<(), SubscriptionError>
pub fn sanitize_instructions(&self) -> Result<(), SubscriptionError>
Sanitize a Subscription
§Returns
Result<(), SubscriptionError> - Ok if the subscription is valid, Err otherwise
Trait Implementations§
Source§impl Clone for Subscription
impl Clone for Subscription
Source§fn clone(&self) -> Subscription
fn clone(&self) -> Subscription
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for Subscription
impl Debug for Subscription
Source§impl<'de> Deserialize<'de> for Subscription
impl<'de> Deserialize<'de> for Subscription
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for Subscription
impl PartialEq for Subscription
Source§impl Serialize for Subscription
impl Serialize for Subscription
impl Eq for Subscription
impl StructuralPartialEq for Subscription
Auto Trait Implementations§
impl Freeze for Subscription
impl RefUnwindSafe for Subscription
impl Send for Subscription
impl Sync for Subscription
impl Unpin for Subscription
impl UnsafeUnpin for Subscription
impl UnwindSafe for Subscription
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.