tendermint/wire/wire.go

61 lines
1.3 KiB
Go
Raw Normal View History

2018-02-15 11:26:09 -08:00
package wire
import (
"github.com/tendermint/go-wire"
)
2018-03-01 22:27:52 -08:00
/*
2018-02-15 11:26:09 -08: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-01 22:27:52 -08:00
*/
// Just a flow through to go-wire.
// To be used later for the global codec
2018-02-15 11:26:09 -08:00
func MarshalBinary(o interface{}) ([]byte, error) {
2018-03-01 22:27:52 -08:00
return wire.MarshalBinary(o)
2018-02-15 11:26:09 -08:00
}
func UnmarshalBinary(bz []byte, ptr interface{}) error {
2018-03-01 22:27:52 -08:00
return wire.UnmarshalBinary(bz, ptr)
2018-02-15 11:26:09 -08:00
}
func MarshalJSON(o interface{}) ([]byte, error) {
2018-03-01 22:27:52 -08:00
return wire.MarshalJSON(o)
2018-02-15 11:26:09 -08:00
}
func UnmarshalJSON(jsonBz []byte, ptr interface{}) error {
2018-03-01 22:27:52 -08:00
return wire.UnmarshalJSON(jsonBz, ptr)
2018-02-15 11:26:09 -08:00
}
2018-03-01 22:33:38 -08:00
type ConcreteType = wire.ConcreteType
func RegisterInterface(o interface{}, ctypes ...ConcreteType) *wire.TypeInfo {
return wire.RegisterInterface(o, ctypes...)
}
const RFC3339Millis = wire.RFC3339Millis
2018-03-01 22:27:52 -08:00
/*
2018-02-15 11:26:09 -08: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-01 22:27:52 -08:00
*/