@@ -28,37 +28,22 @@ use {
2828} ;
2929
3030/// Plugin config.
31- #[ derive( Deserialize ) ]
31+ #[ derive( Debug , Deserialize ) ]
32+ #[ serde( deny_unknown_fields) ]
3233pub struct Config {
34+ #[ allow( dead_code) ]
35+ libpath : String ,
36+
3337 /// Kafka config.
3438 pub kafka : HashMap < String , String > ,
39+
3540 /// Graceful shutdown timeout.
3641 #[ serde( default ) ]
3742 pub shutdown_timeout_ms : u64 ,
38- /// Kafka topic to send account updates to.
39- #[ serde( default ) ]
40- pub update_account_topic : String ,
41- /// Kafka topic to send slot status updates to.
42- #[ serde( default ) ]
43- pub slot_status_topic : String ,
44- /// Kafka topic to send transaction to.
45- #[ serde( default ) ]
46- pub transaction_topic : String ,
47- /// List of programs to ignore.
48- #[ serde( default ) ]
49- pub program_ignores : Vec < String > ,
50- /// List of programs to include
51- #[ serde( default ) ]
52- pub program_filters : Vec < String > ,
53- // List of accounts to include
54- #[ serde( default ) ]
55- pub account_filters : Vec < String > ,
56- /// Publish all accounts on startup.
57- #[ serde( default ) ]
58- pub publish_all_accounts : bool ,
59- /// Wrap all event message in a single message type.
60- #[ serde( default ) ]
61- pub wrap_messages : bool ,
43+
44+ /// Accounts, transactions filters
45+ pub filters : Vec < ConfigFilter > ,
46+
6247 /// Prometheus endpoint.
6348 #[ serde( default ) ]
6449 pub prometheus : Option < SocketAddr > ,
@@ -67,16 +52,10 @@ pub struct Config {
6752impl Default for Config {
6853 fn default ( ) -> Self {
6954 Self {
55+ libpath : "" . to_owned ( ) ,
7056 kafka : HashMap :: new ( ) ,
7157 shutdown_timeout_ms : 30_000 ,
72- update_account_topic : "" . to_owned ( ) ,
73- slot_status_topic : "" . to_owned ( ) ,
74- transaction_topic : "" . to_owned ( ) ,
75- program_ignores : Vec :: new ( ) ,
76- program_filters : Vec :: new ( ) ,
77- account_filters : Vec :: new ( ) ,
78- publish_all_accounts : false ,
79- wrap_messages : false ,
58+ filters : vec ! [ ] ,
8059 prometheus : None ,
8160 }
8261 }
@@ -119,4 +98,47 @@ impl Config {
11998 }
12099}
121100
101+ /// Plugin config.
102+ #[ derive( Debug , Deserialize ) ]
103+ #[ serde( deny_unknown_fields, default ) ]
104+ pub struct ConfigFilter {
105+ /// Kafka topic to send account updates to.
106+ pub update_account_topic : String ,
107+ /// Kafka topic to send slot status updates to.
108+ pub slot_status_topic : String ,
109+ /// Kafka topic to send transaction to.
110+ pub transaction_topic : String ,
111+ /// List of programs to ignore.
112+ pub program_ignores : Vec < String > ,
113+ /// List of programs to include
114+ pub program_filters : Vec < String > ,
115+ // List of accounts to include
116+ pub account_filters : Vec < String > ,
117+ /// Publish all accounts on startup.
118+ pub publish_all_accounts : bool ,
119+ /// Publish vote transactions.
120+ pub include_vote_transactions : bool ,
121+ /// Publish failed transactions.
122+ pub include_failed_transactions : bool ,
123+ /// Wrap all event message in a single message type.
124+ pub wrap_messages : bool ,
125+ }
126+
127+ impl Default for ConfigFilter {
128+ fn default ( ) -> Self {
129+ Self {
130+ update_account_topic : "" . to_owned ( ) ,
131+ slot_status_topic : "" . to_owned ( ) ,
132+ transaction_topic : "" . to_owned ( ) ,
133+ program_ignores : Vec :: new ( ) ,
134+ program_filters : Vec :: new ( ) ,
135+ account_filters : Vec :: new ( ) ,
136+ publish_all_accounts : false ,
137+ include_vote_transactions : true ,
138+ include_failed_transactions : true ,
139+ wrap_messages : false ,
140+ }
141+ }
142+ }
143+
122144pub type Producer = ThreadedProducer < DefaultProducerContext > ;
0 commit comments