pub struct BlockchainCacheDatabase { /* private fields */ }Expand description
Database interface for persisting and retrieving blockchain entities and domain objects.
Implementations§
Source§impl BlockchainCacheDatabase
impl BlockchainCacheDatabase
Sourcepub async fn init(pg_options: PgConnectOptions) -> Self
pub async fn init(pg_options: PgConnectOptions) -> Self
Initializes a new database instance by establishing a connection to PostgreSQL.
Sourcepub async fn seed_chain(&self, chain: &Chain) -> Result<()>
pub async fn seed_chain(&self, chain: &Chain) -> Result<()>
Seeds the database with a blockchain chain record.
Sourcepub async fn add_dex(&self, dex: &Dex) -> Result<()>
pub async fn add_dex(&self, dex: &Dex) -> Result<()>
Adds or updates a DEX (Decentralized Exchange) record in the database.
Sourcepub async fn add_pool(&self, pool: &Pool) -> Result<()>
pub async fn add_pool(&self, pool: &Pool) -> Result<()>
Adds or updates a liquidity pool/pair record in the database.
Sourcepub async fn add_token(&self, token: &Token) -> Result<()>
pub async fn add_token(&self, token: &Token) -> Result<()>
Adds or updates a token record in the database.
Sourcepub async fn load_tokens(&self, chain: SharedChain) -> Result<Vec<Token>>
pub async fn load_tokens(&self, chain: SharedChain) -> Result<Vec<Token>>
Retrieves all token records for the given chain and converts them into Token domain objects.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for BlockchainCacheDatabase
impl !RefUnwindSafe for BlockchainCacheDatabase
impl Send for BlockchainCacheDatabase
impl Sync for BlockchainCacheDatabase
impl Unpin for BlockchainCacheDatabase
impl !UnwindSafe for BlockchainCacheDatabase
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more