Summary of Changes Create a plugin mechanism in the accounts update path so that accounts data can be streamed out to external data stores (be it Kafka or Postgres). The plugin mechanism allows Data stores of connection strings/credentials to be configured, Accounts with patterns to be streamed PostgreSQL implementation of the streaming for different destination stores to be plugged in. The code comprises 4 major parts: accountsdb-plugin-intf: defines the plugin interface which concrete plugin should implement. accountsdb-plugin-manager: manages the load/unload of plugins and provide interfaces which the validator can notify of accounts update to plugins. accountsdb-plugin-postgres: the concrete plugin implementation for PostgreSQL The validator integrations: updated streamed right after snapshot restore and after account update from transaction processing or other real updates. The plugin is optionally loaded on demand by new validator CLI argument -- there is no impact if the plugin is not loaded.
21 lines
1.0 KiB
Markdown
21 lines
1.0 KiB
Markdown
<p align="center">
|
|
<a href="https://solana.com">
|
|
<img alt="Solana" src="https://i.imgur.com/IKyzQ6T.png" width="250" />
|
|
</a>
|
|
</p>
|
|
|
|
# Solana AccountsDb Plugin Interface
|
|
|
|
This crate enables an AccountsDb plugin to be plugged into the Solana Validator runtime to take actions
|
|
at the time of each account update; for example, saving the account state to an external database. The plugin must implement the `AccountsDbPlugin` trait. Please see the detail of the `accountsdb_plugin_interface.rs` for the interface definition.
|
|
|
|
The plugin should produce a `cdylib` dynamic library, which must expose a `C` function `_create_plugin()` that
|
|
instantiates the implementation of the interface.
|
|
|
|
The `solana-accountsdb-plugin-postgres` crate provides an example of how to create a plugin which saves the accounts data into an
|
|
external PostgreSQL databases.
|
|
|
|
More information about Solana is available in the [Solana documentation](https://docs.solana.com/).
|
|
|
|
Still have questions? Ask us on [Discord](https://discordapp.com/invite/pquxPsq)
|