message

package
v0.0.0-...-77e7770 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2024 License: LGPL-3.0 Imports: 3 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Handler

type Handler interface {
	HandleMessage(m *Message) (*proposal.Proposal, error)
}

type Message

type Message struct {
	Source      uint8       // Source where message was initiated
	Destination uint8       // Destination chain of message
	Data        interface{} // Data associated with the message
	ID          string      // ID is used to track and identify message across networks
	Type        MessageType // Message type
	Timestamp   time.Time   //
}

func NewMessage

func NewMessage(
	source, destination uint8,
	data interface{},
	id string,
	msgType MessageType,
	timestamp time.Time) *Message

type MessageHandler

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

func NewMessageHandler

func NewMessageHandler() *MessageHandler

func (*MessageHandler) HandleMessage

func (h *MessageHandler) HandleMessage(m *Message) (*proposal.Proposal, error)

HandlerMessage calls associated handler for that message type and returns a proposal to be submitted on-chain

func (*MessageHandler) RegisterMessageHandler

func (mh *MessageHandler) RegisterMessageHandler(t MessageType, h Handler)

RegisterMessageHandler registers a message handler by associating a handler to a message type

type MessageStatus

type MessageStatus string
const (
	SuccessfulMessage MessageStatus = "successful"
	FailedMessage     MessageStatus = "failed"
	PendingMessage    MessageStatus = "pending"
)

type MessageType

type MessageType string

Jump to

Keyboard shortcuts

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