Documentation ¶
Index ¶
- func AddSchema(schema MessageSchema) error
- func Decode(data []byte) (any, error)
- func DecodeIntoMap(m map[string]any, data []byte) (string, error)
- func EncodeError(Message string) []byte
- func EncodeFromMap(kind string, m map[string]any) ([]byte, error)
- func EncodeLog(Message string) []byte
- func FilterReports[T any](reports []Report, id [4]byte) []T
- func FindReport[T any](reports []Report, id [4]byte) (empty T, found bool)
- func MustAddSchema(schema MessageSchema)
- type AdvanceResult
- type CompletionStatus
- type Decoder
- type Encoder
- type Error
- type ID
- type InspectResult
- type Log
- type MessageSchema
- type Notice
- type Report
- type Result
- type Voucher
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddSchema ¶
func AddSchema(schema MessageSchema) error
Add a message schema to the schemas managed by EggRoll.
func DecodeIntoMap ¶
Decode the binary data into a map. Return the schema kind.
func EncodeFromMap ¶
Encode the JSON message into an ABI payload.
func FilterReports ¶
Filter the reports with the given id and unpack it into T.
func FindReport ¶
Find the report with the given id and unpack it into T.
func MustAddSchema ¶
func MustAddSchema(schema MessageSchema)
Add a message schema to the schemas managed by EggRoll. Panic if an error occurs.
Types ¶
type AdvanceResult ¶
type AdvanceResult struct { Result // Advance input index. Index int // Payload of the input. Payload []byte // Input sender. Sender common.Address // Number of the block the input was mined. BlockNumber int64 // Time of the block the input was mined. BlockTimestamp time.Time // Resulting vouchers of the request. Vouchers []Voucher // Resulting notices of the request. Notices []Notice }
Result of an advance request.
type CompletionStatus ¶
type CompletionStatus int
Completion of an advance or inspect request.
const ( CompletionStatusUnprocessed CompletionStatus = iota CompletionStatusAccepted CompletionStatusRejected CompletionStatusException CompletionStatusMachineHalted CompletionStatusCycleLimitExceeded CompletionStatusTimeLimitExceeded CompletionStatusPayloadLengthLimitExceeded )
type Encoder ¶
type Encoder interface { // Encode a Go value into binary data. Encode() []byte }
The Go types for message schema implement this interface.
type ID ¶
type ID [4]byte
EggRoll uses 4 bytes to identify the message kind when decoding it. This is based on the function selector of the Solidity ABI.
var ErrorID ID
ID for the error message
var LogID ID
ID for the log message type.
type InspectResult ¶
type InspectResult struct { Result // Number of processed advance inputs when the inspect was made. ProcessedInputCount int }
Result of an inspect request.
type MessageSchema ¶
Schema for a message.
func GetSchemas ¶
func GetSchemas() (result []MessageSchema)
Get all schemas managed by EggRoll. The schemas are sorted by Kind.
type Result ¶
type Result struct { // Completion status of the request. Status CompletionStatus // Resulting reports of the request. Reports []Report }
Result of an request.