package memory import ( "context" "github.com/abelith/gomax/state" "sync" ) type FSMStorage struct { m sync.Map } type EventIsolation struct{} func NewMemoryFSMStorage() *FSMStorage { return &FSMStorage{} } func (f *FSMStorage) Get(_ context.Context, userID int) (state.Snapshot, error) { st, ok := f.m.Load(userID) if !ok { return state.Snapshot{}, state.ErrStateNotFound } return st.(state.Snapshot), nil } func (f *FSMStorage) Put(_ context.Context, snapshot state.Snapshot) error { f.m.Store(snapshot.ID, snapshot) return nil } func (f *FSMStorage) Delete(_ context.Context, userID int) error { f.m.Delete(userID) return nil } func NewMemoryEventIsolation() *EventIsolation { return &EventIsolation{} }