Struct solana_accountsdb_plugin_postgres::accountsdb_plugin_postgres::AccountsDbPluginPostgres
source · [−]pub struct AccountsDbPluginPostgres { /* private fields */ }Implementations
Trait Implementations
sourceimpl AccountsDbPlugin for AccountsDbPluginPostgres
impl AccountsDbPlugin for AccountsDbPluginPostgres
sourcefn on_load(&mut self, config_file: &str) -> Result<()>
fn on_load(&mut self, config_file: &str) -> Result<()>
Do initialization for the PostgreSQL plugin.
Format of the config file:
- The
accounts_selectorsection allows the user to controls accounts selections. “accounts_selector” : { “accounts” : [“pubkey-1”, “pubkey-2”, …, “pubkey-n”], } or: “accounts_selector” = { “owners” : [“pubkey-1”, “pubkey-2”, …, “pubkey-m”] } Accounts either satisyfing the accounts condition or owners condition will be selected. When only owners is specified, all accounts belonging to the owners will be streamed. The accounts field support wildcard to select all accounts: “accounts_selector” : { “accounts” : [“*”], } - “host”, optional, specifies the PostgreSQL server.
- “user”, optional, specifies the PostgreSQL user.
- “port”, optional, specifies the PostgreSQL server’s port.
- “connection_str”, optional, the custom PostgreSQL connection string.
Please refer to https://docs.rs/postgres/0.19.2/postgres/config/struct.Config.html for the connection configuration.
When
connection_stris set, the values in “host”, “user” and “port” are ignored. Ifconnection_stris not given,hostandusermust be given. - “threads” optional, specifies the number of worker threads for the plugin. A thread maintains a PostgreSQL connection to the server. The default is ‘10’.
- “batch_size” optional, specifies the batch size of bulk insert when the AccountsDb is created from restoring a snapshot. The default is ‘10’.
- “panic_on_db_errors”, optional, contols if to panic when there are errors replicating data to the PostgreSQL database. The default is ‘false’.
Examples
{ “libpath”: “/home/solana/target/release/libsolana_accountsdb_plugin_postgres.so”, “host”: “host_foo”, “user”: “solana”, “threads”: 10, “accounts_selector” : { “owners” : [“9oT9R5ZyRovSVnt37QvVoBttGpNqR3J7unkb567NP8k3”] } }
fn name(&self) -> &'static str
sourcefn on_unload(&mut self)
fn on_unload(&mut self)
The callback called right before a plugin is unloaded by the system Used for doing cleanup before unload. Read more
sourcefn update_account(
&mut self,
account: ReplicaAccountInfoVersions<'_>,
slot: u64,
is_startup: bool
) -> Result<()>
fn update_account(
&mut self,
account: ReplicaAccountInfoVersions<'_>,
slot: u64,
is_startup: bool
) -> Result<()>
Called when an account is updated at a slot.
When is_startup is true, it indicates the account is loaded from
snapshots when the validator starts up. When is_startup is false,
the account is updated during transaction processing. Read more
sourcefn update_slot_status(
&mut self,
slot: u64,
parent: Option<u64>,
status: SlotStatus
) -> Result<()>
fn update_slot_status(
&mut self,
slot: u64,
parent: Option<u64>,
status: SlotStatus
) -> Result<()>
Called when a slot status is updated
sourcefn notify_end_of_startup(&mut self) -> Result<()>
fn notify_end_of_startup(&mut self) -> Result<()>
Called when all accounts are notified of during startup.
sourceimpl Debug for AccountsDbPluginPostgres
impl Debug for AccountsDbPluginPostgres
sourceimpl Default for AccountsDbPluginPostgres
impl Default for AccountsDbPluginPostgres
sourcefn default() -> AccountsDbPluginPostgres
fn default() -> AccountsDbPluginPostgres
Returns the “default value” for a type. Read more
Auto Trait Implementations
impl !RefUnwindSafe for AccountsDbPluginPostgres
impl Send for AccountsDbPluginPostgres
impl Sync for AccountsDbPluginPostgres
impl Unpin for AccountsDbPluginPostgres
impl !UnwindSafe for AccountsDbPluginPostgres
Blanket Implementations
impl<T> AbiExample for T
impl<T> AbiExample for T
pub default fn example() -> T
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
pub fn vzip(self) -> V
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber to this type, returning a
WithDispatch wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber to this type, returning a
WithDispatch wrapper. Read more