iop/packages/events/events.go
toki cf3760f394 feat: console emitter interface, persistent status, and profile proto message updates
- Add console emitter interface for event-driven console output
- Implement persistent cancel reason and explicit completion tracking
- Add profile proto message definitions
- Update edge and node transport layers with adapter execution terminology
- Add new packages/events module
- Update architecture documentation and README files
2026-05-16 21:16:48 +09:00

36 lines
788 B
Go

package events
import (
"time"
"github.com/google/uuid"
iop "iop/proto/gen/iop"
)
const (
SourceEdge = "edge"
SourceNode = "node"
TypeNodeConnected = "node.connected"
TypeNodeDisconnected = "node.disconnected"
TypeEdgeDisconnected = "edge.disconnected"
ReasonRegistered = "registered"
ReasonTransportClosed = "transport_closed"
ReasonLocalShutdown = "local_shutdown"
ReasonEdgeShutdown = "edge_shutdown"
)
func NewEdgeNodeEvent(source, eventType, nodeID, alias, reason string, metadata map[string]string) *iop.EdgeNodeEvent {
return &iop.EdgeNodeEvent{
EventId: uuid.NewString(),
Type: eventType,
Source: source,
NodeId: nodeID,
Alias: alias,
Reason: reason,
Metadata: metadata,
Timestamp: time.Now().UnixNano(),
}
}