engine

package
v1.3.2 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: LGPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Context

type Context interface {
	// Timestamp returns the UNIX timestamp of the tick.
	Timestamp() uint64
	// CurrentTick returns the current tick.
	CurrentTick() uint64
	// Logger returns the logger that can be used to log messages from within system or query.
	Logger() *zerolog.Logger
	// EmitEvent emits an event that will be broadcast to all websocket subscribers.
	EmitEvent(map[string]any) error
	// EmitStringEvent emits a string event that will be broadcast to all websocket subscribers.
	// This method is provided for backwards compatability. EmitEvent should be used for most cases.
	EmitStringEvent(string) error
	// Namespace returns the namespace of the world.
	Namespace() string

	// SetLogger is used to inject a new logger configuration to an engine context that is already created.
	SetLogger(logger zerolog.Logger)
	AddMessageError(id types.TxHash, err error)
	SetMessageResult(id types.TxHash, a any)
	GetComponentByName(name string) (types.ComponentMetadata, error)
	GetMessageByType(mType reflect.Type) (types.Message, bool)
	GetTransactionReceipt(id types.TxHash) (any, []error, bool)
	GetSignerForPersonaTag(personaTag string, tick uint64) (addr string, err error)
	GetTransactionReceiptsForTick(tick uint64) ([]receipt.Receipt, error)
	ReceiptHistorySize() uint64
	AddTransaction(id types.MessageID, v any, sig *sign.Transaction) (uint64, types.TxHash)
	IsWorldReady() bool
	StoreReader() gamestate.Reader
	StoreManager() gamestate.Manager
	GetTxPool() *txpool.TxPool
	IsReadOnly() bool
}

type Query

type Query interface {
	// Name returns the name of the query.
	Name() string
	// Group returns the group of the query.
	Group() string
	// HandleQuery handles queries with concrete types, rather than encoded bytes.
	HandleQuery(Context, any) (any, error)
	// HandleQueryRaw is given a reference to the engine, json encoded bytes that represent a query request
	// and is expected to return a json encoded response struct.
	HandleQueryRaw(Context, []byte) ([]byte, error)
	// DecodeEVMRequest decodes bytes originating from the evm into the request type, which will be ABI encoded.
	DecodeEVMRequest([]byte) (any, error)
	// EncodeEVMReply encodes the reply as an abi encoded struct.
	EncodeEVMReply(any) ([]byte, error)
	// DecodeEVMReply decodes EVM reply bytes, into the concrete go reply type.
	DecodeEVMReply([]byte) (any, error)
	// EncodeAsABI encodes a go struct in abi format. This is mostly used for testing.
	EncodeAsABI(any) ([]byte, error)
	// IsEVMCompatible reports if the query is able to be sent from the EVM.
	IsEVMCompatible() bool
	// GetRequestFieldInformation returns a map of the fields of the query's request type and their types.
	GetRequestFieldInformation() map[string]any
}

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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