-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtypes.go
More file actions
31 lines (27 loc) · 970 Bytes
/
types.go
File metadata and controls
31 lines (27 loc) · 970 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package introspection
import "time"
// StateChange represents a typed state transition.
// The generic parameter S allows type-safe access to state without assertions.
type StateChange[S any] struct {
ComponentID string
ComponentType string // Component type identifier (e.g., "processor", "controller", "manager")
OldState S
NewState S
Timestamp time.Time
}
// StateSnapshot is the envelope for cross-domain aggregation.
// It unifies different state types via a common wrapper.
type StateSnapshot struct {
ComponentID string
ComponentType string // Component type identifier (e.g., "processor", "controller", "manager")
Timestamp time.Time
Payload any // Component state as any type
}
// ComponentEvent is the interface for event sourcing.
// Every event must provide identification and timing metadata.
type ComponentEvent interface {
ComponentID() string
ComponentType() string
Timestamp() time.Time
EventType() string
}