tendermint/wire/wire.go

53 lines
1.1 KiB
Go
Raw Normal View History

2018-02-15 14:26:09 -05:00
package wire
import (
"github.com/tendermint/go-wire"
)
2018-03-02 01:27:52 -05:00
/*
2018-02-15 14:26:09 -05:00
// Expose access to a global wire codec
// TODO: maybe introduce some Context object
// containing logger, config, codec that can
// be threaded through everything to avoid this global
var cdc *wire.Codec
func init() {
cdc = wire.NewCodec()
crypto.RegisterWire(cdc)
}
2018-03-02 01:27:52 -05:00
*/
// Just a flow through to go-wire.
// To be used later for the global codec
2018-02-15 14:26:09 -05:00
func MarshalBinary(o interface{}) ([]byte, error) {
2018-03-02 01:27:52 -05:00
return wire.MarshalBinary(o)
2018-02-15 14:26:09 -05:00
}
func UnmarshalBinary(bz []byte, ptr interface{}) error {
2018-03-02 01:27:52 -05:00
return wire.UnmarshalBinary(bz, ptr)
2018-02-15 14:26:09 -05:00
}
func MarshalJSON(o interface{}) ([]byte, error) {
2018-03-02 01:27:52 -05:00
return wire.MarshalJSON(o)
2018-02-15 14:26:09 -05:00
}
func UnmarshalJSON(jsonBz []byte, ptr interface{}) error {
2018-03-02 01:27:52 -05:00
return wire.UnmarshalJSON(jsonBz, ptr)
2018-02-15 14:26:09 -05:00
}
2018-03-02 01:27:52 -05:00
/*
2018-02-15 14:26:09 -05:00
func RegisterInterface(ptr interface{}, opts *wire.InterfaceOptions) {
cdc.RegisterInterface(ptr, opts)
}
func RegisterConcrete(o interface{}, name string, opts *wire.ConcreteOptions) {
cdc.RegisterConcrete(o, name, opts)
}
//-------------------------------
const RFC3339Millis = wire.RFC3339Millis
2018-03-02 01:27:52 -05:00
*/