json

package
v0.26.17-access-fix-dy... Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2022 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// consensus
	CodeBlockProposal = iota + 1
	CodeBlockVote

	// protocol state sync
	CodeSyncRequest
	CodeSyncResponse
	CodeRangeRequest
	CodeBatchRequest
	CodeBlockResponse

	// cluster consensus
	CodeClusterBlockProposal
	CodeClusterBlockVote
	CodeClusterBlockResponse

	// collections, guarantees & transactions
	CodeCollectionGuarantee
	CodeTransaction
	CodeTransactionBody

	// core messages for execution & verification
	CodeExecutionReceipt
	CodeResultApproval

	// execution state synchronization
	CodeExecutionStateSyncRequest
	CodeExecutionStateDelta

	// data exchange for execution of blocks
	CodeChunkDataRequest
	CodeChunkDataResponse

	// result approvals
	CodeApprovalRequest
	CodeApprovalResponse

	// generic entity exchange engines
	CodeEntityRequest
	CodeEntityResponse

	// testing
	CodeEcho

	// DKG
	CodeDKGMessage
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Codec

type Codec struct {
}

Codec represents a JSON codec for our network.

func NewCodec

func NewCodec() *Codec

NewCodec creates a new JSON codec.

func (*Codec) Decode

func (c *Codec) Decode(data []byte) (interface{}, error)

Decode will attempt to decode the given entity from bytes.

func (*Codec) Encode

func (c *Codec) Encode(v interface{}) ([]byte, error)

Encode will encode the givene entity and return the bytes.

func (*Codec) NewDecoder

func (c *Codec) NewDecoder(r io.Reader) network.Decoder

NewDecoder creates a new JSON decoder with the given underlying reader.

func (*Codec) NewEncoder

func (c *Codec) NewEncoder(w io.Writer) network.Encoder

NewEncoder creates a new JSON encoder with the given underlying writer.

type Decoder

type Decoder struct {
	// contains filtered or unexported fields
}

Decoder implements a stream decoder for JSON.

func (*Decoder) Decode

func (d *Decoder) Decode() (interface{}, error)

Decode will decode the next JSON value from the stream.

type Encoder

type Encoder struct {
	// contains filtered or unexported fields
}

Encoder is an encoder to write serialized JSON to a writer.

func (*Encoder) Encode

func (e *Encoder) Encode(v interface{}) error

Encode will convert the given message into binary JSON and write it to the underlying encoder, followed by a new line.

type Envelope

type Envelope struct {
	Code uint8
	Data json.RawMessage
}

Envelope is a wrapper to convey type information with JSON encoding without writing custom bytes to the wire.

Jump to

Keyboard shortcuts

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