Skip to main content

RedisKey

Struct RedisKey 

Source
pub struct RedisKey(/* private fields */);
Expand description

A typed Redis key with factory methods for all Pyra key patterns.

Implementations§

Source§

impl RedisKey

Source

pub const DRIFT_USER_PREFIX: &'static str = "account:drift:user"

Source

pub const DRIFT_USER_BY_PUBKEY_PREFIX: &'static str = "reverse:drift_user_pubkey"

Source

pub const DRIFT_SPOT_MARKET_PREFIX: &'static str = "account:drift:spot_market"

Source

pub fn drift_user(authority: &Pubkey) -> Self

Source

pub fn drift_user_by_pubkey(pubkey: &Pubkey) -> Self

Reverse mapping: DriftUser account pubkey → authority (vault pubkey).

Source

pub fn drift_spot_market(asset_id: AssetId) -> Self

Source§

impl RedisKey

Source

pub const KAMINO_OBLIGATION_PREFIX: &'static str = "account:kamino:obligation"

Source

pub const KAMINO_OBLIGATION_BY_PUBKEY_PREFIX: &'static str = "reverse:kamino_obligation_pubkey"

Source

pub const KAMINO_RESERVE_PREFIX: &'static str = "account:kamino:reserve"

Source

pub fn kamino_obligation( vault_address: &Pubkey, lending_market: &Pubkey, ) -> Self

Source

pub fn kamino_obligation_by_pubkey(obligation_pubkey: &Pubkey) -> Self

Reverse mapping: Kamino Obligation account pubkey → vault authority.

Source

pub fn kamino_reserve(reserve_pubkey: &Pubkey) -> Self

Source

pub fn kamino_obligation_glob() -> String

Source

pub fn kamino_reserve_glob() -> String

Source§

impl RedisKey

Source

pub const VAULT_PREFIX: &'static str = "account:pyra:vault"

Source

pub const WITHDRAW_ORDER_PREFIX: &'static str = "account:pyra:withdraw_order"

Source

pub const SPEND_LIMITS_ORDER_PREFIX: &'static str = "account:pyra:spend_limits_order"

Source

pub const DEPOSIT_ADDRESS_PREFIX: &'static str = "account:pyra:deposit_address"

Source

pub const DEPOSIT_ADDRESS_OWNER_PREFIX: &'static str = "reverse:deposit_address"

Source

pub const USER_WITHDRAW_ORDERS_PREFIX: &'static str = "user:orders:withdraws"

Source

pub const USER_SPEND_LIMITS_ORDERS_PREFIX: &'static str = "user:orders:spend_limits"

Source

pub const TOKEN_ACCOUNT_PREFIX: &'static str = "account:token"

Source

pub const PRICE_PREFIX: &'static str = "price"

Source

pub const ORACLE_PREFIX: &'static str = "oracle"

Source

pub const ORACLE_CACHE_PREFIX: &'static str = "account:oracle"

Source

pub const REGISTERED_WALLETS: &'static str = "registered_wallets"

Source

pub const REGISTERED_WALLETS_CHANGES: &'static str = "registered_wallets:changes"

Source

pub const USER_SOLANA_ADDRESS_PREFIX: &'static str = "user:solana_address"

Source

pub const USER_PROVIDER_PREFIX: &'static str = "user:provider"

Source

pub const PENDING_DEPOSIT_PREFIX: &'static str = "pending_deposits"

Source

pub fn from_string(s: String) -> Self

Create a key from a raw string.

Source

pub fn as_str(&self) -> &str

Return a reference to the inner string.

Source

pub fn pattern(prefix: &str) -> String

Build a SCAN/KEYS glob pattern: "{prefix}:*".

Source

pub fn vault(vault: &Pubkey) -> Self

Source

pub fn deposit_address_spl(deposit_address: &Pubkey, mint: &Pubkey) -> Self

Source

pub fn deposit_address_sol(deposit_address: &Pubkey) -> Self

Source

pub fn deposit_address_owner(deposit_address: &Pubkey) -> Self

Reverse mapping: deposit address → owner pubkey.

Source

pub fn withdraw_order(order: &Pubkey) -> Self

Source

pub fn user_withdraw_orders(owner: &Pubkey) -> Self

Source

pub fn spend_limits_order(order: &Pubkey) -> Self

Source

pub fn user_spend_limits_orders(owner: &Pubkey) -> Self

Source

pub fn token_account(token_account: &Pubkey) -> Self

Source

pub fn price(asset_id: AssetId) -> Self

Source

pub fn oracle(oracle: &Pubkey) -> Self

Oracle pubkey → market_index mapping.

Source

pub fn oracle_cache(asset_id: AssetId) -> Self

Full oracle snapshot cache by asset ID.

Source

pub fn registered_wallets() -> Self

Source

pub fn user_solana_address(owner: &str) -> Self

Lookup user by Solana address: "user:solana_address:{owner}".

Source

pub fn user_provider(user_id: &str) -> Self

Lookup user by provider (Privy) ID: "user:provider:{user_id}".

Source

pub fn pending_deposit(owner: &str, mint: &str) -> Self

Pending deposit key: "pending_deposits:{owner}:{mint}".

Trait Implementations§

Source§

impl AsRef<str> for RedisKey

Source§

fn as_ref(&self) -> &str

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl Clone for RedisKey

Source§

fn clone(&self) -> RedisKey

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for RedisKey

Source§

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

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

impl Display for RedisKey

Source§

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

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

impl Hash for RedisKey

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for RedisKey

Source§

fn eq(&self, other: &RedisKey) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl ToRedisArgs for RedisKey

Source§

fn write_redis_args<W: ?Sized + RedisWrite>(&self, out: &mut W)

This writes the value into a vector of bytes. Each item is a single argument. Most items generate a single item. Read more
Source§

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

This converts the value into a vector of bytes. Each item is a single argument. Most items generate a vector of a single item. Read more
Source§

fn describe_numeric_behavior(&self) -> NumericBehavior

Returns an information about the contained value with regards to it’s numeric behavior in a redis context. This is used in some high level concepts to switch between different implementations of redis functions (for instance INCR vs INCRBYFLOAT).
Source§

fn num_of_args(&self) -> usize

Returns the number of arguments this value will generate. Read more
Source§

impl Eq for RedisKey

Source§

impl StructuralPartialEq for RedisKey

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> 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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. 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.