Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Event ¶
type Event struct {
Timestamp time.Time // when it happened
Type EventType // what kind of event
HeartbeatID string // which heartbeat this belongs to
Source string // e.g. remote address
Method string // HTTP method, if relevant
UserAgent string // user-agent, if relevant
PrevState string // prior state (for state changes)
NewState string // new state (for state changes)
Payload any // payload for notification events
}
Event is a generic record of something that happened.
type EventType ¶
type EventType string
EventType categorizes what happened.
const ( EventTypeHeartbeatReceived EventType = "HeartbeatReceived" // EventTypeHeartbeatReceived is a ping from a client. EventTypeHeartbeatFailed EventType = "HeartbeatFailed" // EventTypeHeartbeatFailed is a manual failure. EventTypeStateChanged EventType = "StateChanged" // EventTypeStateChanged is when an Actor’s state changes. EventTypeNotificationSent EventType = "NotificationSent" // EventTypeNotificationSent is when a notification is dispatched. EventTypeNotificationFailed EventType = "NotificationFailed" // EventTypeNotificationFailed is when a notification fails to dispatch. )
type RingStore ¶
type RingStore struct {
// contains filtered or unexported fields
}
RingStore is a fixed-size circular buffer of history.Event. When full, new events overwrite the oldest one.
func NewRingStore ¶
NewRingStore returns a RingStore that holds at most maxEvents.
func (*RingStore) GetEvents ¶
GetEvents returns all events oldest-first. If the buffer has never wrapped, that's just buf[:next]. Once wrapped, we stitch buf[next:] before buf[:next].
func (*RingStore) GetEventsByID ¶
GetEventsByID returns only those events for the given heartbeat ID, still in chronological (oldest-first) order.
type Store ¶
type Store interface {
// RecordEvent appends a new event to history.
RecordEvent(ctx context.Context, e Event) error
// GetEvents returns a snapshot of all recorded events.
GetEvents() []Event
// GetEventsByID returns all events recorded for the specified heartbeat ID.
GetEventsByID(id string) []Event
}
Store records and exposes all system events.
Click to show internal directories.
Click to hide internal directories.