Documentation ¶
Index ¶
- Variables
- type BlockInfo
- type Coin
- type ContractConfigMap
- type EventMap
- type Message
- type MessageCache
- type MessageKey
- type MessageKeyWithMessageHeight
- type Receipt
- type ResponseCode
- type RouteMessage
- func (r *RouteMessage) AddNextTry()
- func (r *RouteMessage) GetMessage() *Message
- func (r *RouteMessage) GetRetry() uint8
- func (r *RouteMessage) IncrementRetry()
- func (r *RouteMessage) IsElasped(duration time.Duration) bool
- func (r *RouteMessage) IsProcessing() bool
- func (r *RouteMessage) IsStale() bool
- func (r *RouteMessage) ToggleProcessing()
- func (r *RouteMessage) ToggleStale()
- type TransactionObject
- type TxResponse
- type TxResponseFunc
Constants ¶
This section is empty.
Variables ¶
View Source
var ( MaxTxRetry uint8 = 10 StaleMarkCount = MaxTxRetry * 3 SpecialRetryCount uint8 = 2 XcallContract = "xcall" ConnectionContract = "connection" SupportedContracts = []string{XcallContract, ConnectionContract} RetryInterval = 3 * time.Second )
Functions ¶
This section is empty.
Types ¶
type ContractConfigMap ¶ added in v1.1.0
func (ContractConfigMap) Validate ¶ added in v1.1.0
func (c ContractConfigMap) Validate() error
type EventMap ¶ added in v1.1.0
func (*EventMap) GetWasmMsgType ¶ added in v1.2.6
GetWasmMsgType returns the wasm message type
type Message ¶
type Message struct { Dst string `json:"dst"` Src string `json:"src"` Sn uint64 `json:"sn"` Data []byte `json:"data"` MessageHeight uint64 `json:"messageHeight"` EventType string `json:"eventType"` ReqID uint64 `json:"reqID,omitempty"` }
func (*Message) MessageKey ¶
func (m *Message) MessageKey() *MessageKey
type MessageCache ¶
type MessageCache struct { Messages map[MessageKey]*RouteMessage *sync.RWMutex }
func NewMessageCache ¶
func NewMessageCache() *MessageCache
func (*MessageCache) Add ¶
func (m *MessageCache) Add(r *RouteMessage)
func (*MessageCache) Get ¶ added in v1.1.2
func (m *MessageCache) Get(key *MessageKey) (*RouteMessage, bool)
Get returns the message from the cache
func (*MessageCache) Len ¶
func (m *MessageCache) Len() int
func (*MessageCache) Remove ¶
func (m *MessageCache) Remove(key *MessageKey)
type MessageKey ¶
func NewMessageKey ¶
func NewMessageKey(sn uint64, src string, dst string, eventType string) *MessageKey
type MessageKeyWithMessageHeight ¶
type MessageKeyWithMessageHeight struct { *MessageKey Height uint64 }
func NewMessagekeyWithMessageHeight ¶
func NewMessagekeyWithMessageHeight(key *MessageKey, height uint64) *MessageKeyWithMessageHeight
type ResponseCode ¶
type ResponseCode uint8
const ( Failed ResponseCode = 0 Success ResponseCode = 1 )
type RouteMessage ¶
type RouteMessage struct { *Message Retry uint8 Processing bool MarkedStale bool LastTry time.Time }
func NewRouteMessage ¶
func NewRouteMessage(m *Message) *RouteMessage
func (*RouteMessage) AddNextTry ¶ added in v1.1.0
func (r *RouteMessage) AddNextTry()
ResetLastTry resets the last try time to the current time plus the retry interval
func (*RouteMessage) GetMessage ¶
func (r *RouteMessage) GetMessage() *Message
func (*RouteMessage) GetRetry ¶
func (r *RouteMessage) GetRetry() uint8
func (*RouteMessage) IncrementRetry ¶
func (r *RouteMessage) IncrementRetry()
func (*RouteMessage) IsElasped ¶ added in v1.2.0
func (r *RouteMessage) IsElasped(duration time.Duration) bool
IsElasped checks if the last try is elasped by the duration
func (*RouteMessage) IsProcessing ¶
func (r *RouteMessage) IsProcessing() bool
func (*RouteMessage) IsStale ¶
func (r *RouteMessage) IsStale() bool
stale means message which is expired
func (*RouteMessage) ToggleProcessing ¶ added in v1.1.0
func (r *RouteMessage) ToggleProcessing()
func (*RouteMessage) ToggleStale ¶ added in v1.2.0
func (r *RouteMessage) ToggleStale()
type TransactionObject ¶
type TransactionObject struct { *MessageKeyWithMessageHeight TxHash string TxHeight uint64 }
func NewTransactionObject ¶
func NewTransactionObject(messageKey *MessageKeyWithMessageHeight, txHash string, height uint64) *TransactionObject
type TxResponse ¶
type TxResponse struct { Height int64 TxHash string Codespace string Code ResponseCode Data string }
type TxResponseFunc ¶
type TxResponseFunc func(key *MessageKey, response *TxResponse, err error)
Click to show internal directories.
Click to hide internal directories.