eventsource.go 1017 B

123456789101112131415161718192021222324252627282930
  1. /*
  2. * Brawler
  3. *
  4. * Copyright 2019 Matthias Ladkau. All rights reserved.
  5. *
  6. * This Source Code Form is subject to the terms of the MIT
  7. * License, If a copy of the MIT License was not distributed with this
  8. * file, You can obtain one at https://opensource.org/licenses/MIT.
  9. */
  10. package brawler
  11. /*
  12. EventPublisher is the API for external event sources to publish events
  13. to Brawler engines. The event source should use a given EventPublisher
  14. object to inject events. Use api.RegisterEventSource to create a new
  15. EventPublisher object.
  16. */
  17. type EventPublisher interface {
  18. /*
  19. AddEvent adds a new event to one or more Brawler engines.
  20. Expects 3 parameters: Name - a name which identifies the event,
  21. Kind - an event kind which is checked against the kind match of
  22. sinks and State - an event state which contains additional data.
  23. All of the given parameter will be accessible from Rumble if
  24. the event triggers a Rumble sink.
  25. */
  26. AddEvent(name string, kind []string, state map[interface{}]interface{}) error
  27. }