-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathentity.go
More file actions
27 lines (21 loc) · 933 Bytes
/
entity.go
File metadata and controls
27 lines (21 loc) · 933 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
package core
// Client represents any API client that entities can use
// This allows the core to be generic while agents provide their specific client type
type Client interface{}
// Entity defines the interface for all entities that can be refreshed
type Entity interface {
// Name returns the unique name of the entity
Name() string
// Refresh retrieves the latest data for this entity
// The client parameter will be cast to the specific client type by the entity implementation
Refresh(client Client) (interface{}, error)
// Save saves the entity data to the state manager
Save(stateManager StateManager, data interface{}) error
}
// StateManager defines the interface for state management
type StateManager interface {
// SaveEntity saves entity data with timestamped and latest versions
SaveEntity(entityName string, data interface{}) error
// Stop stops the state manager (cleanup goroutines, etc.)
Stop()
}