github.com/sberex/go-sberex@v1.8.2-0.20181113200658-ed96ac38f7d7/p2p/simulations/adapters/state.go (about) 1 // This file is part of the go-sberex library. The go-sberex library is 2 // free software: you can redistribute it and/or modify it under the terms 3 // of the GNU Lesser General Public License as published by the Free 4 // Software Foundation, either version 3 of the License, or (at your option) 5 // any later version. 6 // 7 // The go-sberex library is distributed in the hope that it will be useful, 8 // but WITHOUT ANY WARRANTY; without even the implied warranty of 9 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 10 // General Public License <http://www.gnu.org/licenses/> for more details. 11 12 package adapters 13 14 type SimStateStore struct { 15 m map[string][]byte 16 } 17 18 func (self *SimStateStore) Load(s string) ([]byte, error) { 19 return self.m[s], nil 20 } 21 22 func (self *SimStateStore) Save(s string, data []byte) error { 23 self.m[s] = data 24 return nil 25 } 26 27 func NewSimStateStore() *SimStateStore { 28 return &SimStateStore{ 29 make(map[string][]byte), 30 } 31 }