mirror of
https://github.com/fluencelabs/tendermint
synced 2025-05-21 10:41:18 +00:00
wire: no codec yet
This commit is contained in:
parent
085b4f5f2e
commit
fc35e3b8c5
18
wire/wire.go
18
wire/wire.go
@ -1,38 +1,43 @@
|
|||||||
package wire
|
package wire
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/tendermint/go-crypto"
|
|
||||||
"github.com/tendermint/go-wire"
|
"github.com/tendermint/go-wire"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
/*
|
||||||
// Expose access to a global wire codec
|
// Expose access to a global wire codec
|
||||||
// TODO: maybe introduce some Context object
|
// TODO: maybe introduce some Context object
|
||||||
// containing logger, config, codec that can
|
// containing logger, config, codec that can
|
||||||
// be threaded through everything to avoid this global
|
// be threaded through everything to avoid this global
|
||||||
|
|
||||||
var cdc *wire.Codec
|
var cdc *wire.Codec
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
cdc = wire.NewCodec()
|
cdc = wire.NewCodec()
|
||||||
crypto.RegisterWire(cdc)
|
crypto.RegisterWire(cdc)
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Just a flow through to go-wire.
|
||||||
|
// To be used later for the global codec
|
||||||
|
|
||||||
func MarshalBinary(o interface{}) ([]byte, error) {
|
func MarshalBinary(o interface{}) ([]byte, error) {
|
||||||
return cdc.MarshalBinary(o)
|
return wire.MarshalBinary(o)
|
||||||
}
|
}
|
||||||
|
|
||||||
func UnmarshalBinary(bz []byte, ptr interface{}) error {
|
func UnmarshalBinary(bz []byte, ptr interface{}) error {
|
||||||
return cdc.UnmarshalBinary(bz, ptr)
|
return wire.UnmarshalBinary(bz, ptr)
|
||||||
}
|
}
|
||||||
|
|
||||||
func MarshalJSON(o interface{}) ([]byte, error) {
|
func MarshalJSON(o interface{}) ([]byte, error) {
|
||||||
return cdc.MarshalJSON(o)
|
return wire.MarshalJSON(o)
|
||||||
}
|
}
|
||||||
|
|
||||||
func UnmarshalJSON(jsonBz []byte, ptr interface{}) error {
|
func UnmarshalJSON(jsonBz []byte, ptr interface{}) error {
|
||||||
return cdc.UnmarshalJSON(jsonBz, ptr)
|
return wire.UnmarshalJSON(jsonBz, ptr)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
|
||||||
func RegisterInterface(ptr interface{}, opts *wire.InterfaceOptions) {
|
func RegisterInterface(ptr interface{}, opts *wire.InterfaceOptions) {
|
||||||
cdc.RegisterInterface(ptr, opts)
|
cdc.RegisterInterface(ptr, opts)
|
||||||
}
|
}
|
||||||
@ -44,3 +49,4 @@ func RegisterConcrete(o interface{}, name string, opts *wire.ConcreteOptions) {
|
|||||||
//-------------------------------
|
//-------------------------------
|
||||||
|
|
||||||
const RFC3339Millis = wire.RFC3339Millis
|
const RFC3339Millis = wire.RFC3339Millis
|
||||||
|
*/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user