Documentation ¶
Index ¶
Constants ¶
View Source
const ( CodeConnectionError = iota + 100 CodeServerError )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GetAddressFn ¶
type GetAddressFn func( ctx context.Context, request *namespacetypes.AddressRequest, ) (*namespacetypes.AddressResponse, error)
type Option ¶
type Option func(r *routerImpl)
func WithCredentials ¶
WithCredentials sets the SSH credentials for the gRPC server.
type Result ¶
type Result struct { *routerv1.SendMessageResponse // contains filtered or unexported fields }
type ResultStorage ¶
type ResultStorage interface { Result(key string) (Result, bool) SetResult(msg *routerv1.SendMessageResponse) }
func NewMemoryResultStorage ¶
func NewMemoryResultStorage(keepAlive time.Duration) ResultStorage
type Router ¶
type Router interface { // SendMessage queues a message to be sent to a game shard. SendMessage(_ context.Context, namespace string, sender string, msgID string, msg []byte) error // Query queries a game shard. Query(ctx context.Context, request []byte, resource, namespace string) ([]byte, error) // MessageResult gets the game shard transaction Result that originated from an EVM tx. MessageResult(_ context.Context, evmTxHash string) ([]byte, string, uint32, error) // PostBlockHook implements the polaris EVM PostBlock hook. It runs after an EVM tx execution has finished // processing. PostBlockHook(types.Transactions, types.Receipts, types.Signer) }
Router defines the methods required to interact with a game shard. The methods are invoked from EVM smart contracts.
func NewRouter ¶
func NewRouter(logger log.Logger, ctxGetter GetQueryCtxFn, addrGetter GetAddressFn, opts ...Option) Router
NewRouter returns a Router.
Click to show internal directories.
Click to hide internal directories.