events: add a generic DHT event. (#154)

This commit is contained in:
Raúl Kripalani 2020-05-20 13:12:54 +01:00 committed by GitHub
parent acf0d3d15a
commit 30bf48c8d6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

21
event/dht.go Normal file
View File

@ -0,0 +1,21 @@
package event
// RawJSON is a type that contains a raw JSON string.
type RawJSON string
// GenericDHTEvent is a type that encapsulates an actual DHT event by carrying
// its raw JSON.
//
// Context: the DHT event system is rather bespoke and a bit messy at the time,
// so until we unify/clean that up, this event bridges the gap. It should only
// be consumed for informational purposes.
//
// EXPERIMENTAL: this will likely be removed if/when the DHT event types are
// hoisted to core, and the DHT event system is reconciled with the eventbus.
type GenericDHTEvent struct {
// Type is the type of the DHT event that occured.
Type string
// Raw is the raw JSON representation of the event payload.
Raw RawJSON
}