messager

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: May 2, 2026 License: MIT Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Messager

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

Messager sends hop and flow messages

func NewMessager

func NewMessager(
	nodeConfig common.GlobalNodeConfig,
	signer eth.Signer,
	streamWriter common.StreamWriter,
	routeForwarder *route.Forwarder,
	monitorService intfs.MonitorService,
	serverForwarder handlers.ForwardToServerCallback,
	depositProcessor *deposit.Processor,
	dal *storage.DAL,
	isOSP bool,
) *Messager

func (*Messager) AckMsgQueue

func (m *Messager) AckMsgQueue(cid ctype.CidType, ack, nack uint64) error

ACK a message in a channel queue.

func (*Messager) DisableMsgQueue

func (m *Messager) DisableMsgQueue(peer ctype.Addr) error

Disable message queue processing for this peer address.

func (*Messager) EnableMsgQueue

func (m *Messager) EnableMsgQueue(peer ctype.Addr) error

Enable message queue processing for this peer address.

func (*Messager) ForwardCelerMsg

func (m *Messager) ForwardCelerMsg(peerTo ctype.Addr, msg *rpc.CelerMsg) error

func (*Messager) ForwardCondPayRequest

func (m *Messager) ForwardCondPayRequest(
	payBytes []byte, note *anypb.Any, delegable bool, xnet *rpc.CrossNetPay, logEntry *pem.PayEventMessage) (ctype.Addr, error)

func (*Messager) ForwardCondPayRequestMsg

func (m *Messager) ForwardCondPayRequestMsg(frame *common.MsgFrame) error

func (*Messager) ForwardPaySettleProofMsg

func (m *Messager) ForwardPaySettleProofMsg(frame *common.MsgFrame) error

func (*Messager) ForwardPaySettleRequestMsg

func (m *Messager) ForwardPaySettleRequestMsg(frame *common.MsgFrame) error

func (*Messager) GetMsgQueue

func (m *Messager) GetMsgQueue(cid ctype.CidType, seqnum uint64) (*rpc.CelerMsg, bool)

Get a message from a channel queue.

func (*Messager) IsDirectPay

func (m *Messager) IsDirectPay(pay *entity.ConditionalPay, peer ctype.Addr, dstNetId uint64) bool

Is this a direct payment from me to this peer? The peer is an optional parameter, if it is not given (an empty string), the next hop peer is looked up. For now only consider unconditional payments where I am the source and the destination is my next hop peer. This is typical of fee (client to OSP) and prize (OSP to client) payments in centralized games.

func (*Messager) ResendMsgQueue

func (m *Messager) ResendMsgQueue(cid ctype.CidType, seqnum uint64) error

Resend a message in a channel queue.

func (*Messager) SendCondPayRequest

func (m *Messager) SendCondPayRequest(payBytes []byte, note *anypb.Any, xnet *rpc.CrossNetPay, logEntry *pem.PayEventMessage) error

func (*Messager) SendOnePaySettleProof

func (m *Messager) SendOnePaySettleProof(
	payID ctype.PayIDType,
	reason rpc.PaymentSettleReason,
	logEntry *pem.PayEventMessage) error

func (*Messager) SendOnePaySettleRequest

func (m *Messager) SendOnePaySettleRequest(
	pay *entity.ConditionalPay,
	payAmt *big.Int,
	reason rpc.PaymentSettleReason,
	logEntry *pem.PayEventMessage) error

func (*Messager) SendPayUnreachableSettleProof

func (m *Messager) SendPayUnreachableSettleProof(
	payID ctype.PayIDType,
	path *rpc.PayPath,
	logEntry *pem.PayEventMessage) error

func (*Messager) SendPaysSettleProof

func (m *Messager) SendPaysSettleProof(
	payIDs []ctype.PayIDType,
	reason rpc.PaymentSettleReason,
	payPaths []*rpc.PayPath,
	logEntry *pem.PayEventMessage) error

func (*Messager) SendPaysSettleRequest

func (m *Messager) SendPaysSettleRequest(
	pays []*entity.ConditionalPay,
	payAmts []*big.Int,
	reason rpc.PaymentSettleReason,
	logEntry *pem.PayEventMessage) ([]*entity.ConditionalPay, error)

type MsgQueue

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

func NewMsqQueue

func NewMsqQueue(dal *storage.DAL, streamWriter common.StreamWriter, myAddr ctype.Addr) *MsgQueue

func (*MsgQueue) AckMsg

func (m *MsgQueue) AckMsg(cid ctype.CidType, ack, nack uint64) error

Note: this function is not symmetrical to AddMsg() which only adds a message to the queue separately from it being written to storage before. This flows from the different requirements in how messages are created compared to how they are ACKed and deleted.

func (*MsgQueue) AddMsg

func (m *MsgQueue) AddMsg(peer ctype.Addr, cid ctype.CidType, seqnum uint64, msg *rpc.CelerMsg) error

Add a message for a channel. The message itself must have been saved to storage before calling this function. This is typically done atomically inside a store transaction along with other updates, and if successful, AddMsg() is called to notify the message queue.

func (*MsgQueue) AddPeer

func (m *MsgQueue) AddPeer(peer ctype.Addr) error

A peer connected to this server, add its channels to the message queue and start (or resume) managing its messages.

func (*MsgQueue) GetMsg

func (m *MsgQueue) GetMsg(cid ctype.CidType, seqnum uint64) (*rpc.CelerMsg, bool)

GetMsg returns <msg, exist> from the queue

func (*MsgQueue) RemovePeer

func (m *MsgQueue) RemovePeer(peer ctype.Addr) error

A peer disconnected from this server, remove it from the message queue and stop managing its messages.

func (*MsgQueue) ResendMsg

func (m *MsgQueue) ResendMsg(cid ctype.CidType, seqnum uint64) error

type Queue

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

Jump to

Keyboard shortcuts

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