Implement store.Push(k, op)
parent
caa0a8e0fa
commit
d3ef13c4b4
Binary file not shown.
|
|
@ -10,6 +10,16 @@ func NewStore() *Store {
|
||||||
return &store
|
return &store
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (store *Store) Push(k string, op Event) {
|
||||||
|
event, ok := store.Get(k)
|
||||||
|
if ok {
|
||||||
|
event = event.Push(op)
|
||||||
|
} else {
|
||||||
|
event = op
|
||||||
|
}
|
||||||
|
store.Set(k, event)
|
||||||
|
}
|
||||||
|
|
||||||
func (store *Store) Set(k string, v Event) {
|
func (store *Store) Set(k string, v Event) {
|
||||||
(*sync.Map)(store).Store(k, v)
|
(*sync.Map)(store).Store(k, v)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue