encoding

package
v0.34.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 23, 2021 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const GRPCCodecName = "gogo"

Variables

View Source
var (
	ErrInvalidLengthEncoding        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowEncoding          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupEncoding = fmt.Errorf("proto: unexpected end of group")
)

Functions

func Decode

func Decode(bs []byte, msg proto.Message) error

Single shot decoding

func Encode

func Encode(msg proto.Message) ([]byte, error)

Single shot encoding

func GRPCDial

func GRPCDial(grpcAddress string, additionalOpts ...grpc.DialOption) (*grpc.ClientConn, error)

func GRPCDialContext

func GRPCDialContext(ctx context.Context, grpcAddress string, additionalOpts ...grpc.DialOption) (*grpc.ClientConn, error)

func GetEthChainID

func GetEthChainID(chainID string) *big.Int

Convert Burrow's ChainID to a *big.Int so it can be used as a nonce for Ethereum signing. For compatibility with Ethereum tooling this function first tries to interpret the ChainID as an integer encoded either as an eth-style 0x-prefixed hex string or a base 10 integer, falling back to interpreting the string's raw bytes as a big-endian integer

func ReadMessage

func ReadMessage(r io.Reader, pb proto.Message) (int, error)

Read messages with length-prefix framing from the provided Reader. Returns the number of bytes read and io.EOF if ReadMessage is called exactly on the end of a stream.

func WriteMessage

func WriteMessage(w io.Writer, pb proto.Message) (int, error)

Write messages with length-prefix framing to the provider Writer. Returns the number of bytes written.

Types

type GRPCCodec

type GRPCCodec struct {
}

func (*GRPCCodec) Marshal

func (G *GRPCCodec) Marshal(v interface{}) ([]byte, error)

func (*GRPCCodec) Name

func (G *GRPCCodec) Name() string

func (*GRPCCodec) String

func (G *GRPCCodec) String() string

func (*GRPCCodec) Unmarshal

func (G *GRPCCodec) Unmarshal(data []byte, v interface{}) error

type TestMessage

type TestMessage struct {
	Type                 uint32   `protobuf:"varint,1,opt,name=Type,proto3" json:"Type,omitempty"`
	Amount               uint64   `protobuf:"varint,2,opt,name=Amount,proto3" json:"Amount,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

For testing

func (*TestMessage) Descriptor

func (*TestMessage) Descriptor() ([]byte, []int)

func (*TestMessage) GetAmount

func (m *TestMessage) GetAmount() uint64

func (*TestMessage) GetType

func (m *TestMessage) GetType() uint32

func (*TestMessage) Marshal

func (m *TestMessage) Marshal() (dAtA []byte, err error)

func (*TestMessage) MarshalTo

func (m *TestMessage) MarshalTo(dAtA []byte) (int, error)

func (*TestMessage) MarshalToSizedBuffer

func (m *TestMessage) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*TestMessage) ProtoMessage

func (*TestMessage) ProtoMessage()

func (*TestMessage) Reset

func (m *TestMessage) Reset()

func (*TestMessage) Size

func (m *TestMessage) Size() (n int)

func (TestMessage) String

func (tm TestMessage) String() string

func (*TestMessage) Unmarshal

func (m *TestMessage) Unmarshal(dAtA []byte) error

func (*TestMessage) XXX_DiscardUnknown

func (m *TestMessage) XXX_DiscardUnknown()

func (*TestMessage) XXX_Marshal

func (m *TestMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*TestMessage) XXX_Merge

func (m *TestMessage) XXX_Merge(src proto.Message)

func (*TestMessage) XXX_MessageName

func (*TestMessage) XXX_MessageName() string

func (*TestMessage) XXX_Size

func (m *TestMessage) XXX_Size() int

func (*TestMessage) XXX_Unmarshal

func (m *TestMessage) XXX_Unmarshal(b []byte) error

Directories

Path Synopsis
See https://eth.wiki/fundamentals/rlp
See https://eth.wiki/fundamentals/rlp

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL