Struct AccountsDbPluginPostgres

Source
pub struct AccountsDbPluginPostgres { /* private fields */ }

Implementations§

Trait Implementations§

Source§

impl AccountsDbPlugin for AccountsDbPluginPostgres

Source§

fn on_load(&mut self, config_file: &str) -> Result<()>

Do initialization for the PostgreSQL plugin.

§Format of the config file:
  • The accounts_selector section 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 supports 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_str is set, the values in “host”, “user” and “port” are ignored. If connection_str is not given, host and user must be given. “store_account_historical_data”, optional, set it to ‘true’, to store historical account data to account_audit table.
  • “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’.
  • “transaction_selector”, optional, controls if and what transaction to store. If this field is missing None of the transction is stored. “transaction_selector” : { “mentions” : [“pubkey-1”, “pubkey-2”, …, “pubkey-n”], } The mentions field support wildcard to select all transaction or all ‘vote’ transactions: For example, to select all transactions: “transaction_selector” : { “mentions” : [“*”], } To select all vote transactions: “transaction_selector” : { “mentions” : [“all_votes”], }
§Examples

{ “libpath”: “/home/solana/target/release/libsolana_accountsdb_plugin_postgres.so”, “host”: “host_foo”, “user”: “solana”, “threads”: 10, “accounts_selector” : { “owners” : [“9oT9R5ZyRovSVnt37QvVoBttGpNqR3J7unkb567NP8k3”] } }

Source§

fn account_data_notifications_enabled(&self) -> bool

Check if the plugin is interested in account data Default is true – if the plugin is not interested in account data, please return false.

Source§

fn transaction_notifications_enabled(&self) -> bool

Check if the plugin is interested in transaction data

Source§

fn name(&self) -> &'static str

Source§

fn on_unload(&mut self)

The callback called right before a plugin is unloaded by the system Used for doing cleanup before unload.
Source§

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.
Source§

fn update_slot_status( &mut self, slot: u64, parent: Option<u64>, status: SlotStatus, ) -> Result<()>

Called when a slot status is updated
Source§

fn notify_end_of_startup(&mut self) -> Result<()>

Called when all accounts are notified of during startup.
Source§

fn notify_transaction( &mut self, transaction_info: ReplicaTransactionInfoVersions<'_>, slot: u64, ) -> Result<()>

Called when a transaction is updated at a slot.
Source§

fn notify_block_metadata( &mut self, block_info: ReplicaBlockInfoVersions<'_>, ) -> Result<()>

Called when block’s metadata is updated.
Source§

impl Debug for AccountsDbPluginPostgres

Source§

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

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

impl Default for AccountsDbPluginPostgres

Source§

fn default() -> AccountsDbPluginPostgres

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> AbiExample for T

Source§

default fn example() -> T

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

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
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,