-
Notifications
You must be signed in to change notification settings - Fork 86
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move event struct into separate file.
- Loading branch information
Showing
3 changed files
with
39 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package models | ||
|
||
import "time" | ||
|
||
// EventTopic is a high level categorisation that can be applied to an event. It | ||
// should be a human-readable string with no dynamic content. They are used to | ||
// disambiguate events from the same component occurring in different contexts. | ||
// For example, an event emitted by S3 storage used as an input source and the | ||
// same event emitted by S3 storage used as a publisher would be tagged with | ||
// different topics. | ||
// | ||
// EventTopics do not need to conform to a centralized list – each module should | ||
// use event topics that make sense for their own logic. Event topics SHOULD be | ||
// unique. | ||
type EventTopic string | ||
|
||
// Event represents a progress report made by the system in its attempt to run a | ||
// job. Events are generated by the orchestrator and also passed back to the | ||
// orchestrator from the compute node. | ||
// | ||
// Events may be delivered in an async fashion – i.e, they may arrive much later | ||
// than the moment they occurred. | ||
type Event struct { | ||
// A human-readable string giving the user all the information they need to | ||
// understand and respond to an Event, if a response is required. | ||
Message string `json:"Message"` | ||
|
||
// The topic of the event. See the documentation on EventTopic. | ||
Topic EventTopic `json:"Topic"` | ||
|
||
// The moment the event occurred, which may be different to the moment it | ||
// was recorded. | ||
Timestamp time.Time `json:"Timestamp"` | ||
|
||
// Any additional metadata that the system or user may need to know about | ||
// the event in order to handle it properly. | ||
Details map[string]string `json:"Details,omitempty"` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters