packagemasterimport"sync"// InMemStore is an in memory implementation of Store interface.//// It does not tolerate the fault that casues the program to crash.typeInMemStorestruct{musync.Mutexbuf[]byte}// Save saves the state into the in-memory store.func(m*InMemStore)Save(state[]byte)error{m.mu.Lock()deferm.mu.Unlock()m.buf=statereturnnil}// Load loads the state from the in-memory store.func(m*InMemStore)Load()([]byte,error){m.mu.Lock()deferm.mu.Unlock()returnm.buf,nil}