types

package
v1.2.5 Latest Latest
Warning

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

Go to latest
Published: May 22, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

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            = 5 * time.Second
)

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
}

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

type MessageKey struct {
	Sn        uint64
	Src       string
	Dst       string
	EventType string
}

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 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
	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)

Jump to

Keyboard shortcuts

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