File tree 4 files changed +17
-7
lines changed
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.
41
41
"shutdown_timeout_ms" : 30000 ,
42
42
"update_account_topic" : " solana.testnet.account_updates" ,
43
43
"slot_status_topic" : " solana.testnet.slot_status" ,
44
+ "publish_all_accounts" : false ,
44
45
"program_ignores" : [
45
46
" Sysvar1111111111111111111111111111111111111" ,
46
47
" Vote111111111111111111111111111111111111111"
47
- ],
48
+ ]
48
49
}
49
50
```
50
51
@@ -56,6 +57,7 @@ Config is specified via the plugin's JSON config file.
56
57
- ` shutdown_timeout_ms ` : Time the plugin is given to flush out all messages to Kafka upon exit request.
57
58
- ` update_account_topic ` : Topic name of account updates. Omit to disable.
58
59
- ` slot_status_topic ` : Topic name of slot status update. Omit to disable.
60
+ - ` publish_all_accounts ` : Publish all accounts on startup. Omit to disable.
59
61
- ` program_ignores ` : Solana program IDs for which to ignore updates for owned accounts.
60
62
61
63
## Buffering
Original file line number Diff line number Diff line change @@ -43,6 +43,9 @@ pub struct Config {
43
43
/// List of programs to ignore.
44
44
#[ serde( default ) ]
45
45
pub program_ignores : Vec < String > ,
46
+ /// Publish all accounts on startup.
47
+ #[ serde( default ) ]
48
+ pub publish_all_accounts : bool ,
46
49
}
47
50
48
51
impl Default for Config {
@@ -53,6 +56,7 @@ impl Default for Config {
53
56
update_account_topic : "" . to_owned ( ) ,
54
57
slot_status_topic : "" . to_owned ( ) ,
55
58
program_ignores : Vec :: new ( ) ,
59
+ publish_all_accounts : false ,
56
60
}
57
61
}
58
62
}
Original file line number Diff line number Diff line change @@ -48,11 +48,13 @@ mod tests {
48
48
49
49
#[ test]
50
50
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
+ } ;
56
58
57
59
let filter = Filter :: new ( & config) ;
58
60
assert_eq ! ( filter. program_ignores. len( ) , 2 ) ;
Original file line number Diff line number Diff line change 28
28
pub struct KafkaPlugin {
29
29
publisher : Option < Publisher > ,
30
30
filter : Option < Filter > ,
31
+ publish_all_accounts : bool ,
31
32
}
32
33
33
34
impl Debug for KafkaPlugin {
@@ -54,6 +55,7 @@ impl AccountsDbPlugin for KafkaPlugin {
54
55
config_file
55
56
) ;
56
57
let config = Config :: read_from ( config_file) ?;
58
+ self . publish_all_accounts = config. publish_all_accounts ;
57
59
58
60
let ( version_n, version_s) = get_rdkafka_version ( ) ;
59
61
info ! ( "rd_kafka_version: {:#08x}, {}" , version_n, version_s) ;
@@ -82,7 +84,7 @@ impl AccountsDbPlugin for KafkaPlugin {
82
84
slot : u64 ,
83
85
is_startup : bool ,
84
86
) -> PluginResult < ( ) > {
85
- if is_startup {
87
+ if is_startup && ! self . publish_all_accounts {
86
88
return Ok ( ( ) ) ;
87
89
}
88
90
You can’t perform that action at this time.
0 commit comments