Documentation
¶
Index ¶
- Constants
- func IsNonRetryable(err error) bool
- func NewNonRetryableError(err error) error
- func RpcDial(ctx context.Context, rpcH *GlobalRpc, rpcType RPCKind) (*ethclient.Client, func(), error)
- func RpcQuery[T any](ctx context.Context, rpcH *GlobalRpc, attempts int, wait time.Duration, ...) (T, error)
- type GlobalRpc
- type NonRetryableError
- type NonceProvider
- type RPCKind
- type Receipt
- type RpcConfig
Constants ¶
View Source
const ( EXPIRY_SEC = "10" // rpc locks expire after this amount of time REDIS_KEY_CURR_IDX = "glbl_rpc:idx" REDIS_KEY_URLS = "glbl_rpc:urls" REDIS_KEY_LOCK = "glbl_rpc:lock" REDIS_SET_URL_LOCK = "glbl_rpc:urls_lock" )
View Source
const LUA_ACQUIRE = `` /* 370-byte string literal not displayed */
View Source
const LUA_NONCE_NEXT = `` /* 144-byte string literal not displayed */
View Source
const LUA_RELEASE = `
if redis.call("GET", KEYS[1]) == ARGV[1] then
return redis.call("DEL", KEYS[1])
end
return 0
`
View Source
const LUA_RENEW = `
if redis.call("GET", KEYS[1]) == ARGV[1] then
return redis.call("EXPIRE", KEYS[1], ARGV[2])
end
return 0
`
View Source
const REDIS_KEY_NONCE = "glbl_rpc:nonce:"
Variables ¶
This section is empty.
Functions ¶
func IsNonRetryable ¶
IsNonRetryable reports whether err (or any error in its chain) is a NonRetryableError.
func NewNonRetryableError ¶
NewNonRetryableError wraps err so that RpcQuery will not retry.
Types ¶
type GlobalRpc ¶
type GlobalRpc struct {
Config RpcConfig
// contains filtered or unexported fields
}
func NewGlobalRpc ¶
func (*GlobalRpc) GetAndLockRpc ¶
func (*GlobalRpc) NewNonceTracker ¶ added in v0.1.1
func (gr *GlobalRpc) NewNonceTracker(address common.Address) NonceProvider
func (*GlobalRpc) ReturnLock ¶
type NonRetryableError ¶
type NonRetryableError struct {
Err error
}
NonRetryableError wraps an error to signal that RpcQuery should not retry. Use NewNonRetryableError to wrap errors that indicate a previous attempt already had a side effect (e.g. a transaction was submitted).
func (*NonRetryableError) Error ¶
func (e *NonRetryableError) Error() string
func (*NonRetryableError) Unwrap ¶
func (e *NonRetryableError) Unwrap() error
type NonceProvider ¶ added in v0.1.1
Click to show internal directories.
Click to hide internal directories.