erigon-pulse/ethdb/cbor/marshal.go
Alex Sharov 331dcd45eb
Store receipts separately - one record per tx (#1271)
* squash

* add --database flag to integration

* clean

* split to 2 buckets

* split to 2 buckets

* split to 2 buckets

* split to 2 buckets

* split to 2 buckets

* save progress

* save progress

* improve test

* improve test

* save progress

* change app logic

* change app logic

* return err from rawdb package

* don't clean automatically

* don't clean automatically

* clean

* clean

* clean

* don't rely on `make clean`

* improve cbor code

* clean

* clean

* clean

* fix tests

* rebase master

* stop on error: headers stage

* make TxDb walk and multiwalk safe

* Fix panics

Co-authored-by: Alexey Akhunov <akhounov@gmail.com>
2020-10-25 08:38:55 +00:00

34 lines
525 B
Go

package cbor
import (
"io"
)
func Marshal(dst io.Writer, v interface{}) error {
e := Encoder(dst)
err := e.Encode(v)
returnEncoderToPool(e)
return err
}
func Unmarshal(dst interface{}, data io.Reader) error {
d := Decoder(data)
err := d.Decode(dst)
returnDecoderToPool(d)
return err
}
func MustMarshal(dst io.Writer, v interface{}) {
err := Marshal(dst, v)
if err != nil {
panic(err)
}
}
func MustUnmarshal(dst interface{}, data io.Reader) {
err := Unmarshal(dst, data)
if err != nil {
panic(err)
}
}