Init is an exported method to allow initializing exclusion maps from external modules.
()
| 151 | |
| 152 | // Init is an exported method to allow initializing exclusion maps from external modules. |
| 153 | func (c *EventSourceConfig) Init() { |
| 154 | c.excludedImages = make(map[string]bool) |
| 155 | |
| 156 | if c.dropMasks == nil { |
| 157 | c.dropMasks = bitmask.New() |
| 158 | } |
| 159 | for _, name := range c.ExcludedEvents { |
| 160 | for _, typ := range event.NameToTypes(name) { |
| 161 | if typ != event.UnknownType { |
| 162 | c.dropMasks.Set(typ.ID()) |
| 163 | } |
| 164 | } |
| 165 | } |
| 166 | |
| 167 | for _, name := range c.ExcludedImages { |
| 168 | c.excludedImages[name] = true |
| 169 | } |
| 170 | |
| 171 | if c.allMasks == nil { |
| 172 | c.allMasks = bitmask.New() |
| 173 | } |
| 174 | for _, typ := range event.AllWithState() { |
| 175 | c.allMasks.Set(typ.ID()) |
| 176 | } |
| 177 | } |
| 178 | |
| 179 | // SetDropMask inserts the event mask in the bitset to |
| 180 | // instruct the given event type should be dropped from |