| Index: impl/memory/datastore_data.go
|
| diff --git a/impl/memory/datastore_data.go b/impl/memory/datastore_data.go
|
| index 5ef87530ded64c4c31f367bb859d3f87c43b8d7b..2bfc13256f25f08eb97d833be1697c0e02f7090c 100644
|
| --- a/impl/memory/datastore_data.go
|
| +++ b/impl/memory/datastore_data.go
|
| @@ -98,14 +98,14 @@ func curVersion(ents *memCollection, key []byte) int64 {
|
| if ents != nil {
|
| if v := ents.Get(key); v != nil {
|
| pm, err := rpm(v)
|
| - if err != nil {
|
| - panic(err) // memory corruption
|
| - }
|
| + memoryCorruption(err)
|
| +
|
| pl, ok := pm["__version__"]
|
| if ok && len(pl) > 0 && pl[0].Type() == ds.PTInt {
|
| return pl[0].Value().(int64)
|
| }
|
| - panic(fmt.Errorf("__version__ property missing or wrong: %v", pm))
|
| +
|
| + memoryCorruption(fmt.Errorf("__version__ property missing or wrong: %v", pm))
|
| }
|
| }
|
| return 0
|
| @@ -247,9 +247,7 @@ func (d *dataStoreData) canApplyTxn(obj memContextObj) bool {
|
| continue
|
| }
|
| k, err := serialize.ReadKey(bytes.NewBufferString(rk), serialize.WithContext, "", "")
|
| - if err != nil {
|
| - panic(err)
|
| - }
|
| + memoryCorruption(err)
|
|
|
| entKey := "ents:" + k.Namespace()
|
| mkey := groupMetaKey(k)
|
| @@ -281,10 +279,7 @@ func (d *dataStoreData) applyTxn(c context.Context, obj memContextObj) {
|
| d.putMulti([]ds.Key{m.key}, []ds.PropertyMap{m.data},
|
| func(_ ds.Key, e error) { err = e })
|
| }
|
| - err = errors.SingleError(err)
|
| - if err != nil {
|
| - panic(err)
|
| - }
|
| + impossible(err)
|
| }
|
| }
|
| }
|
| @@ -338,10 +333,11 @@ func (td *txnDataStoreData) endTxn() {
|
| atomic.StoreInt32(&td.closed, 1)
|
| }
|
| func (*txnDataStoreData) applyTxn(context.Context, memContextObj) {
|
| - panic("txnDataStoreData cannot apply transactions")
|
| + impossible(fmt.Errorf("cannot creat a recursive transaction"))
|
| }
|
| func (*txnDataStoreData) mkTxn(*ds.TransactionOptions) memContextObj {
|
| - panic("impossible")
|
| + impossible(fmt.Errorf("cannot creat a recursive transaction"))
|
| + return nil
|
| }
|
|
|
| func (td *txnDataStoreData) run(f func() error) error {
|
|
|