File tree Expand file tree Collapse file tree 4 files changed +17
-7
lines changed Expand file tree Collapse file tree 4 files changed +17
-7
lines changed Original file line number Diff line number Diff line change @@ -41,10 +41,11 @@ Config is specified via the plugin's JSON config file.
4141 "shutdown_timeout_ms" : 30000 ,
4242 "update_account_topic" : " solana.testnet.account_updates" ,
4343 "slot_status_topic" : " solana.testnet.slot_status" ,
44+ "publish_all_accounts" : false ,
4445 "program_ignores" : [
4546 " Sysvar1111111111111111111111111111111111111" ,
4647 " Vote111111111111111111111111111111111111111"
47- ],
48+ ]
4849}
4950```
5051
@@ -56,6 +57,7 @@ Config is specified via the plugin's JSON config file.
5657- ` shutdown_timeout_ms ` : Time the plugin is given to flush out all messages to Kafka upon exit request.
5758- ` update_account_topic ` : Topic name of account updates. Omit to disable.
5859- ` slot_status_topic ` : Topic name of slot status update. Omit to disable.
60+ - ` publish_all_accounts ` : Publish all accounts on startup. Omit to disable.
5961- ` program_ignores ` : Solana program IDs for which to ignore updates for owned accounts.
6062
6163## Buffering
Original file line number Diff line number Diff line change @@ -43,6 +43,9 @@ pub struct Config {
4343 /// List of programs to ignore.
4444 #[ serde( default ) ]
4545 pub program_ignores : Vec < String > ,
46+ /// Publish all accounts on startup.
47+ #[ serde( default ) ]
48+ pub publish_all_accounts : bool ,
4649}
4750
4851impl Default for Config {
@@ -53,6 +56,7 @@ impl Default for Config {
5356 update_account_topic : "" . to_owned ( ) ,
5457 slot_status_topic : "" . to_owned ( ) ,
5558 program_ignores : Vec :: new ( ) ,
59+ publish_all_accounts : false ,
5660 }
5761 }
5862}
Original file line number Diff line number Diff line change @@ -48,11 +48,13 @@ mod tests {
4848
4949 #[ test]
5050 fn test_filter ( ) {
51- let mut config = Config :: default ( ) ;
52- config. program_ignores = vec ! [
53- "Sysvar1111111111111111111111111111111111111" . to_owned( ) ,
54- "Vote111111111111111111111111111111111111111" . to_owned( ) ,
55- ] ;
51+ let config = Config {
52+ program_ignores : vec ! [
53+ "Sysvar1111111111111111111111111111111111111" . to_owned( ) ,
54+ "Vote111111111111111111111111111111111111111" . to_owned( ) ,
55+ ] ,
56+ ..Config :: default ( )
57+ } ;
5658
5759 let filter = Filter :: new ( & config) ;
5860 assert_eq ! ( filter. program_ignores. len( ) , 2 ) ;
Original file line number Diff line number Diff line change 2828pub struct KafkaPlugin {
2929 publisher : Option < Publisher > ,
3030 filter : Option < Filter > ,
31+ publish_all_accounts : bool ,
3132}
3233
3334impl Debug for KafkaPlugin {
@@ -54,6 +55,7 @@ impl AccountsDbPlugin for KafkaPlugin {
5455 config_file
5556 ) ;
5657 let config = Config :: read_from ( config_file) ?;
58+ self . publish_all_accounts = config. publish_all_accounts ;
5759
5860 let ( version_n, version_s) = get_rdkafka_version ( ) ;
5961 info ! ( "rd_kafka_version: {:#08x}, {}" , version_n, version_s) ;
@@ -82,7 +84,7 @@ impl AccountsDbPlugin for KafkaPlugin {
8284 slot : u64 ,
8385 is_startup : bool ,
8486 ) -> PluginResult < ( ) > {
85- if is_startup {
87+ if is_startup && ! self . publish_all_accounts {
8688 return Ok ( ( ) ) ;
8789 }
8890
You can’t perform that action at this time.
0 commit comments