forked from MFALHI/netplugin
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstate.go
More file actions
25 lines (22 loc) · 750 Bytes
/
state.go
File metadata and controls
25 lines (22 loc) · 750 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
package core
// State identifies data uniquely identifiable by 'id' and stored in a
// (distributed) key-value store implemented by core.StateDriver.
type State interface {
Read(id string) error
ReadAll() ([]State, error)
Write() error
Clear() error
}
// WatchableState allows for the rest of core.State, plus the WatchAll call
// which allows the implementor to yield changes to a channel.
type WatchableState interface {
State
WatchAll(rsps chan WatchState) error
}
// CommonState defines the fields common to all core.State implementations.
// This struct shall be embedded as anonymous field in all structs that
// implement core.State
type CommonState struct {
StateDriver StateDriver `json:"-"`
ID string `json:"id"`
}