Skip to content
This repository has been archived by the owner on Nov 8, 2022. It is now read-only.
/ gomit Public archive

Gomit provides facilities for defining, emitting, and handling events within a go program.

License

Notifications You must be signed in to change notification settings

intelsdi-x/gomit

Repository files navigation

DISCONTINUATION OF PROJECT.

This project will no longer be maintained by Intel.

This project has been identified as having known security escapes.

Intel has ceased development and contributions including, but not limited to, maintenance, bug fixes, new releases, or updates, to this project.

Intel no longer accepts patches to this project.

GoMit

Build Status

GoMit (short for "go emit") provides facilities for defining, emitting, and handling events within a Go program. It's used in Snap to simplify event handling. It's core principles are:

  • Speed over abstraction
  • No order guarantees
  • No persistence

Using GoMit

With Go installed, you can go get it:

$ go get -d github.com/intelsdi-x/gomit

Examples

From gomit_test.go:

type MockEventBody struct {
}

type MockThing struct {
	LastNamespace string
}

func (m *MockEventBody) Namespace() string {
	return "Mock.Event"
}
//create a function to handle the gomit event
func (m *MockThing) HandleGomitEvent(e Event) {
	m.LastNamespace = e.Namespace()
}

//create an event controller
event_controller := new(EventController)
//add registration to handler
mt := new(MockThing)
event_controller.RegisterHandler("m1", mt)
//emit event
eb := new(MockEventBody)
i, e := event_controller.Emit(eb)
//unregister handler
event_controller.UnregisterHandler("m1")
//check if handler is registered
b := event_controller.IsHandlerRegistered("m1")

Roadmap

GoMit does all we need it to do and we plan to keep it that simple. If you find a bug in your own usage, please let us know through an Issue.

Maintainers

The maintainers for GoMit are the same as Snap.

License

GoMit is an Open Source software released under the Apache 2.0 License.

About

Gomit provides facilities for defining, emitting, and handling events within a go program.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages