From 3de73c53cb8873ffe1dbe1e0e2bde4d0d3df072d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20Kripalani?= Date: Wed, 20 May 2020 13:09:07 +0100 Subject: [PATCH] events: add a generic DHT event. --- event/dht.go | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 event/dht.go diff --git a/event/dht.go b/event/dht.go new file mode 100644 index 00000000..e01953f1 --- /dev/null +++ b/event/dht.go @@ -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 +}