mock cache-service oplog truncation functionality

This commit is contained in:
Bel LaPointe
2023-10-11 16:28:15 -06:00
parent 49cd477db0
commit 1a1640b772
4 changed files with 25 additions and 6 deletions

View File

@@ -10,6 +10,16 @@ func NewStore() *Store {
return &store
}
// todo pass context.context and failfast
func (store *Store) Dump() []Event {
result := make([]Event, 0)
(*sync.Map)(store).Range(func(_, v any) bool {
result = append(result, v.(Event))
return true
})
return result
}
func (store *Store) Push(op Event) {
k := op.ID
event, ok := store.Get(k)