master
go 41 lines 1.56 KB
Raw
1 package config
2
3 const (
4 // LastSeenMessagesStrategy is a strategy that calculates the TTL countdown
5 // based on the last time a Pubsub message is seen. This means that if a message
6 // is received and then seen again within the specified TTL window, it
7 // won't be emitted until the TTL countdown expires from the last time the
8 // message was seen.
9 LastSeenMessagesStrategy = "last-seen"
10
11 // FirstSeenMessagesStrategy is a strategy that calculates the TTL
12 // countdown based on the first time a Pubsub message is seen. This means that if
13 // a message is received and then seen again within the specified TTL
14 // window, it won't be emitted.
15 FirstSeenMessagesStrategy = "first-seen"
16
17 // DefaultSeenMessagesStrategy is the strategy that is used by default if
18 // no Pubsub.SeenMessagesStrategy is specified.
19 DefaultSeenMessagesStrategy = LastSeenMessagesStrategy
20 )
21
22 type PubsubConfig struct {
23 // Router can be either floodsub (legacy) or gossipsub (new and
24 // backwards compatible).
25 Router string
26
27 // DisableSigning disables message signing. Message signing is *enabled*
28 // by default.
29 DisableSigning bool
30
31 // Enable pubsub (--enable-pubsub-experiment)
32 Enabled Flag `json:",omitempty"`
33
34 // SeenMessagesTTL is a value that controls the time window within which
35 // duplicate messages will be identified and won't be emitted.
36 SeenMessagesTTL *OptionalDuration `json:",omitempty"`
37
38 // SeenMessagesStrategy is a setting that determines how the time-to-live
39 // (TTL) countdown for deduplicating messages is calculated.
40 SeenMessagesStrategy *OptionalString `json:",omitempty"`
41 }