notify

package
v0.0.0-...-9f791b1 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// LevelInfo :
	LevelInfo = iota
	// LevelWarn :
	LevelWarn
	// LevelError :
	LevelError
)
View Source
const (
	//InfoTypeString 0 简单的string通知
	InfoTypeString = iota
	//InfoTypeSentTransferDetail 1 发起的交易状态发生了变化, Message类型微models.SentTransferDetail
	InfoTypeSentTransferDetail
	//InfoTypeChannelCallID 2 关于通道的操作,有了结果
	InfoTypeChannelCallID
	//InfoTypeChannelStatus 3 通道状态发生了变化,包括但不限于
	//balance
	//patner_balance
	//locked_amount
	//partner_locked_amount
	//state
	InfoTypeChannelStatus

	// InfoTypeContractCallTXInfo 4 自己发起的tx执行完成,通知执行结果,Message类型为models.TXInfo
	InfoTypeContractCallTXInfo
)
View Source
const (
	//CallStatusFinishedSuccess 调用成功
	CallStatusFinishedSuccess = iota + 1
	//CallStatusError 失败
	CallStatusError
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Handler

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

Handler : deal notice info for upper app

func NewNotifyHandler

func NewNotifyHandler() *Handler

NewNotifyHandler :

func (*Handler) GetNoticeChan

func (h *Handler) GetNoticeChan() <-chan *Notice

GetNoticeChan : return read-only, keep chan private

func (*Handler) GetReceivedTransferChan

func (h *Handler) GetReceivedTransferChan() <-chan *models.ReceivedTransfer

GetReceivedTransferChan : keep chan private

func (*Handler) Notify

func (h *Handler) Notify(level Level, info *InfoStruct)

Notify : 通知上层,不让阻塞,以免影响正常业务

func (*Handler) NotifyChannelCallIDError

func (h *Handler) NotifyChannelCallIDError(callID string, err error)

NotifyChannelCallIDError 通知channel callid结果出错

func (*Handler) NotifyChannelCallIDSuccess

func (h *Handler) NotifyChannelCallIDSuccess(callID string, channel *channeltype.ChannelDataDetail)

NotifyChannelCallIDSuccess 通知channel callid成功

func (*Handler) NotifyChannelStatus

func (h *Handler) NotifyChannelStatus(ch *channeltype.ChannelDataDetail)

NotifyChannelStatus 通知channel发生了变化,包括balance,locked_amount,state等等

func (*Handler) NotifyContractCallTXInfo

func (h *Handler) NotifyContractCallTXInfo(txInfo *models.TXInfo)

NotifyContractCallTXInfo 当自己发起的合约调用tx被成功打包时,通知上层

func (*Handler) NotifyReceiveMediatedTransfer

func (h *Handler) NotifyReceiveMediatedTransfer(msg *encoding.MediatedTransfer, tokenAddress common.Address)

NotifyReceiveMediatedTransfer :通知收到了MediatedTransfer

func (*Handler) NotifyReceiveTransfer

func (h *Handler) NotifyReceiveTransfer(rt *models.ReceivedTransfer)

NotifyReceiveTransfer : 通知成功收到一笔token

func (*Handler) NotifySentTransferDetail

func (h *Handler) NotifySentTransferDetail(sentTransferDetail *models.SentTransferDetail)

NotifySentTransferDetail : 通知上层,不让阻塞,以免影响正常业务

func (*Handler) NotifyString

func (h *Handler) NotifyString(level Level, info string)

NotifyString : 通知上层,不让阻塞,以免影响正常业务

func (*Handler) Stop

func (h *Handler) Stop()

Stop :

type InfoStruct

type InfoStruct struct {
	Type    int         `json:"type"` //InfoTypeString 表示Message是一个string,InfoTypeTransferStatus表示Message是TransferStatus
	Message interface{} `json:"message"`
}

InfoStruct for notify to mobile

type Level

type Level int

Level :

type Notice

type Notice struct {
	Level Level  `json:"level"`
	Info  string `json:"info"`
}

Notice for mobile or app

Jump to

Keyboard shortcuts

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