@@ -28,37 +28,22 @@ use {
28
28
} ;
29
29
30
30
/// Plugin config.
31
- #[ derive( Deserialize ) ]
31
+ #[ derive( Debug , Deserialize ) ]
32
+ #[ serde( deny_unknown_fields) ]
32
33
pub struct Config {
34
+ #[ allow( dead_code) ]
35
+ libpath : String ,
36
+
33
37
/// Kafka config.
34
38
pub kafka : HashMap < String , String > ,
39
+
35
40
/// Graceful shutdown timeout.
36
41
#[ serde( default ) ]
37
42
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
+
62
47
/// Prometheus endpoint.
63
48
#[ serde( default ) ]
64
49
pub prometheus : Option < SocketAddr > ,
@@ -67,16 +52,10 @@ pub struct Config {
67
52
impl Default for Config {
68
53
fn default ( ) -> Self {
69
54
Self {
55
+ libpath : "" . to_owned ( ) ,
70
56
kafka : HashMap :: new ( ) ,
71
57
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 ! [ ] ,
80
59
prometheus : None ,
81
60
}
82
61
}
@@ -119,4 +98,47 @@ impl Config {
119
98
}
120
99
}
121
100
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
+
122
144
pub type Producer = ThreadedProducer < DefaultProducerContext > ;
0 commit comments