2018-02-06 06:43:32 +00:00
|
|
|
package core
|
|
|
|
|
2018-03-09 15:55:25 +00:00
|
|
|
// MemoryStore is an in memory implementation of a BlockChainStorer
|
|
|
|
// that should only be used for testing.
|
2018-02-06 06:43:32 +00:00
|
|
|
type MemoryStore struct {
|
|
|
|
}
|
|
|
|
|
|
|
|
// NewMemoryStore returns a pointer to a MemoryStore object.
|
|
|
|
func NewMemoryStore() *MemoryStore {
|
|
|
|
return &MemoryStore{}
|
|
|
|
}
|
|
|
|
|
|
|
|
func (m *MemoryStore) write(key, value []byte) error {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (m *MemoryStore) writeBatch(batch Batch) error {
|
2018-03-09 15:55:25 +00:00
|
|
|
for k, v := range batch {
|
|
|
|
if err := m.write(*k, v); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
}
|
2018-02-06 06:43:32 +00:00
|
|
|
return nil
|
|
|
|
}
|