2020-06-02 22:37:10 +00:00
|
|
|
package state
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/hashicorp/consul/agent/consul/stream"
|
|
|
|
)
|
|
|
|
|
2020-06-17 22:15:45 +00:00
|
|
|
// newTopicHandlers returns the default handlers for state change events.
|
2020-07-06 18:24:30 +00:00
|
|
|
func newTopicHandlers() map[stream.Topic]TopicHandler {
|
|
|
|
return map[stream.Topic]TopicHandler{
|
2020-06-02 22:37:10 +00:00
|
|
|
// For now we don't actually support subscribing to ACL* topics externally
|
|
|
|
// so these have no Snapshot methods yet. We do need to have a
|
|
|
|
// ProcessChanges func to publish the partial events on ACL changes though
|
|
|
|
// so that we can invalidate other subscriptions if their effective ACL
|
|
|
|
// permissions change.
|
2020-06-17 22:15:45 +00:00
|
|
|
stream.Topic_ACLTokens: {
|
2020-06-15 22:49:00 +00:00
|
|
|
ProcessChanges: aclEventsFromChanges,
|
2020-06-02 22:37:10 +00:00
|
|
|
},
|
|
|
|
// Note no ACLPolicies/ACLRoles defined yet because we publish all events
|
|
|
|
// from one handler to save on iterating/filtering and duplicating code and
|
|
|
|
// there are no snapshots for these yet per comment above.
|
|
|
|
}
|
|
|
|
}
|