types

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	MaxTxRetry         uint8 = 5
	StaleMarkCount           = MaxTxRetry * 3
	RouteDuration            = 3 * time.Second
	XcallContract            = "xcall"
	ConnectionContract       = "connection"
	SupportedContracts       = []string{XcallContract, ConnectionContract}
	RetryInterval            = 3*time.Second + RouteDuration
)

Functions

This section is empty.

Types

type BlockInfo

type BlockInfo struct {
	Height   uint64
	Messages []*Message
}

type Coin

type Coin struct {
	Denom  string
	Amount uint64
}

func NewCoin

func NewCoin(denom string, amount uint64) *Coin

func (*Coin) Calculate

func (c *Coin) Calculate() string

func (*Coin) String

func (c *Coin) String() string

type ContractConfigMap added in v1.1.0

type ContractConfigMap map[string]string

func (ContractConfigMap) Validate added in v1.1.0

func (c ContractConfigMap) Validate() error

type EventMap added in v1.1.0

type EventMap struct {
	Address      string
	ContractName string
	SigType      map[string]string
}

func (*EventMap) GetWasmMsgType added in v1.2.6

func (m *EventMap) GetWasmMsgType() string

GetWasmMsgType returns the wasm message type

type LastProcessedTx added in v1.6.0

type LastProcessedTx struct {
	Height uint64
	Info   []byte
}

type Message

type Message struct {
	Dst             string   `json:"dst"`
	Src             string   `json:"src"`
	Sn              *big.Int `json:"sn"`
	Data            []byte   `json:"data"`
	MessageHeight   uint64   `json:"messageHeight"`
	EventType       string   `json:"eventType"`
	ReqID           *big.Int `json:"reqID,omitempty"`
	DappModuleCapID string   `json:"dappModuleCapID,omitempty"`

	TxInfo []byte `json:"-"`
}

func (*Message) MessageKey

func (m *Message) MessageKey() *MessageKey

type MessageCache

type MessageCache struct {
	Messages map[string]*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) GetCacheKey added in v1.5.1

func (m *MessageCache) GetCacheKey(key *MessageKey) string

func (*MessageCache) HasCacheKey added in v1.5.1

func (m *MessageCache) HasCacheKey(cacheKey string) bool

func (*MessageCache) Len

func (m *MessageCache) Len() int

func (*MessageCache) Remove

func (m *MessageCache) Remove(key *MessageKey)

type MessageKey

type MessageKey struct {
	Sn        *big.Int
	Src       string
	Dst       string
	EventType string
}

func NewMessageKey

func NewMessageKey(sn *big.Int, 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 Receipt

type Receipt struct {
	TxHash string
	Height uint64
	Status bool
}

type ResponseCode

type ResponseCode uint8
const (
	Failed  ResponseCode = 0
	Success ResponseCode = 1
)

type RouteMessage

type RouteMessage struct {
	*Message
	Retry      uint8
	Processing 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()

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)

Jump to

Keyboard shortcuts

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